Fix wrong GUI Module and Template drop down list indexes regression

This commit is contained in:
Theo Arends 2024-11-18 22:53:07 +01:00
parent 320ad0e1d3
commit 3778f22d7b
6 changed files with 325 additions and 323 deletions

View File

@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- ESP32 upgrade by file upload response based on file size (#22500)
- Wrong GUI Module and Template drop down list indexes regression
### Removed

View File

@ -107,7 +107,7 @@ const uint8_t MAX_I2S = 2; // Max number of Hardware I2S contro
const uint8_t MAX_RMT = 0; // Max number or RMT channels (0 if unknown)
#endif
#else
const uint8_t MAX_SPI = 0; // Max number of Hardware SPI controllers (ESP8266 = 0, no choice)
const uint8_t MAX_SPI = 1; // Max number of Hardware SPI controllers
const uint8_t MAX_I2S = 0; // Max number of Hardware I2S controllers (ESP8266 = 0, no choice)
const uint8_t MAX_RMT = 0; // No RMT channel on ESP8266
#endif

View File

@ -543,6 +543,7 @@ const char kWebColors[] PROGMEM =
#define AGPIO(x) ((x)<<5)
#define BGPIO(x) ((x)>>5)
#define AGMAX(x) ((x)?(x-1):0)
#ifdef USE_DEVICE_GROUPS
#define SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, ...) _SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, __VA_ARGS__, 0)

File diff suppressed because it is too large Load Diff

View File

@ -1805,7 +1805,7 @@ void CmndGpio(void)
if (ValidGPIO(XdrvMailbox.index, template_gp.io[XdrvMailbox.index]) && (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < AGPIO(GPIO_SENSOR_END))) {
bool present = false;
for (uint32_t i = 0; i < nitems(kGpioNiceList); i++) {
uint32_t midx = pgm_read_word(kGpioNiceList + i);
uint32_t midx = pgm_read_word(&kGpioNiceList[i]);
uint32_t max_midx = ((midx & 0x001F) > 0) ? midx : midx +1;
if ((XdrvMailbox.payload >= (midx & 0xFFE0)) && (XdrvMailbox.payload < max_midx)) {
present = true;
@ -1843,7 +1843,7 @@ void CmndGpio(void)
uint32_t sensor_name_idx = BGPIO(sensor_type);
uint32_t nice_list_search = sensor_type & 0xFFE0;
for (uint32_t j = 0; j < nitems(kGpioNiceList); j++) {
uint32_t nls_idx = pgm_read_word(kGpioNiceList + j);
uint32_t nls_idx = pgm_read_word(&kGpioNiceList[j]);
if (((nls_idx & 0xFFE0) == nice_list_search) && ((nls_idx & 0x001F) > 0)) {
snprintf_P(sindex, sizeof(sindex), PSTR("%d"), (sensor_type & 0x001F) +1);
break;

View File

@ -1932,7 +1932,7 @@ void WSContentSendNiceLists(uint32_t option) {
if (option && (1 == i)) {
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), PSTR(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 = BGPIO(ridx);
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
}
@ -1942,7 +1942,7 @@ void WSContentSendNiceLists(uint32_t option) {
uint32_t midx;
bool first_done = false;
for (uint32_t i = 0; i < nitems(kGpioNiceList); i++) { // hs=[36,68,100,132,168,200,232,264,292,324,356,388,421,453];
midx = pgm_read_word(kGpioNiceList + i);
midx = pgm_read_word(&kGpioNiceList[i]);
if (midx & 0x001F) {
if (first_done) { WSContentSend_P(PSTR(",")); }
WSContentSend_P(PSTR("%d"), midx);