mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Fixes for text box and uart echo
thanks Willy-JL !
This commit is contained in:
@@ -283,13 +283,14 @@ static UartEchoApp* uart_echo_app_alloc(uint32_t baudrate) {
|
||||
static void uart_echo_app_free(UartEchoApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
furi_hal_serial_async_rx_stop(app->serial_handle);
|
||||
furi_hal_serial_deinit(app->serial_handle);
|
||||
furi_hal_serial_control_release(app->serial_handle);
|
||||
|
||||
furi_thread_flags_set(furi_thread_get_id(app->worker_thread), WorkerEventStop);
|
||||
furi_thread_join(app->worker_thread);
|
||||
furi_thread_free(app->worker_thread);
|
||||
|
||||
furi_hal_serial_deinit(app->serial_handle);
|
||||
furi_hal_serial_control_release(app->serial_handle);
|
||||
|
||||
// Free views
|
||||
view_dispatcher_remove_view(app->view_dispatcher, 0);
|
||||
|
||||
|
||||
@@ -102,9 +102,11 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) {
|
||||
model->text_pos = (char*)model->text;
|
||||
if(model->focus == TextBoxFocusEnd && line_num > 5) {
|
||||
// Set text position to 5th line from the end
|
||||
for(uint8_t i = 0; i < line_num - 5; i++) {
|
||||
while(*model->text_pos++ != '\n') {
|
||||
};
|
||||
const char* end = model->text + furi_string_size(model->text_formatted);
|
||||
for(size_t i = 0; i < line_num - 5; i++) {
|
||||
while(model->text_pos < end) {
|
||||
if(*model->text_pos++ == '\n') break;
|
||||
}
|
||||
}
|
||||
model->scroll_num = line_num - 4;
|
||||
model->scroll_pos = line_num - 5;
|
||||
|
||||
Reference in New Issue
Block a user