jblanked 1 год назад
Родитель
Сommit
129435d365
5 измененных файлов с 63 добавлено и 63 удалено
  1. BIN
      .DS_Store
  2. 16 16
      flip_library_callback.h
  3. 21 21
      flip_library_e.h
  4. 6 6
      flip_library_free.h
  5. 20 20
      flip_library_i.h

+ 16 - 16
flip_library_callback.h

@@ -425,7 +425,7 @@ static void view_draw_callback_random_facts(Canvas *canvas, void *model)
 
 static void view_draw_callback_dictionary_run(Canvas *canvas, void *model)
 {
-    if (!canvas || !app_instance || app_instance->text_input_buffer_dictionary == NULL)
+    if (!canvas || !app_instance || app_instance->uart_text_input_buffer_dictionary == NULL)
     {
         return;
     }
@@ -452,7 +452,7 @@ static void view_draw_callback_dictionary_run(Canvas *canvas, void *model)
         sent_random_fact_request = true;
 
         char payload[128];
-        snprintf(payload, sizeof(payload), "{\"word\":\"%s\"}", app_instance->text_input_buffer_dictionary);
+        snprintf(payload, sizeof(payload), "{\"word\":\"%s\"}", app_instance->uart_text_input_buffer_dictionary);
 
         random_fact_request_success = flipper_http_post_request_with_headers("https://www.flipsocial.net/api/define/", "{\"Content-Type\":\"application/json\"}", payload);
         if (!random_fact_request_success)
@@ -614,24 +614,24 @@ static void text_updated_ssid(void *context)
     }
 
     // store the entered text
-    strncpy(app->text_input_buffer_ssid, app->text_input_temp_buffer_ssid, app->text_input_buffer_size_ssid);
+    strncpy(app->uart_text_input_buffer_ssid, app->uart_text_input_temp_buffer_ssid, app->uart_text_input_buffer_size_ssid);
 
     // Ensure null-termination
-    app->text_input_buffer_ssid[app->text_input_buffer_size_ssid - 1] = '\0';
+    app->uart_text_input_buffer_ssid[app->uart_text_input_buffer_size_ssid - 1] = '\0';
 
     // update the variable item text
     if (app->variable_item_ssid)
     {
-        variable_item_set_current_value_text(app->variable_item_ssid, app->text_input_buffer_ssid);
+        variable_item_set_current_value_text(app->variable_item_ssid, app->uart_text_input_buffer_ssid);
     }
 
     // save settings
-    save_settings(app->text_input_buffer_ssid, app->text_input_buffer_password);
+    save_settings(app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_password);
 
     // save wifi settings to devboard
-    if (strlen(app->text_input_buffer_ssid) > 0 && strlen(app->text_input_buffer_password) > 0)
+    if (strlen(app->uart_text_input_buffer_ssid) > 0 && strlen(app->uart_text_input_buffer_password) > 0)
     {
-        if (!flipper_http_save_wifi(app->text_input_buffer_ssid, app->text_input_buffer_password))
+        if (!flipper_http_save_wifi(app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_password))
         {
             FURI_LOG_E(TAG, "Failed to save wifi settings");
         }
@@ -651,24 +651,24 @@ static void text_updated_password(void *context)
     }
 
     // store the entered text
-    strncpy(app->text_input_buffer_password, app->text_input_temp_buffer_password, app->text_input_buffer_size_password);
+    strncpy(app->uart_text_input_buffer_password, app->uart_text_input_temp_buffer_password, app->uart_text_input_buffer_size_password);
 
     // Ensure null-termination
-    app->text_input_buffer_password[app->text_input_buffer_size_password - 1] = '\0';
+    app->uart_text_input_buffer_password[app->uart_text_input_buffer_size_password - 1] = '\0';
 
     // update the variable item text
     if (app->variable_item_password)
     {
-        variable_item_set_current_value_text(app->variable_item_password, app->text_input_buffer_password);
+        variable_item_set_current_value_text(app->variable_item_password, app->uart_text_input_buffer_password);
     }
 
     // save settings
-    save_settings(app->text_input_buffer_ssid, app->text_input_buffer_password);
+    save_settings(app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_password);
 
     // save wifi settings to devboard
