mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 15:58:36 -07:00
Merge branch 'ul-dev' into xfw-dev
This commit is contained in:
@@ -103,5 +103,8 @@ typedef enum {
|
||||
SubGhzCustomEventViewTransmitterSendStop,
|
||||
SubGhzCustomEventViewTransmitterError,
|
||||
|
||||
SubGhzCustomEventViewFreqAnalOkShort,
|
||||
SubGhzCustomEventViewFreqAnalOkLong,
|
||||
|
||||
SubGhzCustomEventByteInputDone,
|
||||
} SubGhzCustomEvent;
|
||||
|
||||
@@ -211,14 +211,16 @@ bool subghz_scene_ext_module_settings_on_event(void* context, SceneManagerEvent
|
||||
UNUSED(event);
|
||||
|
||||
// Set selected radio module
|
||||
furi_hal_subghz_set_radio_type(value_index_exm);
|
||||
furi_hal_subghz_select_radio_type(value_index_exm);
|
||||
furi_hal_subghz_init_radio_type(value_index_exm);
|
||||
|
||||
furi_hal_subghz_enable_ext_power();
|
||||
|
||||
// Check if module is present, if no -> show error
|
||||
if(!furi_hal_subghz_check_radio()) {
|
||||
value_index_exm = 0;
|
||||
furi_hal_subghz_set_radio_type(SubGhzRadioInternal);
|
||||
furi_hal_subghz_select_radio_type(SubGhzRadioInternal);
|
||||
furi_hal_subghz_init_radio_type(SubGhzRadioInternal);
|
||||
furi_string_set(subghz->error_str, "Please connect\nexternal radio");
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowErrorSub);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,8 @@ bool subghz_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
furi_hal_subghz_enable_ext_power();
|
||||
|
||||
if(!furi_hal_subghz_check_radio()) {
|
||||
furi_hal_subghz_set_radio_type(SubGhzRadioInternal);
|
||||
furi_hal_subghz_select_radio_type(SubGhzRadioInternal);
|
||||
furi_hal_subghz_init_radio_type(SubGhzRadioInternal);
|
||||
subghz->last_settings->external_module_enabled = false;
|
||||
furi_string_set(subghz->error_str, "Please connect\nexternal radio");
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowErrorSub);
|
||||
|
||||
@@ -451,7 +451,8 @@ int32_t subghz_app(void* p) {
|
||||
// Auto switch to internal radio if external radio is not available
|
||||
if(!furi_hal_subghz_check_radio()) {
|
||||
subghz->last_settings->external_module_enabled = false;
|
||||
furi_hal_subghz_set_radio_type(SubGhzRadioInternal);
|
||||
furi_hal_subghz_select_radio_type(SubGhzRadioInternal);
|
||||
furi_hal_subghz_init_radio_type(SubGhzRadioInternal);
|
||||
}
|
||||
// Check argument and run corresponding scene
|
||||
if(p && strlen(p)) {
|
||||
@@ -507,6 +508,8 @@ int32_t subghz_app(void* p) {
|
||||
furi_hal_power_suppress_charge_exit();
|
||||
// Disable power for External CC1101 if it was enabled and module is connected
|
||||
furi_hal_subghz_disable_ext_power();
|
||||
// Reinit SPI handles for internal radio / nfc
|
||||
furi_hal_subghz_init_radio_type(SubGhzRadioInternal);
|
||||
|
||||
subghz_free(subghz, alloc_for_tx);
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -129,7 +129,8 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
|
||||
// Set selected radio module
|
||||
if(instance->external_module_enabled) {
|
||||
furi_hal_subghz_set_radio_type(SubGhzRadioExternal);
|
||||
furi_hal_subghz_select_radio_type(SubGhzRadioExternal);
|
||||
furi_hal_subghz_init_radio_type(SubGhzRadioExternal);
|
||||
}
|
||||
|
||||
/*/} else {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user