Willy-JL 2 سال پیش
والد
کامیت
55d3163cac

+ 5 - 5
esubghz_chat/scenes/esubghz_chat_key_display.c

@@ -119,11 +119,11 @@ bool scene_on_event_key_display(void* context, SceneManagerEvent event) {
             consumed = true;
             break;
 
-        /* open key sharing popup */
-        // case ESubGhzChatEvent_KeyDisplayShare:
-        //     scene_manager_next_scene(state->scene_manager, ESubGhzChatScene_KeySharePopup);
-        //     consumed = true;
-        //     break;
+            /* open key sharing popup */
+            // case ESubGhzChatEvent_KeyDisplayShare:
+            //     scene_manager_next_scene(state->scene_manager, ESubGhzChatScene_KeySharePopup);
+            //     consumed = true;
+            //     break;
         }
         break;
 

+ 54 - 56
ifttt/ifttt_virtual_button.c

@@ -2,20 +2,20 @@
 
 #define IFTTT_FOLDER "/ext/ifttt"
 #define IFTTT_CONFIG_FOLDER "/ext/ifttt/config"
-const char *CONFIG_FILE_PATH = "/ext/ifttt/config/config.settings";
+const char* CONFIG_FILE_PATH = "/ext/ifttt/config/config.settings";
 
 #define FLIPPERZERO_SERIAL_BAUD 115200
 typedef enum ESerialCommand { ESerialCommand_Config } ESerialCommand;
 
 Settings save_settings(Settings settings) {
-    Storage *storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat *file = flipper_format_file_alloc(storage);
-    if (flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
+    if(flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
         flipper_format_update_string_cstr(file, CONF_SSID, settings.save_ssid);
         flipper_format_update_string_cstr(file, CONF_PASSWORD, settings.save_password);
         flipper_format_update_string_cstr(file, CONF_KEY, settings.save_key);
         flipper_format_update_string_cstr(file, CONF_EVENT, settings.save_event);
-    }else{
+    } else {
     }
     flipper_format_file_close(file);
     flipper_format_free(file);
@@ -23,7 +23,7 @@ Settings save_settings(Settings settings) {
     return settings;
 }
 
-void save_settings_file(FlipperFormat *file, Settings *settings) {
+void save_settings_file(FlipperFormat* file, Settings* settings) {
     flipper_format_write_header_cstr(file, CONFIG_FILE_HEADER, CONFIG_FILE_VERSION);
     flipper_format_write_comment_cstr(file, "Enter here the SSID of the wifi network");
     flipper_format_write_string_cstr(file, CONF_SSID, settings->save_ssid);
@@ -35,60 +35,60 @@ void save_settings_file(FlipperFormat *file, Settings *settings) {
     flipper_format_write_string_cstr(file, CONF_EVENT, settings->save_event);
 }
 
-Settings *load_settings() {
-    Settings *settings=malloc(sizeof(Settings));
+Settings* load_settings() {
+    Settings* settings = malloc(sizeof(Settings));
 
-    Storage *storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat *file = flipper_format_file_alloc(storage);
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
 
-    FuriString *string_value;
+    FuriString* string_value;
     string_value = furi_string_alloc();
-    FuriString *text_ssid_value;
+    FuriString* text_ssid_value;
     text_ssid_value = furi_string_alloc();
-    FuriString *text_password_value;
+    FuriString* text_password_value;
     text_password_value = furi_string_alloc();
-    FuriString *text_key_value;
+    FuriString* text_key_value;
     text_key_value = furi_string_alloc();
-    FuriString *text_event_value;
+    FuriString* text_event_value;
     text_event_value = furi_string_alloc();
 
-    if (storage_common_stat(storage, CONFIG_FILE_PATH, NULL) != FSE_OK) {
-        if (!flipper_format_file_open_new(file, CONFIG_FILE_PATH)) {
+    if(storage_common_stat(storage, CONFIG_FILE_PATH, NULL) != FSE_OK) {
+        if(!flipper_format_file_open_new(file, CONFIG_FILE_PATH)) {
             flipper_format_file_close(file);
         } else {
-            settings->save_ssid = malloc( 1);
-            settings->save_password = malloc( 1);
-            settings->save_key = malloc( 1);
-            settings->save_event = malloc( 1);
+            settings->save_ssid = malloc(1);
+            settings->save_password = malloc(1);
+            settings->save_key = malloc(1);
+            settings->save_event = malloc(1);
 
-            settings->save_ssid[0]='\0';
-            settings->save_password[0]='\0';
-            settings->save_key[0]='\0';
-            settings->save_event[0]='\0';
+            settings->save_ssid[0] = '\0';
+            settings->save_password[0] = '\0';
+            settings->save_key[0] = '\0';
+            settings->save_event[0] = '\0';
 
             save_settings_file(file, settings);
             flipper_format_file_close(file);
         }
     } else {
-        if (!flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
+        if(!flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
             flipper_format_file_close(file);
         } else {
             uint32_t value;
-            if (!flipper_format_read_header(file, string_value, &value)) {
+            if(!flipper_format_read_header(file, string_value, &value)) {
             } else {
-                if (flipper_format_read_string(file, CONF_SSID, text_ssid_value)) {
+                if(flipper_format_read_string(file, CONF_SSID, text_ssid_value)) {
                     settings->save_ssid = malloc(furi_string_size(text_ssid_value) + 1);
                     strcpy(settings->save_ssid, furi_string_get_cstr(text_ssid_value));
                 }
-                if (flipper_format_read_string(file, CONF_PASSWORD, text_password_value)) {
+                if(flipper_format_read_string(file, CONF_PASSWORD, text_password_value)) {
                     settings->save_password = malloc(furi_string_size(text_password_value) + 1);
                     strcpy(settings->save_password, furi_string_get_cstr(text_password_value));
                 }
-                if (flipper_format_read_string(file, CONF_KEY, text_key_value)) {
+                if(flipper_format_read_string(file, CONF_KEY, text_key_value)) {
                     settings->save_key = malloc(furi_string_size(text_key_value) + 1);
                     strcpy(settings->save_key, furi_string_get_cstr(text_key_value));
                 }
-                if (flipper_format_read_string(file, CONF_EVENT, text_event_value)) {
+                if(flipper_format_read_string(file, CONF_EVENT, text_event_value)) {
                     settings->save_event = malloc(furi_string_size(text_event_value) + 1);
                     strcpy(settings->save_event, furi_string_get_cstr(text_event_value));
                 }
@@ -106,43 +106,43 @@ Settings *load_settings() {
     return settings;
 }
 
-void send_serial_command_config(ESerialCommand command, Settings *settings) { 
-   uint8_t data[1] = {0};
+void send_serial_command_config(ESerialCommand command, Settings* settings) {
+    uint8_t data[1] = {0};
 
     char config_tmp[100];
-    strcpy(config_tmp,"config,");
+    strcpy(config_tmp, "config,");
     strcat(config_tmp, settings->save_key);
     char config_tmp2[5];
     strcpy(config_tmp2, config_tmp);
-    strcat(config_tmp2,",");
+    strcat(config_tmp2, ",");
     char config_tmp3[100];
     strcpy(config_tmp3, config_tmp2);
-    strcat(config_tmp3,settings->save_ssid);
+    strcat(config_tmp3, settings->save_ssid);
     char config_tmp4[5];
     strcpy(config_tmp4, config_tmp3);
-    strcat(config_tmp4,",");
+    strcat(config_tmp4, ",");
     char config_tmp5[100];
     strcpy(config_tmp5, config_tmp4);
-    strcat(config_tmp5,settings->save_password);
+    strcat(config_tmp5, settings->save_password);
     char config_tmp6[5];
     strcpy(config_tmp6, config_tmp5);
-    strcat(config_tmp6,",");
+    strcat(config_tmp6, ",");
     char config[350];
     strcpy(config, config_tmp6);
-    strcat(config,settings->save_event);
-
-   int length = strlen(config);
-   for (int i = 0; i < length; i++){
-    switch(command) {
-      case ESerialCommand_Config:
-        data[0] = config[i];
-        break;
+    strcat(config, settings->save_event);
+
+    int length = strlen(config);
+    for(int i = 0; i < length; i++) {
+        switch(command) {
+        case ESerialCommand_Config:
+            data[0] = config[i];
+            break;
         default:
-        return;
-    };
+            return;
+        };
 
-    furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
-   }
+        furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
+    }
 }
 
 static bool ifttt_virtual_button_custom_event_callback(void* context, uint32_t event) {
@@ -190,9 +190,7 @@ VirtualButtonApp* ifttt_virtual_button_app_alloc(uint32_t first_scene) {
 
     app->abou_view = about_view_alloc();
     view_dispatcher_add_view(
-        app->view_dispatcher,
-        VirtualButtonAppViewAboutView,
-        about_view_get_view(app->abou_view));
+        app->view_dispatcher, VirtualButtonAppViewAboutView, about_view_get_view(app->abou_view));
 
     app->submenu = submenu_alloc();
     view_dispatcher_add_view(
@@ -234,7 +232,7 @@ void ifttt_virtual_button_app_free(VirtualButtonApp* app) {
 
 int32_t ifttt_virtual_button_app(void* p) {
     UNUSED(p);
-    
+
     Storage* storage = furi_record_open(RECORD_STORAGE);
     if(!storage_simply_mkdir(storage, IFTTT_FOLDER)) {
     }
@@ -244,7 +242,7 @@ int32_t ifttt_virtual_button_app(void* p) {
 
     uint32_t first_scene = VirtualButtonAppSceneStart;
     VirtualButtonApp* app = ifttt_virtual_button_app_alloc(first_scene);
-    memcpy(&app->settings,load_settings(),sizeof(Settings));
+    memcpy(&app->settings, load_settings(), sizeof(Settings));
     send_serial_command_config(ESerialCommand_Config, &(app->settings));
 
     view_dispatcher_run(app->view_dispatcher);

+ 6 - 6
ifttt/ifttt_virtual_button.h

@@ -25,11 +25,11 @@
 #define CONFIG_FILE_HEADER "IFTTT Virtual Button Config File"
 #define CONFIG_FILE_VERSION 1
 
-typedef struct{
-    char *save_ssid;
-    char *save_password;
-    char *save_key;
-    char *save_event;
+typedef struct {
+    char* save_ssid;
+    char* save_password;
+    char* save_key;
+    char* save_event;
 } Settings;
 
 typedef struct {
@@ -53,4 +53,4 @@ typedef enum {
 } VirtualButtonAppView;
 
 Settings save_settings(Settings settings);
-Settings *load_settings();
+Settings* load_settings();

+ 0 - 1
ifttt/views/about_view.c

@@ -21,7 +21,6 @@ static void about_view_draw_callback(Canvas* canvas, void* context) {
     canvas_draw_str_aligned(canvas, 0, 50, AlignLeft, AlignTop, "press back");
 }
 
-
 AboutView* about_view_alloc() {
     AboutView* about_view = malloc(sizeof(AboutView));
     about_view->view = view_alloc();

+ 11 - 11
ifttt/views/send_view.c

@@ -29,19 +29,19 @@ static void Shake(void) {
 void send_serial_command_send(ESerialCommand command) {
     uint8_t data[1] = {0};
 
-   char name[10] = "send";
-   int length = strlen(name);
-   for (int i = 0; i < length; i++){
-    switch(command) {
-      case ESerialCommand_Send:
-        data[0] = name[i];
-        break;
+    char name[10] = "send";
+    int length = strlen(name);
+    for(int i = 0; i < length; i++) {
+        switch(command) {
+        case ESerialCommand_Send:
+            data[0] = name[i];
+            break;
         default:
-        return;
-    };
+            return;
+        };
 
-    furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
-   }
+        furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
+    }
 }
 
 static void send_view_draw_callback(Canvas* canvas, void* context) {

+ 3 - 3
music_beeper/music_beeper.c

@@ -311,10 +311,10 @@ int32_t music_beeper_app(void* p) {
             furi_string_set(file_path, (const char*)p);
         } else {
             Storage* storage = furi_record_open(RECORD_STORAGE);
-            storage_common_migrate(
-                storage, EXT_PATH("music_player"), MUSIC_BEEPER_APP_PATH);
+            storage_common_migrate(storage, EXT_PATH("music_player"), MUSIC_BEEPER_APP_PATH);
 
-            if(!storage_common_exists(storage, MUSIC_BEEPER_APP_PATH "/" MUSIC_BEEPER_EXAMPLE_FILE)) {
+            if(!storage_common_exists(
+                   storage, MUSIC_BEEPER_APP_PATH "/" MUSIC_BEEPER_EXAMPLE_FILE)) {
                 storage_common_copy(
                     storage,
                     APP_ASSETS_PATH(MUSIC_BEEPER_EXAMPLE_FILE),