Clean code

Clean code
This commit is contained in:
Theo Arends 2019-08-18 15:21:38 +02:00
parent 54364484fa
commit 7965ada5c5
3 changed files with 12 additions and 24 deletions

View File

@ -609,19 +609,3 @@ void EspRestart(void)
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
ESP.reset();
}
/*
void EspRestart(void)
{
ESP.restart();
}
*/
void WifiAddDelayWhenDisconnected(void)
{
if (APP_BAUDRATE == baudrate) { // When baudrate too low it will fail on Sonoff Pow R2 and S31 serial interface initialization
if (global_state.wifi_down) {
delay(DRIVER_BOOT_DELAY);
}
}
}

View File

@ -881,7 +881,6 @@ bool XdrvCall(uint8_t Function)
bool result = false;
for (uint32_t x = 0; x < xdrv_present; x++) {
// WifiAddDelayWhenDisconnected();
result = xdrv_func_ptr[x](Function);
if (result && ((FUNC_COMMAND == Function) ||

View File

@ -870,13 +870,19 @@ bool XsnsNextCall(uint8_t Function, uint8_t &xsns_index)
{
xsns_index++;
if (xsns_index == xsns_present) { xsns_index = 0; }
#ifdef USE_DEBUG_DRIVER
while (!XsnsEnabled(xsns_index) && !xsns_index) { // Perform at least first sensor (counter)
xsns_index++;
if (xsns_index == xsns_present) { xsns_index = 0; }
#ifndef USE_DEBUG_DRIVER
if (FUNC_WEB_SENSOR == Function) { // Skip web info for disabled sensors
#endif
uint32_t max_disabled = xsns_present;
while (!XsnsEnabled(xsns_index) && max_disabled--) { // Perform at least one sensor
xsns_index++;
if (xsns_index == xsns_present) { xsns_index = 0; }
}
#ifndef USE_DEBUG_DRIVER
}
#endif
// WifiAddDelayWhenDisconnected();
return xsns_func_ptr[xsns_index](Function);
}
@ -890,7 +896,7 @@ bool XsnsCall(uint8_t Function)
for (uint32_t x = 0; x < xsns_present; x++) {
#ifdef USE_DEBUG_DRIVER
if (XsnsEnabled(x)) {
if (XsnsEnabled(x)) { // Skip disabled sensor in debug mode
#endif
if ((FUNC_WEB_SENSOR == Function) && !XsnsEnabled(x)) { continue; } // Skip web info for disabled sensors
@ -898,7 +904,6 @@ bool XsnsCall(uint8_t Function)
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND
uint32_t profile_start_millis = millis();
#endif // PROFILE_XSNS_SENSOR_EVERY_SECOND
// WifiAddDelayWhenDisconnected();
result = xsns_func_ptr[x](Function);
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND