Fix ESP32 compilation

This commit is contained in:
Theo Arends 2020-09-25 18:34:14 +02:00
parent 9cbd2d531d
commit 46cbe13e9b
2 changed files with 4 additions and 0 deletions

View File

@ -1119,6 +1119,7 @@ int ResponseJsonEndEnd(void)
* GPIO Module and Template management
\*********************************************************************************************/
#ifdef ESP8266
uint16_t GpioConvert(uint8_t gpio) {
if (gpio > ARRAY_SIZE(kGpioConvert)) {
return AGPIO(GPIO_USER);
@ -1142,6 +1143,7 @@ void TemplateConvert(uint8_t template8[], uint16_t template16[]) {
}
template16[(sizeof(mytmplt) / 2) -2] = Adc0Convert(template8[sizeof(mytmplt8285) -1]);
}
#endif // ESP8266
uint32_t ICACHE_RAM_ATTR Pin(uint32_t gpio, uint32_t index = 0);
uint32_t ICACHE_RAM_ATTR Pin(uint32_t gpio, uint32_t index) {

View File

@ -1476,11 +1476,13 @@ void GpioInit(void)
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: Used GPIOs %d"), GPIO_SENSOR_END);
#ifdef ESP8266
if (Settings.user_template8.flag != 255) {
// Convert 8-bit user template
TemplateConvert((uint8_t*)&Settings.user_template8, (uint16_t*)&Settings.user_template);
Settings.user_template8.flag = 255;
}
#endif // ESP8266
for (uint32_t i = 0; i < ARRAY_SIZE(Settings.user_template.gp.io); i++) {
if ((Settings.user_template.gp.io[i] >= AGPIO(GPIO_SENSOR_END)) && (Settings.user_template.gp.io[i] < AGPIO(GPIO_USER))) {