From 2ed40068a0b0e3fc121b3bd7464c20ddc1600c88 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 3 Aug 2022 04:53:11 +0300 Subject: [PATCH] update unirf added gui message if frequency is outside of range --- applications/unirfremix/unirfremix_app.c | 28 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/applications/unirfremix/unirfremix_app.c b/applications/unirfremix/unirfremix_app.c index 4f43428a4..000b20ef1 100644 --- a/applications/unirfremix/unirfremix_app.c +++ b/applications/unirfremix/unirfremix_app.c @@ -59,6 +59,7 @@ typedef struct { int button; int file_result; + bool tx_not_allowed; int file_blank; string_t signal; @@ -473,16 +474,20 @@ static void unirfremix_send_signal( uint32_t frequency, string_t signal, string_t protocol) { + if(!furi_hal_subghz_is_tx_allowed(frequency)) { + printf( + "In your settings, only reception on this frequency (%lu) is allowed,\r\n" + "the actual operation of the unirf app is not possible\r\n ", + frequency); + app->tx_not_allowed = true; + unirfremix_end_send(app); + return; + } else { + app->tx_not_allowed = false; + } for(int x = 1; x <= app->repeat; x++) { frequency = frequency ? frequency : 433920000; FURI_LOG_E(TAG, "file to send: %s", string_get_cstr(signal)); - if(!furi_hal_subghz_is_tx_allowed(frequency)) { - printf( - "In your settings, only reception on this frequency (%lu) is allowed,\r\n" - "the actual operation of the unirf app is not possible\r\n ", - frequency); - break; - } string_t flipper_format_string; if(strcmp(string_get_cstr(protocol), "RAW") == 0) { @@ -588,6 +593,15 @@ static void render_callback(Canvas* canvas, void* ctx) { canvas_set_font(canvas, FontSecondary); canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignTop, "Please configure map."); canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Hold Back to Exit."); + } else if(app->tx_not_allowed) { + canvas_clear(canvas); + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Transmission is blocked."); + canvas_set_font(canvas, FontSecondary); + canvas_draw_str_aligned(canvas, 62, 15, AlignCenter, AlignTop, "Frequency is outside of"); + canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignTop, "default range."); + canvas_draw_str_aligned(canvas, 62, 35, AlignCenter, AlignTop, "Check docs."); + canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Hold Back to Exit."); } else { //map found, draw all the things canvas_clear(canvas);