-    if (strlen(app->text_input_buffer_ssid) > 0 && strlen(app->text_input_buffer_password) > 0)
+    if (strlen(app->uart_text_input_buffer_ssid) > 0 && strlen(app->uart_text_input_buffer_password) > 0)
     {
-        if (!flipper_http_save_wifi(app->text_input_buffer_ssid, app->text_input_buffer_password))
+        if (!flipper_http_save_wifi(app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_password))
         {
             FURI_LOG_E(TAG, "Failed to save wifi settings");
         }
@@ -688,10 +688,10 @@ static void text_updated_dictionary(void *context)
     }
 
     // store the entered text
-    strncpy(app->text_input_buffer_dictionary, app->text_input_temp_buffer_dictionary, app->text_input_buffer_size_dictionary);
+    strncpy(app->uart_text_input_buffer_dictionary, app->uart_text_input_temp_buffer_dictionary, app->uart_text_input_buffer_size_dictionary);
 
     // Ensure null-termination
-    app->text_input_buffer_dictionary[app->text_input_buffer_size_dictionary - 1] = '\0';
+    app->uart_text_input_buffer_dictionary[app->uart_text_input_buffer_size_dictionary - 1] = '\0';
 
     // switch to the dictionary view
     view_dispatcher_switch_to_view(app->view_dispatcher, FlipLibraryViewDictionaryRun);

+ 21 - 21
flip_library_e.h

@@ -52,33 +52,33 @@ typedef enum
 // Each screen will have its own view
 typedef struct
 {
-    ViewDispatcher *view_dispatcher;           // Switches between our views
-    View *view_random_facts;                   // The main screen that displays the random fact
-    View *view_dictionary;                     // The dictionary screen
-    Submenu *submenu_main;                     // The submenu for the main screen
-    Submenu *submenu_random_facts;             // The submenu for the random facts screen
-    Widget *widget;                            // The widget
-    VariableItemList *variable_item_list_wifi; // The variable item list (WiFi settings)
-    VariableItem *variable_item_ssid;          // The variable item (SSID)
-    VariableItem *variable_item_password;      // The variable item (password)
-    TextInput *text_input_ssid;                // The text input for the SSID
-    TextInput *text_input_password;            // The text input for the password
-    TextInput *text_input_dictionary;          // The text input for the dictionary
+    ViewDispatcher *view_dispatcher;            // Switches between our views
+    View *view_random_facts;                    // The main screen that displays the random fact
+    View *view_dictionary;                      // The dictionary screen
+    Submenu *submenu_main;                      // The submenu for the main screen
+    Submenu *submenu_random_facts;              // The submenu for the random facts screen
+    Widget *widget;                             // The widget
+    VariableItemList *variable_item_list_wifi;  // The variable item list (WiFi settings)
+    VariableItem *variable_item_ssid;           // The variable item (SSID)
+    VariableItem *variable_item_password;       // The variable item (password)
+    UART_TextInput *uart_text_input_ssid;       // The text input for the SSID
+    UART_TextInput *uart_text_input_password;   // The text input for the password
+    UART_TextInput *uart_text_input_dictionary; // The text input for the dictionary
     //
     Widget *widget_random_fact; // The text box that displays the random fact
     Widget *widget_dictionary;  // The text box that displays the dictionary
 
-    char *text_input_buffer_ssid;         // Buffer for the text input (SSID)
-    char *text_input_temp_buffer_ssid;    // Temporary buffer for the text input (SSID)
-    uint32_t text_input_buffer_size_ssid; // Size of the text input buffer (SSID)
+    char *uart_text_input_buffer_ssid;         // Buffer for the text input (SSID)
+    char *uart_text_input_temp_buffer_ssid;    // Temporary buffer for the text input (SSID)
+    uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer (SSID)
 
-    char *text_input_buffer_password;         // Buffer for the text input (password)
-    char *text_input_temp_buffer_password;    // Temporary buffer for the text input (password)
-    uint32_t text_input_buffer_size_password; // Size of the text input buffer (password)
+    char *uart_text_input_buffer_password;         // Buffer for the text input (password)
+    char *uart_text_input_temp_buffer_password;    // Temporary buffer for the text input (password)
+    uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer (password)
 
-    char *text_input_buffer_dictionary;         // Buffer for the text input (dictionary)
-    char *text_input_temp_buffer_dictionary;    // Temporary buffer for the text input (dictionary)
-    uint32_t text_input_buffer_size_dictionary; // Size of the text input buffer (dictionary)
+    char *uart_text_input_buffer_dictionary;         // Buffer for the text input (dictionary)
+    char *uart_text_input_temp_buffer_dictionary;    // Temporary buffer for the text input (dictionary)
+    uint32_t uart_text_input_buffer_size_dictionary; // Size of the text input buffer (dictionary)
 } FlipLibraryApp;
 
 #endif // FLIP_LIBRARY_E_H

