Skip to content

Commit e24d4a0

Browse files
committed
Latest Release RM1025-0252-0.93.1-bda2f2c on PATREON - SUBGHZ OUT OF REGION INDICATOR
1 parent 20b0744 commit e24d4a0

File tree

9 files changed

+51
-0
lines changed

9 files changed

+51
-0
lines changed

ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This software is for experimental purposes only and is not meant for any illegal
3333
- Last Synced/Checked Unleashed, changes in [changelog](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/CHANGELOG.md): `2023-10-23 23:00 EST`
3434
- Updated: [BLE Spam v4.1 (By Willy-JL & ECTO-1A & Spooks4576 with research from xMasterX; OFW API thanks to noproto)](https://github.com/noproto/apple_ble_spam_ofw) Crash Fix & Many Other Changes (By Willy-JL), New Actions (By Mr-Proxy-source) & New Devices (By xAstroBoy)
3535
- [ESP32 Evil Portal v0.2 (By bigbrodude6119)](https://github.com/bigbrodude6119/flipper-zero-evil-portal) ADDED: `sas_lounge.html` by [PontusMadsen](https://github.com/bigbrodude6119/flipper-zero-evil-portal/pull/79)
36+
- [Sub-GHz Transmit Indicator before Out of Region Frequency Use (By RogueMaster)]()
3637

3738
<a name="release">
3839

122 Bytes
Loading
119 Bytes
Loading

applications/main/subghz/subghz_i.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,37 @@ bool subghz_is_locked(SubGhz* subghz) {
418418
return (subghz->lock == SubGhzLockOn);
419419
}
420420

421+
bool subghz_is_legal(FuriString* val_str) {
422+
bool is_allowed = false;
423+
char* end_char;
424+
uint32_t value = (uint32_t)(strtof(furi_string_get_cstr(val_str), &end_char) * 1000000.0);
425+
switch(furi_hal_version_get_hw_region()) {
426+
case FuriHalVersionRegionEuRu:
427+
if((value >= 433050000 && value <= 434790000) ||
428+
(value >= 868150000 && value <= 868550000)) {
429+
is_allowed = true;
430+
}
431+
break;
432+
case FuriHalVersionRegionUsCaAu:
433+
if((value >= 304100000 && value <= 321950000) ||
434+
(value >= 433050000 && value <= 434790000) ||
435+
(value >= 915000000 && value <= 928000000)) {
436+
is_allowed = true;
437+
}
438+
break;
439+
case FuriHalVersionRegionJp:
440+
if((value >= 312000000 && value <= 315250000) ||
441+
(value >= 920500000 && value <= 923500000)) {
442+
is_allowed = true;
443+
}
444+
break;
445+
default:
446+
is_allowed = true;
447+
break;
448+
}
449+
return is_allowed;
450+
}
451+
421452
void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state) {
422453
furi_assert(subghz);
423454
subghz->rx_key_state = state;

applications/main/subghz/subghz_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ SubGhzLoadTypeFile subghz_get_load_type_file(SubGhz* subghz);
123123
void subghz_lock(SubGhz* subghz);
124124
void subghz_unlock(SubGhz* subghz);
125125
bool subghz_is_locked(SubGhz* subghz);
126+
bool subghz_is_legal(FuriString* val_str);
126127

127128
void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state);
128129
SubGhzRxKeyState subghz_rx_key_state_get(SubGhz* subghz);

applications/main/subghz/views/subghz_read_raw.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ typedef struct {
3232
float raw_threshold_rssi;
3333
bool not_showing_samples;
3434
SubGhzRadioDeviceType device_type;
35+
bool is_legal;
3536
} SubGhzReadRAWModel;
3637

3738
void subghz_read_raw_set_callback(
@@ -55,6 +56,7 @@ void subghz_read_raw_add_data_statusbar(
5556
{
5657
furi_string_set(model->frequency_str, frequency_str);
5758
furi_string_set(model->preset_str, preset_str);
59+
model->is_legal = subghz_is_legal(model->frequency_str);
5860
},
5961
true);
6062
}
@@ -360,6 +362,11 @@ void subghz_read_raw_draw(Canvas* canvas, SubGhzReadRAWModel* model) {
360362
if(graphics_mode == 0) {
361363
subghz_read_raw_draw_sin(canvas, model);
362364
} else {
365+
if(model->is_legal) {
366+
canvas_draw_icon(canvas, 117, 9, &I_AngSmile1_10x12);
367+
} else {
368+
canvas_draw_icon(canvas, 117, 9, &I_EviSmile1_10x12);
369+
}
363370
subghz_read_raw_draw_rssi(canvas, model);
364371
subghz_read_raw_draw_scale(canvas, model);
365372
subghz_read_raw_draw_threshold_rssi(canvas, model);
@@ -540,6 +547,7 @@ void subghz_read_raw_set_status(
540547
furi_string_reset(model->file_name);
541548
furi_string_set(model->sample_write, "0 spl.");
542549
model->raw_threshold_rssi = raw_threshold_rssi;
550+
model->is_legal = false;
543551
},
544552
true);
545553
break;
@@ -633,6 +641,7 @@ SubGhzReadRAW* subghz_read_raw_alloc(bool raw_send_only) {
633641
model->raw_send_only = raw_send_only;
634642
model->rssi_history = malloc(SUBGHZ_READ_RAW_RSSI_HISTORY_SIZE * sizeof(uint8_t));
635643
model->raw_threshold_rssi = -127.0f;
644+
model->is_legal = false;
636645
},
637646
true);
638647

applications/main/subghz/views/transmitter.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ typedef struct {
2121
SubGhzRadioDeviceType device_type;
2222
FuriString* temp_button_id;
2323
bool draw_temp_button;
24+
bool is_legal;
2425
} SubGhzViewTransmitterModel;
2526

2627
void subghz_view_transmitter_set_callback(
@@ -48,6 +49,7 @@ void subghz_view_transmitter_add_data_to_show(
4849
furi_string_set(model->frequency_str, frequency_str);
4950
furi_string_set(model->preset_str, preset_str);
5051
model->show_button = show_button;
52+
model->is_legal = subghz_is_legal(model->frequency_str);
5153
},
5254
true);
5355
}
@@ -112,6 +114,12 @@ void subghz_view_transmitter_draw(Canvas* canvas, SubGhzViewTransmitterModel* mo
112114
canvas_set_font(canvas, FontSecondary);
113115
}
114116

117+
if(model->is_legal) {
118+
canvas_draw_icon(canvas, 117, 9, &I_AngSmile1_10x12);
119+
} else {
120+
canvas_draw_icon(canvas, 117, 9, &I_EviSmile1_10x12);
121+
}
122+
115123
if(model->show_button) {
116124
// TODO
117125
canvas_draw_str(
@@ -250,6 +258,7 @@ SubGhzViewTransmitter* subghz_view_transmitter_alloc() {
250258
model->preset_str = furi_string_alloc();
251259
model->key_str = furi_string_alloc();
252260
model->temp_button_id = furi_string_alloc();
261+
model->is_legal = false;
253262
},
254263
true);
255264
return subghz_transmitter;
122 Bytes
Loading
119 Bytes
Loading

0 commit comments

Comments
 (0)