SubGhz refactor merge pt 0

This commit is contained in:
MX 2023-05-05 02:09:21 +03:00
parent ac05387803
commit 1f0c2c1266
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
6 changed files with 17 additions and 18 deletions

View file

@ -12,7 +12,7 @@
#define MENU_ITEMS 4u
#define UNLOCK_CNT 3
#define SUBGHZ_RAW_TRESHOLD_MIN -90.0f
#define SUBGHZ_RAW_THRESHOLD_MIN -90.0f
typedef struct {
FuriString* item_str;
@ -69,10 +69,10 @@ void pcsg_receiver_rssi(PCSGReceiver* instance, float rssi) {
instance->view,
PCSGReceiverModel * model,
{
if(rssi < SUBGHZ_RAW_TRESHOLD_MIN) {
if(rssi < SUBGHZ_RAW_THRESHOLD_MIN) {
model->u_rssi = 0;
} else {
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_TRESHOLD_MIN);
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_THRESHOLD_MIN);
}
},
true);

View file

@ -12,7 +12,7 @@
#define MENU_ITEMS 4u
#define UNLOCK_CNT 3
#define SUBGHZ_RAW_TRESHOLD_MIN -90.0f
#define SUBGHZ_RAW_THRESHOLD_MIN -90.0f
typedef struct {
FuriString* item_str;
uint8_t type;
@ -69,10 +69,10 @@ void ws_view_receiver_set_rssi(WSReceiver* instance, float rssi) {
instance->view,
WSReceiverModel * model,
{
if(rssi < SUBGHZ_RAW_TRESHOLD_MIN) {
if(rssi < SUBGHZ_RAW_THRESHOLD_MIN) {
model->u_rssi = 0;
} else {
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_TRESHOLD_MIN);
model->u_rssi = (uint8_t)(rssi - SUBGHZ_RAW_THRESHOLD_MIN);
}
},
true);

View file

@ -50,9 +50,10 @@ void subghz_scene_show_error_on_enter(void* context) {
bool subghz_scene_show_error_on_event(void* context, SceneManagerEvent event) {
SubGhz* subghz = context;
SubGhzCustomEvent scene_state =
scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError);
if(event.type == SceneManagerEventTypeBack) {
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError) ==
SubGhzCustomEventManagerSet) {
if(scene_state == SubGhzCustomEventManagerSet) {
return false;
} else {
scene_manager_search_and_switch_to_previous_scene(
@ -61,14 +62,12 @@ bool subghz_scene_show_error_on_event(void* context, SceneManagerEvent event) {
return true;
} else if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubGhzCustomEventSceneShowErrorOk) {
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError) ==
SubGhzCustomEventManagerSet) {
if(scene_state == SubGhzCustomEventManagerSet) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneStart);
}
return true;
} else if(event.event == SubGhzCustomEventSceneShowErrorBack) {
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneShowError) ==
SubGhzCustomEventManagerSet) {
if(scene_state == SubGhzCustomEventManagerSet) {
//exit app
if(!scene_manager_previous_scene(subghz->scene_manager)) {
scene_manager_stop(subghz->scene_manager);

View file

@ -23,7 +23,7 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
key_str = furi_string_alloc();
frequency_str = furi_string_alloc();
modulation_str = furi_string_alloc();
uint8_t show_button = 0;
bool show_button = false;
if(subghz_protocol_decoder_base_deserialize(
subghz->txrx->decoder_result, subghz->txrx->fff_data) == SubGhzProtocolStatusOk) {
@ -31,7 +31,7 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
if((subghz->txrx->decoder_result->protocol->flag & SubGhzProtocolFlag_Send) ==
SubGhzProtocolFlag_Send) {
show_button = 1;
show_button = true;
}
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);

View file

@ -16,7 +16,7 @@ typedef struct {
FuriString* frequency_str;
FuriString* preset_str;
FuriString* key_str;
uint8_t show_button;
bool show_button;
FuriString* temp_button_id;
bool draw_temp_button;
} SubGhzViewTransmitterModel;
@ -36,7 +36,7 @@ void subghz_view_transmitter_add_data_to_show(
const char* key_str,
const char* frequency_str,
const char* preset_str,
uint8_t show_button) {
bool show_button) {
furi_assert(subghz_transmitter);
with_view_model(
subghz_transmitter->view,
@ -119,7 +119,7 @@ bool subghz_view_transmitter_input(InputEvent* event, void* context) {
furi_string_reset(model->preset_str);
furi_string_reset(model->key_str);
furi_string_reset(model->temp_button_id);
model->show_button = 0;
model->show_button = false;
model->draw_temp_button = false;
},
false);

View file

@ -23,4 +23,4 @@ void subghz_view_transmitter_add_data_to_show(
const char* key_str,
const char* frequency_str,
const char* preset_str,
uint8_t show_button);
bool show_button);