External module power bug fixes

This commit is contained in:
MX 2023-03-13 18:43:50 +03:00
parent 5ddb9bd444
commit c560394358
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
4 changed files with 7 additions and 3 deletions

View file

@ -181,7 +181,7 @@ bool subghz_scene_ext_module_settings_on_event(void* context, SceneManagerEvent
// 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(value_index_exm);
furi_hal_subghz_set_radio_type(SubGhzRadioInternal);
furi_string_set(subghz->error_str, "Please connect\nexternal radio");
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowErrorSub);
}

View file

@ -84,6 +84,7 @@ 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_string_set(subghz->error_str, "Please connect\nexternal radio");
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowErrorSub);
return true;

View file

@ -73,6 +73,9 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
subghz->in_decoder_scene = false;
subghz->in_decoder_scene_skip = false;
// Call enable power for external module
furi_hal_subghz_enable_ext_power();
// View Dispatcher
subghz->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(subghz->view_dispatcher);

View file

@ -93,10 +93,10 @@ bool furi_hal_subghz_enable_ext_power(void) {
}
if(furi_hal_subghz.radio_type != SubGhzRadioInternal) {
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 2) {
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
//CC1101 power-up time
furi_delay_ms(5);
furi_delay_ms(10);
}
}
return furi_hal_power_is_otg_enabled();