mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-24 01:28:11 -07:00
Add retry and delay to avoid power issues with Wifi plugins
This commit is contained in:
+14
-3
@@ -352,7 +352,12 @@ int32_t esp8266_deauth_app(void* p) {
|
||||
#else
|
||||
#if ENABLE_MODULE_POWER
|
||||
app->m_context = Initializing;
|
||||
furi_hal_power_enable_otg();
|
||||
uint8_t attempts = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
furi_delay_ms(200);
|
||||
#else
|
||||
app->m_context = ModuleActive;
|
||||
#endif
|
||||
@@ -409,7 +414,11 @@ int32_t esp8266_deauth_app(void* p) {
|
||||
app->m_wifiDeauthModuleAttached = true;
|
||||
#if ENABLE_MODULE_POWER
|
||||
app->m_context = Initializing;
|
||||
furi_hal_power_enable_otg();
|
||||
uint8_t attempts2 = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts2++ < 3) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
#else
|
||||
app->m_context = ModuleActive;
|
||||
#endif
|
||||
@@ -533,7 +542,9 @@ int32_t esp8266_deauth_app(void* p) {
|
||||
DEAUTH_APP_LOG_I("App freed");
|
||||
|
||||
#if ENABLE_MODULE_POWER
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) {
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
+15
-3
@@ -663,7 +663,12 @@ int32_t wifi_scanner_app(void* p) {
|
||||
#else
|
||||
app->m_context = Initializing;
|
||||
#if ENABLE_MODULE_POWER
|
||||
furi_hal_power_enable_otg();
|
||||
uint8_t attempts = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
furi_delay_ms(200);
|
||||
#endif // ENABLE_MODULE_POWER
|
||||
#endif // ENABLE_MODULE_DETECTION
|
||||
|
||||
@@ -722,7 +727,12 @@ int32_t wifi_scanner_app(void* p) {
|
||||
app->m_wifiModuleAttached = true;
|
||||
app->m_context = Initializing;
|
||||
#if ENABLE_MODULE_POWER
|
||||
furi_hal_power_enable_otg();
|
||||
uint8_t attempts2 = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts2++ < 3) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -851,7 +861,9 @@ int32_t wifi_scanner_app(void* p) {
|
||||
WIFI_APP_LOG_I("App freed");
|
||||
|
||||
#if ENABLE_MODULE_POWER
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) {
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user