David Lee 1 rok temu
rodzic
commit
32041e2a1a

+ 0 - 1
helpers/subghz/subghz.c

@@ -28,7 +28,6 @@ void subghz_scene_transmit_callback_end_tx(void* context) {
     view_dispatcher_send_custom_event(
         app->view_dispatcher, XRemoteCustomEventViewTransmitterSendStop);
 
-
     //app->state_notifications = SubGhzNotificationStateIDLE;
     //subghz_txrx_stop(app->subghz->txrx);
     //app->transmitting = false;

+ 7 - 3
models/cross/xremote_cross_remote.c

@@ -89,7 +89,11 @@ const char* xremote_cross_remote_get_name(CrossRemote* remote) {
     return furi_string_get_cstr(remote->name);
 }
 
-bool xremote_cross_remote_add_ir_item(CrossRemote* remote, const char* name, InfraredSignal* signal, uint32_t timing) {
+bool xremote_cross_remote_add_ir_item(
+    CrossRemote* remote,
+    const char* name,
+    InfraredSignal* signal,
+    uint32_t timing) {
     CrossRemoteItem* item = xremote_cross_remote_item_alloc();
     xremote_cross_remote_item_set_type(item, XRemoteRemoteItemTypeInfrared);
     xremote_cross_remote_item_set_name(item, name);
@@ -213,7 +217,8 @@ static bool xremote_cross_remote_store(CrossRemote* remote) {
                     xremote_cross_remote_item_get_name(item),
                     xremote_cross_remote_item_get_time(item));
             } else if(item->type == XRemoteRemoteItemTypePause) {
-                success = xremote_cross_remote_item_pause_save(ff, item->time, xremote_cross_remote_item_get_name(item));
+                success = xremote_cross_remote_item_pause_save(
+                    ff, item->time, xremote_cross_remote_item_get_name(item));
             } else if(item->type == XRemoteRemoteItemTypeSubGhz) {
                 success = xremote_cross_remote_item_sg_signal_save(
                     xremote_cross_remote_item_get_sg_signal(item),
@@ -264,4 +269,3 @@ bool xremote_cross_remote_delete(CrossRemote* remote) {
     xremote_cross_remote_reset(remote);
     return (status == FSE_OK || status == FSE_NOT_EXIST);
 }
-

+ 5 - 1
models/cross/xremote_cross_remote.h

@@ -13,7 +13,11 @@ const char* xremote_cross_remote_get_name(CrossRemote* remote);
 void xremote_cross_remote_set_transmitting(CrossRemote* remote, int status);
 int xremote_cross_remote_get_transmitting(CrossRemote* remote);
 bool xremote_cross_remote_add_pause(CrossRemote* remote, int time);
-bool xremote_cross_remote_add_ir_item(CrossRemote* remote, const char* name, InfraredSignal* signal, uint32_t timing);
+bool xremote_cross_remote_add_ir_item(
+    CrossRemote* remote,
+    const char* name,
+    InfraredSignal* signal,
+    uint32_t timing);
 bool xremote_cross_remote_add_subghz(CrossRemote* remote, SubGhzRemote* subghz);
 void xremote_cross_remote_remove_item(CrossRemote* remote, size_t index);
 void xremote_cross_remote_rename_item(CrossRemote* remote, size_t index, const char* name);

+ 13 - 4
models/cross/xremote_cross_remote_item.c

@@ -86,7 +86,8 @@ static bool xremote_cross_remote_item_read_sg(CrossRemoteItem* item, FlipperForm
     return success;
 }
 
-static bool xremote_cross_remote_item_read_ir_signal_raw(CrossRemoteItem* item, FlipperFormat* ff) {
+static bool
+    xremote_cross_remote_item_read_ir_signal_raw(CrossRemoteItem* item, FlipperFormat* ff) {
     uint32_t timings_size, frequency;
     float duty_cycle;
 
@@ -243,10 +244,14 @@ uint32_t xremote_cross_remote_item_get_time(CrossRemoteItem* item) {
     return item->time;
 }
 
-bool xremote_cross_remote_item_ir_signal_save(InfraredSignal* signal, FlipperFormat* ff, const char* name, uint32_t time) {
+bool xremote_cross_remote_item_ir_signal_save(
+    InfraredSignal* signal,
+    FlipperFormat* ff,
+    const char* name,
+    uint32_t time) {
     if(!flipper_format_write_comment_cstr(ff, "") ||
        !flipper_format_write_string_cstr(ff, "remote_type", "IR") ||
-       !flipper_format_write_string_cstr(ff, "name", name) || 
+       !flipper_format_write_string_cstr(ff, "name", name) ||
        !flipper_format_write_uint32(ff, "time", &time, 1)) {
         return false;
     } else if(signal->is_raw) {
@@ -266,7 +271,11 @@ bool xremote_cross_remote_item_pause_save(FlipperFormat* ff, uint32_t time, cons
     return true;
 }
 
-bool xremote_cross_remote_item_sg_signal_save(SubGhzRemote* remote, FlipperFormat* ff, const char* name, const char* filename) {
+bool xremote_cross_remote_item_sg_signal_save(
+    SubGhzRemote* remote,
+    FlipperFormat* ff,
+    const char* name,
+    const char* filename) {
     if(!flipper_format_write_comment_cstr(ff, "") ||
        !flipper_format_write_string_cstr(ff, "remote_type", "SG") ||
        !flipper_format_write_string_cstr(ff, "name", name) ||

+ 10 - 2
models/cross/xremote_cross_remote_item.h

@@ -24,5 +24,13 @@ SubGhzRemote* xremote_cross_remote_item_get_sg_signal(CrossRemoteItem* item);
 void xremote_cross_remote_item_set_sg_signal(CrossRemoteItem* item, SubGhzRemote* subghz);
 
 bool xremote_cross_remote_item_pause_save(FlipperFormat* ff, uint32_t time, const char* name);
-bool xremote_cross_remote_item_ir_signal_save(InfraredSignal* signal, FlipperFormat* ff, const char* name, uint32_t time);
-bool xremote_cross_remote_item_sg_signal_save(SubGhzRemote* remote, FlipperFormat* ff, const char* name, const char* filename);
+bool xremote_cross_remote_item_ir_signal_save(
+    InfraredSignal* signal,
+    FlipperFormat* ff,
+    const char* name,
+    uint32_t time);
+bool xremote_cross_remote_item_sg_signal_save(
+    SubGhzRemote* remote,
+    FlipperFormat* ff,
+    const char* name,
+    const char* filename);

+ 2 - 1
scenes/xremote_scene_ir_remote.c

@@ -65,7 +65,8 @@ bool xremote_scene_ir_remote_on_event(void* context, SceneManagerEvent event) {
             const char* button_name = xremote_ir_remote_button_get_name(ir_button);
             InfraredSignal* signal = xremote_ir_remote_button_get_signal(ir_button);
 
-            xremote_cross_remote_add_ir_item(app->cross_remote, button_name, signal, app->ir_timing);
+            xremote_cross_remote_add_ir_item(
+                app->cross_remote, button_name, signal, app->ir_timing);
             scene_manager_next_scene(app->scene_manager, XRemoteSceneCreate);
             consumed = true;
         }

+ 3 - 1
scenes/xremote_scene_save_remote.c

@@ -20,7 +20,9 @@ void xremote_scene_save_remote_on_enter(void* context) {
     //A lot missing here
 
     ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
-        furi_string_get_cstr(folder_path), XREMOTE_APP_EXTENSION, xremote_cross_remote_get_name(remote));
+        furi_string_get_cstr(folder_path),
+        XREMOTE_APP_EXTENSION,
+        xremote_cross_remote_get_name(remote));
     text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
 
     furi_string_free(folder_path);

+ 2 - 2
scenes/xremote_scene_settings.c

@@ -92,14 +92,14 @@ void xremote_scene_settings_on_enter(void* context) {
     uint8_t value_index;
 
     // Vibro on/off
-/*    item = variable_item_list_add(
+    /*    item = variable_item_list_add(
         app->variable_item_list, "Vibro/Haptic:", 2, xremote_scene_settings_set_haptic, app);
     value_index = value_index_uint32(app->haptic, haptic_value, 2);
     variable_item_set_current_value_index(item, value_index);
     variable_item_set_current_value_text(item, haptic_text[value_index]);*/
 
     // Sound on/off
- /*   item = variable_item_list_add(
+    /*   item = variable_item_list_add(
         app->variable_item_list, "Sound:", 2, xremote_scene_settings_set_speaker, app);
     value_index = value_index_uint32(app->speaker, speaker_value, 2);
     variable_item_set_current_value_index(item, value_index);

+ 11 - 19
scenes/xremote_scene_transmit.c

@@ -64,7 +64,7 @@ void xremote_scene_transmit_send_ir_signal(XRemote* app, CrossRemoteItem* item)
     infrared_worker_tx_start(app->ir_worker);
     app->transmitting = true;
     uint32_t time = app->ir_timing;
-    if (item->time > 0) {
+    if(item->time > 0) {
         time = item->time;
     }
     furi_thread_flags_wait(0, FuriFlagWaitAny, time);
@@ -82,12 +82,12 @@ void xremote_scene_transmit_send_pause(XRemote* app, CrossRemoteItem* item) {
 void xremote_scene_transmit_send_subghz(XRemote* app, CrossRemoteItem* item) {
     app->transmitting = true;
     xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStartSend);
-    if (furi_string_utf8_length(item->filename) < 3) {
+    if(furi_string_utf8_length(item->filename) < 3) {
         xremote_cross_remote_set_transmitting(app->cross_remote, XRemoteTransmittingStop);
         app->transmitting = false;
         return;
     }
-    subghz_send(app, furi_string_get_cstr(item->filename)); 
+    subghz_send(app, furi_string_get_cstr(item->filename));
     //furi_thread_flags_wait(0, FuriFlagWaitAny, 2000);
 }
 
@@ -100,7 +100,8 @@ void xremote_scene_transmit_send_signal(void* context, CrossRemoteItem* item) {
         return;
     }
 
-    xremote_transmit_model_set_name(app->xremote_transmit, xremote_cross_remote_item_get_name(item));
+    xremote_transmit_model_set_name(
+        app->xremote_transmit, xremote_cross_remote_item_get_name(item));
     xremote_transmit_model_set_type(app->xremote_transmit, item->type);
     if(item->type == XRemoteRemoteItemTypeInfrared) {
         xremote_scene_transmit_send_ir_signal(app, item);
@@ -160,26 +161,19 @@ bool xremote_scene_transmit_on_event(void* context, SceneManagerEvent event) {
     if(event.type == SceneManagerEventTypeCustom) {
         FURI_LOG_D(TAG, "Custom Event");
         switch(event.event) {
-            case XRemoteCustomEventViewTransmitterSendStop:
-                FURI_LOG_D("SUBGHZ", "stop event"); // doesn't trigger
-                //app->stop_transmit = true;
-                /*app->state_notifications = SubGhzNotificationStateIDLE;
-                app->transmitting = false;
-                subghz_txrx_stop(app->subghz->txrx);
-                xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
-                xremote_cross_remote_set_transmitting(app->cross_remote, XRemoteTransmittingStop);*/
-                break;
-            default: 
-                break;
+        case XRemoteCustomEventViewTransmitterSendStop:
+            FURI_LOG_D("SUBGHZ", "stop event"); // doesn't trigger
+            break;
+        default:
+            break;
         }
     } else if(event.type == SceneManagerEventTypeTick) {
         FURI_LOG_D(TAG, "Tick Event");
-        if (app->state_notifications == SubGhzNotificationStateTx && app->led == 1) {
+        if(app->state_notifications == SubGhzNotificationStateTx && app->led == 1) {
             //blink for subghz
         }
     }
 
-    
     return consumed;
 }
 
@@ -187,6 +181,4 @@ void xremote_scene_transmit_on_exit(void* context) {
     XRemote* app = context;
     app->transmitting = false;
     app->state_notifications = SubGhzNotificationStateIDLE;
-    //subghz_txrx_stop(app->subghz->txrx);
-    //xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
 }