+ 6 - 6
flip_library_free.h

@@ -64,20 +64,20 @@ static void flip_library_app_free(FlipLibraryApp *app)
     }
 
     // Free Text Input(s)
-    if (app->text_input_ssid)
+    if (app->uart_text_input_ssid)
     {
         view_dispatcher_remove_view(app->view_dispatcher, FlipLibraryViewTextInputSSID);
-        text_input_free(app->text_input_ssid);
+        uart_text_input_free(app->uart_text_input_ssid);
     }
-    if (app->text_input_password)
+    if (app->uart_text_input_password)
     {
         view_dispatcher_remove_view(app->view_dispatcher, FlipLibraryViewTextInputPassword);
-        text_input_free(app->text_input_password);
+        uart_text_input_free(app->uart_text_input_password);
     }
-    if (app->text_input_dictionary)
+    if (app->uart_text_input_dictionary)
     {
         view_dispatcher_remove_view(app->view_dispatcher, FlipLibraryViewDictionaryTextInput);
-        text_input_free(app->text_input_dictionary);
+        uart_text_input_free(app->uart_text_input_dictionary);
     }
 
     // deinitalize flipper http

+ 20 - 20
flip_library_i.h

@@ -15,30 +15,30 @@ static FlipLibraryApp *flip_library_app_alloc()
     }
 
     // Allocate the text input buffer
-    app->text_input_buffer_size_ssid = 64;
-    app->text_input_buffer_size_password = 64;
-    app->text_input_buffer_size_dictionary = 64;
-    if (!easy_flipper_set_buffer(&app->text_input_buffer_ssid, app->text_input_buffer_size_ssid))
+    app->uart_text_input_buffer_size_ssid = 64;
+    app->uart_text_input_buffer_size_password = 64;
+    app->uart_text_input_buffer_size_dictionary = 64;
+    if (!easy_flipper_set_buffer(&app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_size_ssid))
     {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->text_input_temp_buffer_ssid, app->text_input_buffer_size_ssid))
+    if (!easy_flipper_set_buffer(&app->uart_text_input_temp_buffer_ssid, app->uart_text_input_buffer_size_ssid))
     {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->text_input_buffer_password, app->text_input_buffer_size_password))
+    if (!easy_flipper_set_buffer(&app->uart_text_input_buffer_password, app->uart_text_input_buffer_size_password))
     {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->text_input_temp_buffer_password, app->text_input_buffer_size_password))
+    if (!easy_flipper_set_buffer(&app->uart_text_input_temp_buffer_password, app->uart_text_input_buffer_size_password))
     {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->text_input_buffer_dictionary, app->text_input_buffer_size_dictionary))
+    if (!easy_flipper_set_buffer(&app->uart_text_input_buffer_dictionary, app->uart_text_input_buffer_size_dictionary))
     {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->text_input_temp_buffer_dictionary, app->text_input_buffer_size_dictionary))
+    if (!easy_flipper_set_buffer(&app->uart_text_input_temp_buffer_dictionary, app->uart_text_input_buffer_size_dictionary))
     {
         return NULL;
     }
@@ -74,15 +74,15 @@ static FlipLibraryApp *flip_library_app_alloc()
     }
 
     // Text Input
