mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 15:00:46 +00:00
Add retry and delay to avoid power issues with Wifi plugins
This commit is contained in:
parent
2046ac6604
commit
968d6d578f
2 changed files with 29 additions and 6 deletions
|
@ -352,7 +352,12 @@ int32_t esp8266_deauth_app(void* p) {
|
||||||
#else
|
#else
|
||||||
#if ENABLE_MODULE_POWER
|
#if ENABLE_MODULE_POWER
|
||||||
app->m_context = Initializing;
|
app->m_context = Initializing;
|
||||||
|
uint8_t attempts = 0;
|
||||||
|
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
|
furi_delay_ms(10);
|
||||||
|
}
|
||||||
|
furi_delay_ms(200);
|
||||||
#else
|
#else
|
||||||
app->m_context = ModuleActive;
|
app->m_context = ModuleActive;
|
||||||
#endif
|
#endif
|
||||||
|
@ -409,7 +414,11 @@ int32_t esp8266_deauth_app(void* p) {
|
||||||
app->m_wifiDeauthModuleAttached = true;
|
app->m_wifiDeauthModuleAttached = true;
|
||||||
#if ENABLE_MODULE_POWER
|
#if ENABLE_MODULE_POWER
|
||||||
app->m_context = Initializing;
|
app->m_context = Initializing;
|
||||||
|
uint8_t attempts2 = 0;
|
||||||
|
while(!furi_hal_power_is_otg_enabled() && attempts2++ < 3) {
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
|
furi_delay_ms(10);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
app->m_context = ModuleActive;
|
app->m_context = ModuleActive;
|
||||||
#endif
|
#endif
|
||||||
|
@ -533,7 +542,9 @@ int32_t esp8266_deauth_app(void* p) {
|
||||||
DEAUTH_APP_LOG_I("App freed");
|
DEAUTH_APP_LOG_I("App freed");
|
||||||
|
|
||||||
#if ENABLE_MODULE_POWER
|
#if ENABLE_MODULE_POWER
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
furi_hal_power_disable_otg();
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -663,7 +663,12 @@ int32_t wifi_scanner_app(void* p) {
|
||||||
#else
|
#else
|
||||||
app->m_context = Initializing;
|
app->m_context = Initializing;
|
||||||
#if ENABLE_MODULE_POWER
|
#if ENABLE_MODULE_POWER
|
||||||
|
uint8_t attempts = 0;
|
||||||
|
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
|
furi_delay_ms(10);
|
||||||
|
}
|
||||||
|
furi_delay_ms(200);
|
||||||
#endif // ENABLE_MODULE_POWER
|
#endif // ENABLE_MODULE_POWER
|
||||||
#endif // ENABLE_MODULE_DETECTION
|
#endif // ENABLE_MODULE_DETECTION
|
||||||
|
|
||||||
|
@ -722,7 +727,12 @@ int32_t wifi_scanner_app(void* p) {
|
||||||
app->m_wifiModuleAttached = true;
|
app->m_wifiModuleAttached = true;
|
||||||
app->m_context = Initializing;
|
app->m_context = Initializing;
|
||||||
#if ENABLE_MODULE_POWER
|
#if ENABLE_MODULE_POWER
|
||||||
|
uint8_t attempts2 = 0;
|
||||||
|
while(!furi_hal_power_is_otg_enabled() && attempts2++ < 3) {
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
|
furi_delay_ms(10);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -851,7 +861,9 @@ int32_t wifi_scanner_app(void* p) {
|
||||||
WIFI_APP_LOG_I("App freed");
|
WIFI_APP_LOG_I("App freed");
|
||||||
|
|
||||||
#if ENABLE_MODULE_POWER
|
#if ENABLE_MODULE_POWER
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
furi_hal_power_disable_otg();
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue