Explorar o código

FlipWiFi - v1.3.2

- Fixed a crash that occurred when deleting a network from the Saved APs list.
- Updated to connect to the network after clicking "Set" on the selected SSID in the Saved APs list.
jblanked hai 1 ano
pai
achega
669146bf79

+ 4 - 0
CHANGELOG.md

@@ -1,3 +1,7 @@
+## v1.3.2
+- Fixed a crash that occurred when deleting a network from the Saved APs list.
+- Updated to connect to the network after clicking "Set" on the selected SSID in the Saved APs list.
+
 ## v1.3.1
 - Fixed a loading error that occurred when scanning networks.
 - Fixed a freeze that occurred when saving networks manually.

+ 3 - 3
README.md

@@ -12,9 +12,9 @@ FlipWiFi is the companion app for the popular FlipperHTTP flash, originally intr
 
 ## Setup
 
-FlipWiFi automatically allocates the necessary resources and initializes settings upon launch. If WiFi settings have been previously configured, they are loaded automatically for easy access. You can also edit the list of WiFi settings by downloading and modifying the "wifi_list.txt" file located in the "/SD/apps_data/flip_wifi/" directory. To use the app:
+FlipWiFi automatically allocates the necessary resources and initializes settings upon launch. If WiFi settings have been previously configured, they are loaded automatically for easy access. You can also edit the list of WiFi settings by downloading and modifying the "wifi_list.txt" file located in the "/SD/apps_data/flip_wifi/data" directory. To use the app:
 
-1. **Flash the WiFi Dev Board**: Follow the instructions to flash the WiFi Dev Board with FlipperHTTP: https://github.com/jblanked/FlipperHTTP
-2. **Install the App**: Download FlipWiFi from the App Store.
+1. **Flash the WiFi Developer Board**: Follow the instructions to flash the WiFi Dev Board with FlipperHTTP: https://github.com/jblanked/FlipperHTTP
+2. **Install the App**: Download FlipWiFi from the Flipper Lab.
 3. **Launch FlipWiFi**: Open the app on your Flipper Zero.
 4. Connect, review, and save WiFi networks.

+ 1 - 1
alloc/flip_wifi_alloc.c

@@ -14,7 +14,7 @@ FlipWiFiApp *flip_wifi_app_alloc()
     }
 
     // Submenu
-    if (!easy_flipper_set_submenu(&app->submenu_main, FlipWiFiViewSubmenuMain, "FlipWiFi v1.3.1", callback_exit_app, &app->view_dispatcher))
+    if (!easy_flipper_set_submenu(&app->submenu_main, FlipWiFiViewSubmenuMain, "FlipWiFi v1.3.2", callback_exit_app, &app->view_dispatcher))
     {
         return NULL;
     }

+ 1 - 1
application.fam

@@ -9,6 +9,6 @@ App(
     fap_icon_assets="assets",
     fap_author="JBlanked",
     fap_weburl="https://github.com/jblanked/FlipWiFi",
-    fap_version="1.3.1",
+    fap_version="1.3.2",
     fap_description="FlipperHTTP companion app.",
 )

BIN=BIN
assets/01-home.png


+ 27 - 7
callback/flip_wifi_callback.c

@@ -133,7 +133,7 @@ static bool flip_wifi_alloc_widgets(void *context, uint32_t widget)
     case FlipWiFiViewAbout:
         if (!app->widget_info)
         {
-            if (!easy_flipper_set_widget(&app->widget_info, FlipWiFiViewAbout, "FlipWiFi v1.3\n-----\nFlipperHTTP companion app.\nScan and save WiFi networks.\n-----\nwww.github.com/jblanked", callback_to_submenu_main, &app->view_dispatcher))
+            if (!easy_flipper_set_widget(&app->widget_info, FlipWiFiViewAbout, "FlipWiFi v1.3.2\n-----\nFlipperHTTP companion app.\nScan and save WiFi networks.\n-----\nwww.github.com/jblanked", callback_to_submenu_main, &app->view_dispatcher))
             {
                 return false;
             }
@@ -563,19 +563,35 @@ static bool flip_wifi_view_input_callback_saved(InputEvent *event, void *context
         // save the settings
         save_settings(wifi_playlist->ssids[ssid_index], wifi_playlist->passwords[ssid_index]);
 
-        flipper_http_save_wifi(wifi_playlist->ssids[ssid_index], wifi_playlist->passwords[ssid_index]);
+        // initialize uart
+        if (!flipper_http_init(flipper_http_rx_callback, app))
+        {
+            easy_flipper_dialog("[ERROR]", "Failed to initialize flipper http");
+            return false;
+        }
 
-        flipper_http_connect_wifi();
+        // clear response
+        if (fhttp.last_response)
+            snprintf(fhttp.last_response, RX_BUF_SIZE, "%s", "");
+
+        if (!flipper_http_save_wifi(wifi_playlist->ssids[ssid_index], wifi_playlist->passwords[ssid_index]))
+        {
+            easy_flipper_dialog("[ERROR]", "Failed to save WiFi settings");
+            return false;
+        }
+
+        while (!fhttp.last_response || strlen(fhttp.last_response) == 0)
+        {
+            furi_delay_ms(100);
+        }
+
+        flipper_http_deinit();
 
         easy_flipper_dialog("[SUCCESS]", "All FlipperHTTP apps will now\nuse the selected network.");
         return true;
     }
     else if (event->type == InputTypePress && event->key == InputKeyLeft)
     {
-        // delete the selected ssid and password
-        free(wifi_playlist->ssids[ssid_index]);
-        free(wifi_playlist->passwords[ssid_index]);
-        free(ssid_list[ssid_index]);
         // shift the remaining ssids and passwords
         for (uint32_t i = ssid_index; i < wifi_playlist->count - 1; i++)
         {
@@ -591,6 +607,10 @@ static bool flip_wifi_view_input_callback_saved(InputEvent *event, void *context
         }
         wifi_playlist->count--;
 
+        // delete the last ssid and password
+        wifi_playlist->ssids[wifi_playlist->count][0] = '\0';
+        wifi_playlist->passwords[wifi_playlist->count][0] = '\0';
+
         // save the playlist to storage
         save_playlist(wifi_playlist);
 

+ 1 - 1
flip_storage/flip_wifi_storage.c

@@ -401,7 +401,7 @@ bool load_char(
     {
         storage_file_free(file);
         furi_record_close(RECORD_STORAGE);
-        return NULL; // Return false if the file does not exist
+        return false; // Return false if the file does not exist
     }
 
     // Read data into the buffer

+ 8 - 0
flipper_http/flipper_http.c

@@ -645,6 +645,8 @@ bool flipper_http_scan_wifi()
     // custom for FlipWiFi app
     fhttp.just_started_get = true;
 
+    // ensure the data folder exists
+
     snprintf(
         fhttp.file_path,
         sizeof(fhttp.file_path),
@@ -679,6 +681,10 @@ bool flipper_http_save_wifi(const char *ssid, const char *password)
         FURI_LOG_E("FlipperHTTP", "Invalid arguments provided to flipper_http_save_wifi.");
         return false;
     }
+
+    // custom for FlipWiFi app
+    fhttp.just_started_get = true;
+
     char buffer[256];
     int ret = snprintf(
         buffer, sizeof(buffer), "[WIFI/SAVE]{\"ssid\":\"%s\",\"password\":\"%s\"}", ssid, password);
@@ -694,6 +700,8 @@ bool flipper_http_save_wifi(const char *ssid, const char *password)
         return false;
     }
 
+    fhttp.state = RECEIVING;
+
     // The response will be handled asynchronously via the callback
     return true;
 }