-    if (!easy_flipper_set_text_input(&app->text_input_ssid, FlipLibraryViewTextInputSSID, "Enter SSID", app->text_input_temp_buffer_ssid, app->text_input_buffer_size_ssid, text_updated_ssid, callback_to_wifi_settings, &app->view_dispatcher, app))
+    if (!easy_flipper_set_uart_text_input(&app->uart_text_input_ssid, FlipLibraryViewTextInputSSID, "Enter SSID", app->uart_text_input_temp_buffer_ssid, app->uart_text_input_buffer_size_ssid, text_updated_ssid, callback_to_wifi_settings, &app->view_dispatcher, app))
     {
         return NULL;
     }
-    if (!easy_flipper_set_text_input(&app->text_input_password, FlipLibraryViewTextInputPassword, "Enter Password", app->text_input_temp_buffer_password, app->text_input_buffer_size_password, text_updated_password, callback_to_wifi_settings, &app->view_dispatcher, app))
+    if (!easy_flipper_set_uart_text_input(&app->uart_text_input_password, FlipLibraryViewTextInputPassword, "Enter Password", app->uart_text_input_temp_buffer_password, app->uart_text_input_buffer_size_password, text_updated_password, callback_to_wifi_settings, &app->view_dispatcher, app))
     {
         return NULL;
     }
-    if (!easy_flipper_set_text_input(&app->text_input_dictionary, FlipLibraryViewDictionaryTextInput, "Enter a word", app->text_input_temp_buffer_dictionary, app->text_input_buffer_size_dictionary, text_updated_dictionary, callback_to_submenu, &app->view_dispatcher, app))
+    if (!easy_flipper_set_uart_text_input(&app->uart_text_input_dictionary, FlipLibraryViewDictionaryTextInput, "Enter a word", app->uart_text_input_temp_buffer_dictionary, app->uart_text_input_buffer_size_dictionary, text_updated_dictionary, callback_to_submenu, &app->view_dispatcher, app))
     {
         return NULL;
     }
@@ -117,23 +117,23 @@ static FlipLibraryApp *flip_library_app_alloc()
     submenu_add_item(app->submenu_random_facts, "Random", FlipLibrarySubmenuIndexRandomFactsAll, callback_submenu_choices, app);
 
     // load settings
-    if (load_settings(app->text_input_buffer_ssid, app->text_input_buffer_size_ssid, app->text_input_buffer_password, app->text_input_buffer_size_password))
+    if (load_settings(app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_size_ssid, app->uart_text_input_buffer_password, app->uart_text_input_buffer_size_password))
     {
         // Update variable items
         if (app->variable_item_ssid)
-            variable_item_set_current_value_text(app->variable_item_ssid, app->text_input_buffer_ssid);
+            variable_item_set_current_value_text(app->variable_item_ssid, app->uart_text_input_buffer_ssid);
         // dont show password
 
         // Copy items into their temp buffers with safety checks
-        if (app->text_input_buffer_ssid && app->text_input_temp_buffer_ssid)
+        if (app->uart_text_input_buffer_ssid && app->uart_text_input_temp_buffer_ssid)
         {
-            strncpy(app->text_input_temp_buffer_ssid, app->text_input_buffer_ssid, app->text_input_buffer_size_ssid - 1);
-            app->text_input_temp_buffer_ssid[app->text_input_buffer_size_ssid - 1] = '\0';
+            strncpy(app->uart_text_input_temp_buffer_ssid, app->uart_text_input_buffer_ssid, app->uart_text_input_buffer_size_ssid - 1);
+            app->uart_text_input_temp_buffer_ssid[app->uart_text_input_buffer_size_ssid - 1] = '\0';
         }
-        if (app->text_input_buffer_password && app->text_input_temp_buffer_password)
+        if (app->uart_text_input_buffer_password && app->uart_text_input_temp_buffer_password)
         {
-            strncpy(app->text_input_temp_buffer_password, app->text_input_buffer_password, app->text_input_buffer_size_password - 1);
-            app->text_input_temp_buffer_password[app->text_input_buffer_size_password - 1] = '\0';
+            strncpy(app->uart_text_input_temp_buffer_password, app->uart_text_input_buffer_password, app->uart_text_input_buffer_size_password - 1);
+            app->uart_text_input_temp_buffer_password[app->uart_text_input_buffer_size_password - 1] = '\0';
         }
     }