@@ -80,15 +80,13 @@ void xremote_scene_transmit_send_pause(XRemote* app, CrossRemoteItem* item) {
8080}
8181
8282void xremote_scene_transmit_send_subghz (XRemote * app , CrossRemoteItem * item ) {
83- UNUSED (item );
8483 app -> transmitting = true;
8584 xremote_scene_ir_notification_message (app , SubGhzNotificationMessageBlinkStartSend );
8685 // ADD SEND METHOD HERE
87- //FURI_LOG_D("SUBGZK", "path: %s", furi_string_get_cstr(item->filename));
8886 subghz_send (app , furi_string_get_cstr (item -> filename )); //currently crashes, null pointer
89- furi_thread_flags_wait (0 , FuriFlagWaitAny , 2000 ); //Remove later
90- app -> transmitting = false;
91- xremote_scene_ir_notification_message (app , SubGhzNotificationMessageBlinkStop );
87+ // furi_thread_flags_wait(0, FuriFlagWaitAny, 2000); //Remove later
88+ // app->transmitting = false;
89+ // xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
9290}
9391
9492void xremote_scene_transmit_send_signal (void * context , CrossRemoteItem * item ) {
@@ -104,13 +102,15 @@ void xremote_scene_transmit_send_signal(void* context, CrossRemoteItem* item) {
104102 xremote_transmit_model_set_type (app -> xremote_transmit , item -> type );
105103 if (item -> type == XRemoteRemoteItemTypeInfrared ) {
106104 xremote_scene_transmit_send_ir_signal (app , item );
105+ xremote_cross_remote_set_transmitting (remote , XRemoteTransmittingStop );
107106 } else if (item -> type == XRemoteRemoteItemTypePause ) {
108107 xremote_scene_transmit_send_pause (app , item );
108+ xremote_cross_remote_set_transmitting (remote , XRemoteTransmittingStop );
109109 } else if (item -> type == XRemoteRemoteItemTypeSubGhz ) {
110110 xremote_scene_transmit_send_subghz (app , item );
111111 }
112112
113- xremote_cross_remote_set_transmitting (remote , XRemoteTransmittingStop );
113+ // xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingStop);
114114}
115115
116116void xremote_scene_transmit_run_remote (void * context ) {
@@ -125,7 +125,16 @@ void xremote_scene_transmit_run_remote(void* context) {
125125 CrossRemoteItem * item = xremote_cross_remote_get_item (remote , i );
126126 xremote_scene_transmit_send_signal (app , item );
127127 //furi_thread_flags_wait(0, FuriFlagWaitAny, 2000);
128- xremote_scene_ir_notification_message (app , InfraredNotificationMessageBlinkStartSend );
128+ //furi_thread_flags_wait(0, FuriFlagWaitAny, 1000);
129+ //xremote_scene_ir_notification_message(app, InfraredNotificationMessageBlinkStartSend);
130+ } else if (xremote_cross_remote_get_transmitting (remote ) == XRemoteTransmittingStopSubghz ) {
131+ i ++ ;
132+ app -> state_notifications = SubGhzNotificationStateIDLE ;
133+ subghz_txrx_stop (app -> subghz -> txrx );
134+ app -> transmitting = false;
135+ xremote_scene_ir_notification_message (app , SubGhzNotificationMessageBlinkStop );
136+ xremote_cross_remote_set_transmitting (remote , XRemoteTransmittingIdle );
137+ //furi_thread_flags_wait(0, FuriFlagWaitAny, 1000);
129138 } else if (xremote_cross_remote_get_transmitting (remote ) == XRemoteTransmittingStop ) {
130139 i ++ ;
131140 xremote_cross_remote_set_transmitting (remote , XRemoteTransmittingIdle );
@@ -149,14 +158,38 @@ void xremote_scene_transmit_on_enter(void* context) {
149158
150159bool xremote_scene_transmit_on_event (void * context , SceneManagerEvent event ) {
151160 XRemote * app = context ;
152-
153- UNUSED (app );
154- UNUSED (event );
155161 bool consumed = false;
162+
163+ if (event .type == SceneManagerEventTypeCustom ) {
164+ FURI_LOG_D (TAG , "Custom Event" );
165+ switch (event .event ) {
166+ case XRemoteCustomEventViewTransmitterSendStop :
167+ FURI_LOG_D ("SUBGHZ" , "stop event" );
168+ //app->stop_transmit = true;
169+ app -> state_notifications = SubGhzNotificationStateIDLE ;
170+ subghz_txrx_stop (app -> subghz -> txrx );
171+ app -> transmitting = false;
172+ xremote_scene_ir_notification_message (app , SubGhzNotificationMessageBlinkStop );
173+ xremote_cross_remote_set_transmitting (app -> cross_remote , XRemoteTransmittingStop );
174+ break ;
175+ default :
176+ break ;
177+ }
178+ } else if (event .type == SceneManagerEventTypeTick ) {
179+ FURI_LOG_D (TAG , "Tick Event" );
180+ if (app -> state_notifications == SubGhzNotificationStateTx && app -> led == 1 ) {
181+ //blink for subghz
182+ }
183+ }
184+
185+
156186 return consumed ;
157187}
158188
159189void xremote_scene_transmit_on_exit (void * context ) {
160190 XRemote * app = context ;
161- UNUSED (app );
191+ app -> transmitting = false;
192+ subghz_txrx_stop (app -> subghz -> txrx );
193+ app -> state_notifications = SubGhzNotificationStateIDLE ;
194+ //xremote_cross_remote_set_transmitting(remote, XRemoteTransmittingIdle);
162195}
0 commit comments