Skip to content

Commit

Permalink
Latest Release RM1025-0252-0.93.1-bda2f2c on PATREON - SUBGHZ OUT OF …
Browse files Browse the repository at this point in the history
…REGION INDICATOR
  • Loading branch information
RogueMaster committed Oct 25, 2023
1 parent 20b0744 commit e24d4a0
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This software is for experimental purposes only and is not meant for any illegal
- Last Synced/Checked Unleashed, changes in [changelog](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/CHANGELOG.md): `2023-10-23 23:00 EST`
- 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)
- [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)
- [Sub-GHz Transmit Indicator before Out of Region Frequency Use (By RogueMaster)]()

<a name="release">

Expand Down
Binary file added applications/main/subghz/images/AngSmile1_10x12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added applications/main/subghz/images/EviSmile1_10x12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions applications/main/subghz/subghz_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,37 @@ bool subghz_is_locked(SubGhz* subghz) {
return (subghz->lock == SubGhzLockOn);
}

bool subghz_is_legal(FuriString* val_str) {
bool is_allowed = false;
char* end_char;
uint32_t value = (uint32_t)(strtof(furi_string_get_cstr(val_str), &end_char) * 1000000.0);
switch(furi_hal_version_get_hw_region()) {
case FuriHalVersionRegionEuRu:
if((value >= 433050000 && value <= 434790000) ||
(value >= 868150000 && value <= 868550000)) {
is_allowed = true;
}
break;
case FuriHalVersionRegionUsCaAu:
if((value >= 304100000 && value <= 321950000) ||
(value >= 433050000 && value <= 434790000) ||
(value >= 915000000 && value <= 928000000)) {
is_allowed = true;
}
break;
case FuriHalVersionRegionJp:
if((value >= 312000000 && value <= 315250000) ||
(value >= 920500000 && value <= 923500000)) {
is_allowed = true;
}
break;
default:
is_allowed = true;
break;
}
return is_allowed;
}

void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state) {
furi_assert(subghz);
subghz->rx_key_state = state;
Expand Down
1 change: 1 addition & 0 deletions applications/main/subghz/subghz_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ SubGhzLoadTypeFile subghz_get_load_type_file(SubGhz* subghz);
void subghz_lock(SubGhz* subghz);
void subghz_unlock(SubGhz* subghz);
bool subghz_is_locked(SubGhz* subghz);
bool subghz_is_legal(FuriString* val_str);

void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state);
SubGhzRxKeyState subghz_rx_key_state_get(SubGhz* subghz);
Expand Down
9 changes: 9 additions & 0 deletions applications/main/subghz/views/subghz_read_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef struct {
float raw_threshold_rssi;
bool not_showing_samples;
SubGhzRadioDeviceType device_type;
bool is_legal;
} SubGhzReadRAWModel;

void subghz_read_raw_set_callback(
Expand All @@ -55,6 +56,7 @@ void subghz_read_raw_add_data_statusbar(
{
furi_string_set(model->frequency_str, frequency_str);
furi_string_set(model->preset_str, preset_str);
model->is_legal = subghz_is_legal(model->frequency_str);
},
true);
}
Expand Down Expand Up @@ -360,6 +362,11 @@ void subghz_read_raw_draw(Canvas* canvas, SubGhzReadRAWModel* model) {
if(graphics_mode == 0) {
subghz_read_raw_draw_sin(canvas, model);
} else {
if(model->is_legal) {
canvas_draw_icon(canvas, 117, 9, &I_AngSmile1_10x12);
} else {
canvas_draw_icon(canvas, 117, 9, &I_EviSmile1_10x12);
}
subghz_read_raw_draw_rssi(canvas, model);
subghz_read_raw_draw_scale(canvas, model);
subghz_read_raw_draw_threshold_rssi(canvas, model);
Expand Down Expand Up @@ -540,6 +547,7 @@ void subghz_read_raw_set_status(
furi_string_reset(model->file_name);
furi_string_set(model->sample_write, "0 spl.");
model->raw_threshold_rssi = raw_threshold_rssi;
model->is_legal = false;
},
true);
break;
Expand Down Expand Up @@ -633,6 +641,7 @@ SubGhzReadRAW* subghz_read_raw_alloc(bool raw_send_only) {
model->raw_send_only = raw_send_only;
model->rssi_history = malloc(SUBGHZ_READ_RAW_RSSI_HISTORY_SIZE * sizeof(uint8_t));
model->raw_threshold_rssi = -127.0f;
model->is_legal = false;
},
true);

Expand Down
9 changes: 9 additions & 0 deletions applications/main/subghz/views/transmitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef struct {
SubGhzRadioDeviceType device_type;
FuriString* temp_button_id;
bool draw_temp_button;
bool is_legal;
} SubGhzViewTransmitterModel;

void subghz_view_transmitter_set_callback(
Expand Down Expand Up @@ -48,6 +49,7 @@ void subghz_view_transmitter_add_data_to_show(
furi_string_set(model->frequency_str, frequency_str);
furi_string_set(model->preset_str, preset_str);
model->show_button = show_button;
model->is_legal = subghz_is_legal(model->frequency_str);
},
true);
}
Expand Down Expand Up @@ -112,6 +114,12 @@ void subghz_view_transmitter_draw(Canvas* canvas, SubGhzViewTransmitterModel* mo
canvas_set_font(canvas, FontSecondary);
}

if(model->is_legal) {
canvas_draw_icon(canvas, 117, 9, &I_AngSmile1_10x12);
} else {
canvas_draw_icon(canvas, 117, 9, &I_EviSmile1_10x12);
}

if(model->show_button) {
// TODO
canvas_draw_str(
Expand Down Expand Up @@ -250,6 +258,7 @@ SubGhzViewTransmitter* subghz_view_transmitter_alloc() {
model->preset_str = furi_string_alloc();
model->key_str = furi_string_alloc();
model->temp_button_id = furi_string_alloc();
model->is_legal = false;
},
true);
return subghz_transmitter;
Expand Down
Binary file added assets/icons/SubGhz/AngSmile1_10x12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/SubGhz/EviSmile1_10x12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e24d4a0

Please sign in to comment.