More ESP32 compatibility

This commit is contained in:
Theo Arends 2020-04-16 16:29:33 +02:00
parent d2b7b4012f
commit 538dfbef2e
2 changed files with 16 additions and 3 deletions

View File

@ -1675,17 +1675,28 @@ void ModuleSaveSettings(void)
if (ValidGPIO(i, cmodule.io[i])) {
snprintf_P(webindex, sizeof(webindex), PSTR("g%d"), i);
WebGetArg(webindex, tmp, sizeof(tmp));
Settings.my_gp.io[i] = (!strlen(tmp)) ? 0 : atoi(tmp);
gpios += F(", " D_GPIO ); gpios += String(i); gpios += F(" "); gpios += String(Settings.my_gp.io[i]);
uint8_t value = (!strlen(tmp)) ? 0 : atoi(tmp);
#ifdef ESP8266
Settings.my_gp.io[i] = value;
#else // ESP32
if (i == ADC0_PIN) {
Settings.my_adc0 = value;
} else {
Settings.my_gp.io[i] = value;
}
#endif // ESP8266 - ESP32
gpios += F(", " D_GPIO ); gpios += String(i); gpios += F(" "); gpios += String(value);
}
}
}
#ifdef ESP8266
#ifndef USE_ADC_VCC
// WebGetArg("g17", tmp, sizeof(tmp));
WebGetArg("g" STR(ADC0_PIN), tmp, sizeof(tmp));
Settings.my_adc0 = (!strlen(tmp)) ? 0 : atoi(tmp);
gpios += F(", " D_ADC "0 "); gpios += String(Settings.my_adc0);
#endif // USE_ADC_VCC
#endif // ESP8266
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str());
}

View File

@ -229,7 +229,9 @@ void DebugFreeMem(void)
void DebugFreeMem(void)
{
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d"), ESP.getFreeHeap());
register uint8_t *sp asm("a1");
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), sp - pxTaskGetStackStart(NULL), XdrvMailbox.data);
}
#endif // ESP8266 - ESP32