update unirf

added gui message if frequency is outside of range
This commit is contained in:
MX 2022-08-03 04:53:11 +03:00
parent 03f741468c
commit 2ed40068a0
No known key found for this signature in database
GPG key ID: 6C4C311DFD4B4AB5

View file

@ -59,6 +59,7 @@ typedef struct {
int button; int button;
int file_result; int file_result;
bool tx_not_allowed;
int file_blank; int file_blank;
string_t signal; string_t signal;
@ -473,16 +474,20 @@ static void unirfremix_send_signal(
uint32_t frequency, uint32_t frequency,
string_t signal, string_t signal,
string_t protocol) { 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++) { for(int x = 1; x <= app->repeat; x++) {
frequency = frequency ? frequency : 433920000; frequency = frequency ? frequency : 433920000;
FURI_LOG_E(TAG, "file to send: %s", string_get_cstr(signal)); 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; string_t flipper_format_string;
if(strcmp(string_get_cstr(protocol), "RAW") == 0) { 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_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignTop, "Please configure map."); 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."); 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 { } else {
//map found, draw all the things //map found, draw all the things
canvas_clear(canvas); canvas_clear(canvas);