mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Refactor ESP32 support
This commit is contained in:
parent
7600a81c8e
commit
ff327106be
@ -1265,11 +1265,7 @@ uint32_t ValidPin(uint32_t pin, uint32_t gpio)
|
|||||||
|
|
||||||
bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
||||||
{
|
{
|
||||||
#ifdef ESP8266
|
return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins
|
||||||
return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins
|
|
||||||
#else // ESP32
|
|
||||||
return (GPIO_USER == ValidPin(pin, gpio >> 5)); // Only allow GPIO_USER pins
|
|
||||||
#endif // ESP8266 - ESP32
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
@ -1113,10 +1113,8 @@ void CmndGpio(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
char sindex[4] = { 0 };
|
char sindex[4] = { 0 };
|
||||||
#ifdef ESP8266
|
uint32_t sensor_name_idx = BGPIO(sensor_type);
|
||||||
uint32_t sensor_name_idx = sensor_type;
|
#ifdef ESP32
|
||||||
#else // ESP32
|
|
||||||
uint32_t sensor_name_idx = sensor_type >> 5;
|
|
||||||
uint32_t nice_list_search = sensor_type & 0xFFE0;
|
uint32_t nice_list_search = sensor_type & 0xFFE0;
|
||||||
for (uint32_t j = 0; j < ARRAY_SIZE(kGpioNiceList); j++) {
|
for (uint32_t j = 0; j < ARRAY_SIZE(kGpioNiceList); j++) {
|
||||||
uint32_t nls_idx = pgm_read_word(kGpioNiceList + j);
|
uint32_t nls_idx = pgm_read_word(kGpioNiceList + j);
|
||||||
@ -1125,7 +1123,7 @@ void CmndGpio(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ESP8266 - ESP32
|
#endif // ESP32
|
||||||
const char *sensor_names = kSensorNames;
|
const char *sensor_names = kSensorNames;
|
||||||
if (sensor_name_idx > GPIO_FIX_START) {
|
if (sensor_name_idx > GPIO_FIX_START) {
|
||||||
sensor_name_idx = sensor_name_idx - GPIO_FIX_START -1;
|
sensor_name_idx = sensor_name_idx - GPIO_FIX_START -1;
|
||||||
@ -1156,7 +1154,7 @@ void CmndGpios(void)
|
|||||||
uint32_t ridx = midx;
|
uint32_t ridx = midx;
|
||||||
#else // ESP32
|
#else // ESP32
|
||||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||||
uint32_t midx = ridx >> 5;
|
uint32_t midx = BGPIO(ridx);
|
||||||
#endif // ESP8266 - ESP32
|
#endif // ESP8266 - ESP32
|
||||||
if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; }
|
if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; }
|
||||||
if (!jsflg) {
|
if (!jsflg) {
|
||||||
|
@ -1728,7 +1728,7 @@ void HandleTemplateConfiguration(void)
|
|||||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), D_SENSOR_USER); // }2'255'>User}3
|
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), D_SENSOR_USER); // }2'255'>User}3
|
||||||
}
|
}
|
||||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||||
uint32_t midx = ridx >> 5;
|
uint32_t midx = BGPIO(ridx);
|
||||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
|
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
|
||||||
#endif // ESP8266 - ESP32
|
#endif // ESP8266 - ESP32
|
||||||
}
|
}
|
||||||
@ -1905,7 +1905,7 @@ void HandleModuleConfiguration(void)
|
|||||||
}
|
}
|
||||||
#else // ESP32
|
#else // ESP32
|
||||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||||
midx = ridx >> 5;
|
midx = BGPIO(ridx);
|
||||||
if (!GetUsedInModule(midx, cmodule.io)) {
|
if (!GetUsedInModule(midx, cmodule.io)) {
|
||||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
|
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user