Save preset, RSSIm ignore values in last settings

- Save preset
- Save RSSI
- Save Ignore Starline, Cars, Magellan
- Fix types of COUNT_OF result
- Move subghz_set_default_preset to SubGhzTxRx
- In subghz_txrx_radio_device_is_tx_allowed check for SubGhzTxRxStateSleep is not working
This commit is contained in:
DerSkythe
2023-08-08 08:58:20 +04:00
parent 540862fbf2
commit 8c44dfb6af
18 changed files with 294 additions and 154 deletions

View File

@@ -12,7 +12,7 @@
#define MENU_ITEMS 4u
#define UNLOCK_CNT 3
#define SUBGHZ_RAW_THRESHOLD_MIN -90.0f
// #define SUBGHZ_RAW_THRESHOLD_MIN (-90.0f)
#define FLIP_TIMEOUT (500)
@@ -322,15 +322,19 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) {
(model->device_type == SubGhzRadioDeviceTypeInternal) ? &I_Scanning_123x52 :
&I_Fishing_123x52);
canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 63, 46, "Scanning...");
if(model->hopping_enabled) {
canvas_draw_str(canvas, 59, 46, "Hopper scan...");
} else {
canvas_draw_str(canvas, 59, 46, "Fixed scan...");
}
//canvas_draw_line(canvas, 46, 51, 125, 51);
canvas_set_font(canvas, FontSecondary);
if(model->hopping_enabled) {
const uint8_t vertical_offset = 7;
const uint8_t horizontal_offset = 3;
canvas_draw_icon(canvas, horizontal_offset, vertical_offset, &I_Dynamic_9x7);
}
// if(model->hopping_enabled) {
// const uint8_t vertical_offset = 0;
// const uint8_t horizontal_offset = 3;
// canvas_draw_icon(canvas, horizontal_offset, vertical_offset, &I_Dynamic_9x7);
// }
} else {
canvas_draw_icon(
canvas,
@@ -466,8 +470,10 @@ bool subghz_view_receiver_input(InputEvent* event, void* context) {
return true;
}
bool consumed = false;
if(event->key == InputKeyBack && event->type == InputTypeShort) {
subghz_receiver->callback(SubGhzCustomEventViewReceiverBack, subghz_receiver->context);
consumed = true;
} else if(
event->key == InputKeyUp &&
(event->type == InputTypeShort || event->type == InputTypeRepeat)) {
@@ -479,6 +485,7 @@ bool subghz_view_receiver_input(InputEvent* event, void* context) {
subghz_view_receiver_show_time_moment(context);
},
true);
consumed = true;
} else if(
event->key == InputKeyDown &&
(event->type == InputTypeShort || event->type == InputTypeRepeat)) {
@@ -492,8 +499,10 @@ bool subghz_view_receiver_input(InputEvent* event, void* context) {
}
},
true);
consumed = true;
} else if(event->key == InputKeyLeft && event->type == InputTypeShort) {
subghz_receiver->callback(SubGhzCustomEventViewReceiverConfig, subghz_receiver->context);
consumed = true;
} else if(event->key == InputKeyRight && event->type == InputTypeLong) {
with_view_model(
subghz_receiver->view,
@@ -506,6 +515,7 @@ bool subghz_view_receiver_input(InputEvent* event, void* context) {
}
},
false);
consumed = true;
} else if(event->key == InputKeyOk && event->type == InputTypeShort) {
with_view_model(
subghz_receiver->view,
@@ -517,11 +527,13 @@ bool subghz_view_receiver_input(InputEvent* event, void* context) {
}
},
false);
consumed = true;
}
subghz_view_receiver_update_offset(subghz_receiver);
return true;
if(consumed) {
subghz_view_receiver_update_offset(subghz_receiver);
}
return consumed;
}
void subghz_view_receiver_enter(void* context) {
@@ -551,6 +563,7 @@ void subghz_view_receiver_exit(void* context) {
model->list_offset = 0;
model->history_item = 0;
model->nodraw = false;
model->hopping_enabled = false;
},
false);
furi_timer_stop(subghz_receiver->timer);
@@ -587,6 +600,7 @@ SubGhzViewReceiver* subghz_view_receiver_alloc() {
model->bar_show = SubGhzViewReceiverBarShowDefault;
model->nodraw = false;
model->history = malloc(sizeof(SubGhzReceiverHistory));
model->hopping_enabled = false;
SubGhzReceiverMenuItemArray_init(model->history->data);
},
true);
@@ -630,7 +644,7 @@ View* subghz_view_receiver_get_view(SubGhzViewReceiver* subghz_receiver) {
uint16_t subghz_view_receiver_get_idx_menu(SubGhzViewReceiver* subghz_receiver) {
furi_assert(subghz_receiver);
uint16_t idx = 0;
uint16_t idx;
with_view_model(
subghz_receiver->view, SubGhzViewReceiverModel * model, { idx = model->idx; }, false);
return idx;