Fix very old and funny subghz bugs

Fixed Frequency Ananyzer issues
Fixed read mode issues
Fixed re-inits in HAL
This commit is contained in:
MX 2023-04-25 01:42:20 +03:00
parent 87a023c75d
commit ab669b26da
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
5 changed files with 18 additions and 4 deletions

View file

@ -103,5 +103,8 @@ typedef enum {
SubGhzCustomEventViewTransmitterSendStop,
SubGhzCustomEventViewTransmitterError,
SubGhzCustomEventViewFreqAnalOkShort,
SubGhzCustomEventViewFreqAnalOkLong,
SubGhzCustomEventByteInputDone,
} SubGhzCustomEvent;

View file

@ -54,7 +54,7 @@ bool subghz_scene_frequency_analyzer_on_event(void* context, SceneManagerEvent e
} else if(event.event == SubGhzCustomEventSceneAnalyzerUnlock) {
notification_message(subghz->notifications, &sequence_reset_rgb);
return true;
} else if(event.event == SubGhzCustomEventViewReceiverOK) {
} else if(event.event == SubGhzCustomEventViewFreqAnalOkShort) {
notification_message(subghz->notifications, &sequence_saved);
uint32_t frequency =
subghz_frequency_analyzer_get_frequency_to_save(subghz->subghz_frequency_analyzer);
@ -64,11 +64,12 @@ bool subghz_scene_frequency_analyzer_on_event(void* context, SceneManagerEvent e
}
return true;
} else if(event.event == SubGhzCustomEventViewReceiverUnlock) {
} else if(event.event == SubGhzCustomEventViewFreqAnalOkLong) {
// Don't need to save, we already saved on short event
#ifdef FURI_DEBUG
FURI_LOG_W(TAG, "Goto next scene!");
#endif
//scene_manager_set_scene_state(subghz->scene_manager, SubGhzSceneStart, 10);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiver);
return true;
}

View file

@ -125,6 +125,11 @@ uint8_t subghz_history_get_type_protocol(SubGhzHistory* instance, uint16_t idx)
const char* subghz_history_get_protocol_name(SubGhzHistory* instance, uint16_t idx) {
furi_assert(instance);
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
if(!item || !item->flipper_string) {
FURI_LOG_E(TAG, "Missing Item");
furi_string_reset(instance->tmp_string);
return furi_string_get_cstr(instance->tmp_string);
}
flipper_format_rewind(item->flipper_string);
if(!flipper_format_read_string(item->flipper_string, "Protocol", instance->tmp_string)) {
FURI_LOG_E(TAG, "Missing Protocol");

View file

@ -372,7 +372,7 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
#endif
if(updated) {
instance->callback(SubGhzCustomEventViewReceiverOK, instance->context);
instance->callback(SubGhzCustomEventViewFreqAnalOkShort, instance->context);
}
// First device receive short, then when user release button we get long
@ -385,7 +385,7 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
subghz_frequency_analyzer_worker_stop(instance->worker);
}
instance->callback(SubGhzCustomEventViewReceiverUnlock, instance->context);
instance->callback(SubGhzCustomEventViewFreqAnalOkLong, instance->context);
}
}

View file

@ -48,6 +48,11 @@ void furi_hal_subghz_select_radio_type(SubGhzRadioType state) {
}
bool furi_hal_subghz_init_radio_type(SubGhzRadioType state) {
if(state == SubGhzRadioInternal && furi_hal_subghz.cc1101_g0_pin == &gpio_cc1101_g0) {
return true;
} else if(state == SubGhzRadioExternal && furi_hal_subghz.cc1101_g0_pin == &gpio_cc1101_g0_ext) {
return true;
}
furi_hal_spi_bus_handle_deinit(furi_hal_subghz.spi_bus_handle);
if(state == SubGhzRadioInternal) {