This commit is contained in:
MX
2022-10-05 21:27:13 +03:00
parent 0796263e81
commit c60bfbf271
75 changed files with 936 additions and 917 deletions

View File

@@ -7,13 +7,13 @@ void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
// If text box store gets too big, then truncate it
app->text_box_store_strlen += len;
if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
string_right(app->text_box_store, app->text_box_store_strlen / 2);
app->text_box_store_strlen = string_size(app->text_box_store) + len;
furi_string_right(app->text_box_store, app->text_box_store_strlen / 2);
app->text_box_store_strlen = furi_string_size(app->text_box_store) + len;
}
// Null-terminate buf and append to text box store
buf[len] = '\0';
string_cat_printf(app->text_box_store, "%s", buf);
furi_string_cat_printf(app->text_box_store, "%s", buf);
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshConsoleOutput);
}
@@ -30,7 +30,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
text_box_set_focus(text_box, TextBoxFocusEnd);
}
if(app->is_command) {
string_reset(app->text_box_store);
furi_string_reset(app->text_box_store);
app->text_box_store_strlen = 0;
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
const char* help_msg =
@@ -47,7 +47,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
}
// Set starting text - for "View Log", this will just be what was already in the text box store
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneConsoleOutput, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);
@@ -70,7 +70,7 @@ bool wifi_marauder_scene_console_output_on_event(void* context, SceneManagerEven
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
consumed = true;
} else if(event.type == SceneManagerEventTypeTick) {
consumed = true;

View File

@@ -53,8 +53,8 @@ WifiMarauderApp* wifi_marauder_app_alloc() {
app->text_box = text_box_alloc();
view_dispatcher_add_view(
app->view_dispatcher, WifiMarauderAppViewConsoleOutput, text_box_get_view(app->text_box));
string_init(app->text_box_store);
string_reserve(app->text_box_store, WIFI_MARAUDER_TEXT_BOX_STORE_SIZE);
app->text_box_store = furi_string_alloc();
furi_string_reserve(app->text_box_store, WIFI_MARAUDER_TEXT_BOX_STORE_SIZE);
app->text_input = text_input_alloc();
view_dispatcher_add_view(
@@ -73,7 +73,7 @@ void wifi_marauder_app_free(WifiMarauderApp* app) {
view_dispatcher_remove_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);
view_dispatcher_remove_view(app->view_dispatcher, WifiMarauderAppViewTextInput);
text_box_free(app->text_box);
string_clear(app->text_box_store);
furi_string_free(app->text_box_store);
text_input_free(app->text_input);
// View dispatcher

View File

@@ -23,7 +23,7 @@ struct WifiMarauderApp {
SceneManager* scene_manager;
char text_input_store[WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE + 1];
string_t text_box_store;
FuriString* text_box_store;
size_t text_box_store_strlen;
TextBox* text_box;
TextInput* text_input;