Fix external module power init

This commit is contained in:
MX 2023-03-06 14:23:59 +03:00
parent 27000f1763
commit 6511252140
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
8 changed files with 15 additions and 14 deletions

View File

@ -736,10 +736,11 @@ void subghz_remote_subghz_alloc(SubGHzRemote* app) {
SubGHzRemote* subghz_remote_alloc(void) { SubGHzRemote* subghz_remote_alloc(void) {
SubGHzRemote* app = malloc(sizeof(SubGHzRemote)); SubGHzRemote* app = malloc(sizeof(SubGHzRemote));
furi_hal_power_suppress_charge_enter();
// Enable power for External CC1101 if it is connected // Enable power for External CC1101 if it is connected
furi_hal_subghz_enable_ext_power(); furi_hal_subghz_enable_ext_power();
furi_hal_power_suppress_charge_enter();
app->model_mutex = furi_mutex_alloc(FuriMutexTypeNormal); app->model_mutex = furi_mutex_alloc(FuriMutexTypeNormal);
app->input_queue = furi_message_queue_alloc(32, sizeof(InputEvent)); app->input_queue = furi_message_queue_alloc(32, sizeof(InputEvent));

View File

@ -672,11 +672,11 @@ int32_t playlist_app(void* p) {
Playlist* app = playlist_alloc(meta); Playlist* app = playlist_alloc(meta);
meta->view_port = app->view_port; meta->view_port = app->view_port;
furi_hal_power_suppress_charge_enter();
// Enable power for External CC1101 if it is connected // Enable power for External CC1101 if it is connected
furi_hal_subghz_enable_ext_power(); furi_hal_subghz_enable_ext_power();
furi_hal_power_suppress_charge_enter();
// select playlist file // select playlist file
{ {
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);

View File

@ -122,11 +122,11 @@ POCSAGPagerApp* pocsag_pager_app_alloc() {
app->txrx->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode); app->txrx->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode);
subghz_worker_set_context(app->txrx->worker, app->txrx->receiver); subghz_worker_set_context(app->txrx->worker, app->txrx->receiver);
furi_hal_power_suppress_charge_enter();
// Enable power for External CC1101 if it is connected // Enable power for External CC1101 if it is connected
furi_hal_subghz_enable_ext_power(); furi_hal_subghz_enable_ext_power();
furi_hal_power_suppress_charge_enter();
scene_manager_next_scene(app->scene_manager, POCSAGPagerSceneStart); scene_manager_next_scene(app->scene_manager, POCSAGPagerSceneStart);
return app; return app;

View File

@ -167,12 +167,12 @@ ProtoViewApp* protoview_app_alloc() {
app->frequency = subghz_setting_get_default_frequency(app->setting); app->frequency = subghz_setting_get_default_frequency(app->setting);
app->modulation = 0; /* Defaults to ProtoViewModulations[0]. */ app->modulation = 0; /* Defaults to ProtoViewModulations[0]. */
furi_hal_power_suppress_charge_enter();
app->running = 1;
// Enable power for External CC1101 if it is connected // Enable power for External CC1101 if it is connected
furi_hal_subghz_enable_ext_power(); furi_hal_subghz_enable_ext_power();
furi_hal_power_suppress_charge_enter();
app->running = 1;
return app; return app;
} }

View File

@ -403,11 +403,11 @@ int32_t spectrum_analyzer_app(void* p) {
SpectrumAnalyzer* spectrum_analyzer = spectrum_analyzer_alloc(); SpectrumAnalyzer* spectrum_analyzer = spectrum_analyzer_alloc();
InputEvent input; InputEvent input;
furi_hal_power_suppress_charge_enter();
// Enable power for External CC1101 if it is connected // Enable power for External CC1101 if it is connected
furi_hal_subghz_enable_ext_power(); furi_hal_subghz_enable_ext_power();
furi_hal_power_suppress_charge_enter();
FURI_LOG_D("Spectrum", "Main Loop - Starting worker"); FURI_LOG_D("Spectrum", "Main Loop - Starting worker");
furi_delay_ms(50); furi_delay_ms(50);

@ -1 +1 @@
Subproject commit 552bd12d0f710501c31f7d44b4755d7fa89de303 Subproject commit ed94bc87868b80bf41dad754f3747a9f40551995

View File

@ -105,11 +105,11 @@ WeatherStationApp* weather_station_app_alloc() {
app->txrx->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode); app->txrx->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode);
subghz_worker_set_context(app->txrx->worker, app->txrx->receiver); subghz_worker_set_context(app->txrx->worker, app->txrx->receiver);
furi_hal_power_suppress_charge_enter();
// Enable power for External CC1101 if it is connected // Enable power for External CC1101 if it is connected
furi_hal_subghz_enable_ext_power(); furi_hal_subghz_enable_ext_power();
furi_hal_power_suppress_charge_enter();
scene_manager_next_scene(app->scene_manager, WeatherStationSceneStart); scene_manager_next_scene(app->scene_manager, WeatherStationSceneStart);
return app; return app;

View File

@ -81,7 +81,7 @@ void furi_hal_subghz_init(void) {
} }
void furi_hal_subghz_enable_ext_power(void) { void furi_hal_subghz_enable_ext_power(void) {
if(ext_power_is_enabled_already) return; if(ext_power_is_enabled_already && furi_hal_power_is_otg_enabled()) return;
ext_power_is_enabled_already = true; ext_power_is_enabled_already = true;
last_OTG_state = furi_hal_power_is_otg_enabled(); last_OTG_state = furi_hal_power_is_otg_enabled();
if(furi_hal_subghz.radio_type != SubGhzRadioInternal && !furi_hal_power_is_otg_enabled()) { if(furi_hal_subghz.radio_type != SubGhzRadioInternal && !furi_hal_power_is_otg_enabled()) {