Просмотр исходного кода

Removed not needed settings Sound/Haptic

David Lee 1 год назад
Родитель
Сommit
28bbaaaeab
3 измененных файлов с 19 добавлено и 34 удалено
  1. 0 7
      helpers/subghz/subghz.c
  2. 14 14
      scenes/xremote_scene_settings.c
  3. 5 13
      scenes/xremote_scene_transmit.c

+ 0 - 7
helpers/subghz/subghz.c

@@ -3,23 +3,18 @@
 #include "subghz_i.h"
 #include "../../helpers/xremote_custom_event.h"
 #include "../../helpers/xremote_led.h"
-//#include "../meal_pager_storage.h"
 
 SubGhz* subghz_alloc() {
     SubGhz* subghz = malloc(sizeof(SubGhz));
 
     subghz->file_path = furi_string_alloc();
-
     subghz->txrx = subghz_txrx_alloc();
 
     return subghz;
 }
 
 void subghz_free(SubGhz* subghz) {
-    //TxRx
     subghz_txrx_free(subghz->txrx);
-
-    // Furi strings
     furi_string_free(subghz->file_path);
 
     // The rest
@@ -55,7 +50,5 @@ void subghz_send(void* context, const char* path) {
         app->subghz->txrx, subghz_scene_transmit_callback_end_tx, app);
     app->state_notifications = SubGhzNotificationStateTx;
 
-
-
     FURI_LOG_D(TAG, "Finished Transmitting");
 }

+ 14 - 14
scenes/xremote_scene_settings.c

@@ -1,29 +1,29 @@
 #include "../xremote.h"
 #include <lib/toolbox/value_index.h>
-
+/*
 enum SettingsIndex {
     SettingsIndexHaptic = 10,
     SettingsIndexValue1,
     SettingsIndexValue2,
-};
+};*/
 
-const char* const haptic_text[2] = {
+/*const char* const haptic_text[2] = {
     "OFF",
     "ON",
 };
 const uint32_t haptic_value[2] = {
     XRemoteHapticOff,
     XRemoteHapticOn,
-};
+};*/
 
-const char* const speaker_text[2] = {
+/*const char* const speaker_text[2] = {
     "OFF",
     "ON",
 };
 const uint32_t speaker_value[2] = {
     XRemoteSpeakerOff,
     XRemoteSpeakerOn,
-};
+};*/
 
 const char* const led_text[2] = {
     "OFF",
@@ -43,20 +43,20 @@ const uint32_t settings_value[2] = {
     XRemoteSettingsOn,
 };
 
-static void xremote_scene_settings_set_haptic(VariableItem* item) {
+/*static void xremote_scene_settings_set_haptic(VariableItem* item) {
     XRemote* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
 
     variable_item_set_current_value_text(item, haptic_text[index]);
     app->haptic = haptic_value[index];
-}
+}*/
 
-static void xremote_scene_settings_set_speaker(VariableItem* item) {
+/*static void xremote_scene_settings_set_speaker(VariableItem* item) {
     XRemote* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
     variable_item_set_current_value_text(item, speaker_text[index]);
     app->speaker = speaker_value[index];
-}
+}*/
 
 static void xremote_scene_settings_set_led(VariableItem* item) {
     XRemote* app = variable_item_get_context(item);
@@ -92,18 +92,18 @@ 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]);
+    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);
-    variable_item_set_current_value_text(item, speaker_text[value_index]);
+    variable_item_set_current_value_text(item, speaker_text[value_index]);*/
 
     // LED Effects on/off
     item = variable_item_list_add(

+ 5 - 13
scenes/xremote_scene_transmit.c

@@ -82,11 +82,8 @@ 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);
-    // ADD SEND METHOD HERE
-    subghz_send(app, furi_string_get_cstr(item->filename)); //currently crashes, null pointer
-    //furi_thread_flags_wait(0, FuriFlagWaitAny, 2000); //Remove later
-    //app->transmitting = false;
-    //xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
+    subghz_send(app, furi_string_get_cstr(item->filename)); 
+    //furi_thread_flags_wait(0, FuriFlagWaitAny, 2000);
 }
 
 void xremote_scene_transmit_send_signal(void* context, CrossRemoteItem* item) {
@@ -109,8 +106,6 @@ void xremote_scene_transmit_send_signal(void* context, CrossRemoteItem* item) {
     } else if(item->type == XRemoteRemoteItemTypeSubGhz) {
         xremote_scene_transmit_send_subghz(app, item);
     }
-
-    //xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingStop);
 }
 
 void xremote_scene_transmit_run_remote(void* context) {
@@ -124,14 +119,12 @@ void xremote_scene_transmit_run_remote(void* context) {
             xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingStart);
             CrossRemoteItem* item = xremote_cross_remote_get_item(remote, i);
             xremote_scene_transmit_send_signal(app, item);
-            //furi_thread_flags_wait(0, FuriFlagWaitAny, 2000);
             //furi_thread_flags_wait(0, FuriFlagWaitAny, 1000);
-            //xremote_scene_ir_notification_message(app, InfraredNotificationMessageBlinkStartSend);
         } else if(xremote_cross_remote_get_transmitting(remote) == XRemoteTransmittingStopSubghz) {
             i++;
             app->state_notifications = SubGhzNotificationStateIDLE;
-            subghz_txrx_stop(app->subghz->txrx);
             app->transmitting = false;
+            subghz_txrx_stop(app->subghz->txrx);
             xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
             xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
             //furi_thread_flags_wait(0, FuriFlagWaitAny, 1000);
@@ -142,7 +135,6 @@ void xremote_scene_transmit_run_remote(void* context) {
     }
     xremote_scene_ir_notification_message(app, InfraredNotificationMessageBlinkStop);
 
-    //scene_manager_next_scene(app->scene_manager, XRemoteSceneXrList);
     scene_manager_previous_scene(app->scene_manager);
     //xremote_transmit_model_set_name(app->xremote_transmit, xremote_cross_remote_get_name(remote));
 }
@@ -167,8 +159,8 @@ bool xremote_scene_transmit_on_event(void* context, SceneManagerEvent event) {
                 FURI_LOG_D("SUBGHZ", "stop event");
                 //app->stop_transmit = true;
                 app->state_notifications = SubGhzNotificationStateIDLE;
-                subghz_txrx_stop(app->subghz->txrx);
                 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;
@@ -189,7 +181,7 @@ bool xremote_scene_transmit_on_event(void* context, SceneManagerEvent event) {
 void xremote_scene_transmit_on_exit(void* context) {
     XRemote* app = context;
     app->transmitting = false;
-    subghz_txrx_stop(app->subghz->txrx);
     app->state_notifications = SubGhzNotificationStateIDLE;
+    subghz_txrx_stop(app->subghz->txrx);
     //xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
 }