@@ -40,13 +40,13 @@ static const NotificationSequence sequence_saved = {
40
40
& message_vibro_off ,
41
41
NULL ,
42
42
};
43
- static const NotificationSequence sequence_not_saved = {
44
- & message_blink_stop ,
45
- & message_green_255 ,
46
- & message_blue_255 ,
47
- & message_red_255 ,
48
- NULL ,
49
- };
43
+ // static const NotificationSequence sequence_not_saved = {
44
+ // &message_blink_stop,
45
+ // &message_green_255,
46
+ // &message_blue_255,
47
+ // &message_red_255,
48
+ // NULL,
49
+ // };
50
50
51
51
static const uint32_t subghz_frequency_list [] = {
52
52
300000000 , 302757000 , 303875000 , 304250000 , 307000000 , 307500000 , 307800000 ,
@@ -255,7 +255,8 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
255
255
need_redraw = true;
256
256
}
257
257
258
- if (event -> type == InputTypeShort && event -> key == InputKeyOk ) {
258
+ if (event -> key == InputKeyOk ) {
259
+ bool updated = false;
259
260
with_view_model (
260
261
instance -> view , (SubGhzFrequencyAnalyzerModel * model ) {
261
262
uint32_t prev_freq_to_save = model -> frequency_to_save ;
@@ -282,14 +283,39 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
282
283
#endif
283
284
model -> frequency_to_save = frequency_candidate ;
284
285
notification_message (instance -> notifications , & sequence_saved );
285
- instance -> callback (SubGhzCustomEventViewReceiverOK , instance -> context );
286
- notification_message (instance -> notifications , & sequence_hw_blink );
287
- } else {
288
- notification_message (instance -> notifications , & sequence_not_saved );
289
286
notification_message (instance -> notifications , & sequence_hw_blink );
287
+ updated = true;
290
288
}
291
289
return true;
292
290
});
291
+
292
+ #if FURI_DEBUG
293
+ FURI_LOG_I (
294
+ TAG ,
295
+ "updated: %d, long: %d, type: %d" ,
296
+ updated ,
297
+ (event -> type == InputTypeLong ),
298
+ event -> type );
299
+ #endif
300
+
301
+ if (updated ) {
302
+ instance -> callback (SubGhzCustomEventViewReceiverOK , instance -> context );
303
+ }
304
+
305
+ // First device receive short, then when user release button we get long
306
+ if (event -> type == InputTypeLong ) {
307
+ #if FURI_DEBUG
308
+ FURI_LOG_I (TAG , "Longpress!" );
309
+ #endif
310
+ // Stop blinking
311
+ notification_message (instance -> notifications , & sequence_hw_blink_stop );
312
+
313
+ // Stop worker
314
+ if (subghz_frequency_analyzer_worker_is_running (instance -> worker )) {
315
+ subghz_frequency_analyzer_worker_stop (instance -> worker );
316
+ }
317
+ instance -> callback (SubGhzCustomEventViewReceiverUnlock , instance -> context );
318
+ }
293
319
}
294
320
295
321
if (need_redraw ) {
0 commit comments