mirror of https://github.com/arendst/Tasmota.git
commit
2f954b22c3
|
@ -138,22 +138,22 @@ enum ProgramSelectablePins {
|
|||
// Text in webpage Module Parameters and commands GPIOS and GPIO
|
||||
const char kSensorNames[] PROGMEM =
|
||||
D_SENSOR_NONE "|"
|
||||
D_SENSOR_BUTTON "|" D_SENSOR_BUTTON "n|" D_SENSOR_BUTTON "i|" D_SENSOR_BUTTON "in|"
|
||||
D_SENSOR_SWITCH "|" D_SENSOR_SWITCH "n|"
|
||||
D_SENSOR_RELAY "|" D_SENSOR_RELAY "i|"
|
||||
D_SENSOR_LED "|" D_SENSOR_LED "i|"
|
||||
D_SENSOR_COUNTER "|" D_SENSOR_COUNTER "n|"
|
||||
D_SENSOR_PWM "|" D_SENSOR_PWM "i|"
|
||||
D_SENSOR_BUZZER "|" D_SENSOR_BUZZER "i|"
|
||||
D_SENSOR_LED_LINK "|" D_SENSOR_LED_LINK "i|"
|
||||
D_SENSOR_BUTTON "|" D_SENSOR_BUTTON "_n|" D_SENSOR_BUTTON "_i|" D_SENSOR_BUTTON "_in|"
|
||||
D_SENSOR_SWITCH "|" D_SENSOR_SWITCH "_n|"
|
||||
D_SENSOR_RELAY "|" D_SENSOR_RELAY "_i|"
|
||||
D_SENSOR_LED "|" D_SENSOR_LED "_i|"
|
||||
D_SENSOR_COUNTER "|" D_SENSOR_COUNTER "_n|"
|
||||
D_SENSOR_PWM "|" D_SENSOR_PWM "_i|"
|
||||
D_SENSOR_BUZZER "|" D_SENSOR_BUZZER "_i|"
|
||||
D_SENSOR_LED_LINK "|" D_SENSOR_LED_LINK "_i|"
|
||||
D_SENSOR_I2C_SCL "|" D_SENSOR_I2C_SDA "|"
|
||||
D_SENSOR_SPI_MISO "|" D_SENSOR_SPI_MOSI "|" D_SENSOR_SPI_CLK "|" D_SENSOR_SPI_CS "|" D_SENSOR_SPI_DC "|"
|
||||
D_SENSOR_SSPI_MISO "|" D_SENSOR_SSPI_MOSI "|" D_SENSOR_SSPI_SCLK "|" D_SENSOR_SSPI_CS "|" D_SENSOR_SSPI_DC "|"
|
||||
D_SENSOR_BACKLIGHT "|" D_SENSOR_OLED_RESET "|"
|
||||
D_SENSOR_IRSEND "|" D_SENSOR_IRRECV "|"
|
||||
D_SENSOR_RFSEND "|" D_SENSOR_RFRECV "|"
|
||||
D_SENSOR_DHT11 "|" D_SENSOR_AM2301 "|" D_SENSOR_SI7021 "|" D_SENSOR_DHT11 "o|"
|
||||
D_SENSOR_DS18X20 "|" D_SENSOR_DS18X20 "o|"
|
||||
D_SENSOR_DHT11 "|" D_SENSOR_AM2301 "|" D_SENSOR_SI7021 "|" D_SENSOR_DHT11 "_o|"
|
||||
D_SENSOR_DS18X20 "|" D_SENSOR_DS18X20 "_o|"
|
||||
D_SENSOR_WS2812 "|"
|
||||
D_SENSOR_MHZ_TX "|" D_SENSOR_MHZ_RX "|"
|
||||
D_SENSOR_PZEM0XX_TX "|" D_SENSOR_PZEM004_RX "|" D_SENSOR_PZEM016_RX "|" D_SENSOR_PZEM017_RX "|"
|
||||
|
@ -173,7 +173,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_RF_SENSOR "|"
|
||||
D_SENSOR_AZ_TX "|" D_SENSOR_AZ_RX "|"
|
||||
D_SENSOR_MAX31855_CS "|" D_SENSOR_MAX31855_CLK "|" D_SENSOR_MAX31855_DO "|"
|
||||
D_SENSOR_NRG_SEL "|" D_SENSOR_NRG_SEL "i|" D_SENSOR_NRG_CF1 "|" D_SENSOR_HLW_CF "|" D_SENSOR_HJL_CF "|"
|
||||
D_SENSOR_NRG_SEL "|" D_SENSOR_NRG_SEL "_i|" D_SENSOR_NRG_CF1 "|" D_SENSOR_HLW_CF "|" D_SENSOR_HJL_CF "|"
|
||||
D_SENSOR_MCP39F5_TX "|" D_SENSOR_MCP39F5_RX "|" D_SENSOR_MCP39F5_RST "|"
|
||||
D_SENSOR_PN532_TX "|" D_SENSOR_PN532_RX "|"
|
||||
D_SENSOR_SM16716_CLK "|" D_SENSOR_SM16716_DAT "|" D_SENSOR_SM16716_POWER "|"
|
||||
|
@ -181,7 +181,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_CSE7766_TX "|" D_SENSOR_CSE7766_RX "|"
|
||||
D_SENSOR_ARIRFRCV "|" D_SENSOR_ARIRFSEL "|"
|
||||
D_SENSOR_TXD "|" D_SENSOR_RXD "|"
|
||||
D_SENSOR_ROTARY "1a|" D_SENSOR_ROTARY "1b|" D_SENSOR_ROTARY "2a|" D_SENSOR_ROTARY "2b|"
|
||||
D_SENSOR_ROTARY "_1a|" D_SENSOR_ROTARY "_1b|" D_SENSOR_ROTARY "_2a|" D_SENSOR_ROTARY "_2b|"
|
||||
D_SENSOR_HRE_CLOCK "|" D_SENSOR_HRE_DATA "|"
|
||||
D_SENSOR_ADE7953_IRQ "|"
|
||||
D_SENSOR_SOLAXX1_TX "|" D_SENSOR_SOLAXX1_RX "|"
|
||||
|
@ -193,7 +193,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_DDSU666_TX "|" D_SENSOR_DDSU666_RX "|"
|
||||
D_SENSOR_SM2135_CLK "|" D_SENSOR_SM2135_DAT "|"
|
||||
D_SENSOR_DEEPSLEEP "|" D_SENSOR_EXS_ENABLE "|"
|
||||
D_SENSOR_SLAVE_TX "|" D_SENSOR_SLAVE_RX "|" D_SENSOR_SLAVE_RESET "|" D_SENSOR_SLAVE_RESET "i|"
|
||||
D_SENSOR_SLAVE_TX "|" D_SENSOR_SLAVE_RX "|" D_SENSOR_SLAVE_RESET "|" D_SENSOR_SLAVE_RESET "_i|"
|
||||
D_SENSOR_HPMA_RX "|" D_SENSOR_HPMA_TX "|"
|
||||
D_SENSOR_GPS_RX "|" D_SENSOR_GPS_TX "|"
|
||||
D_SENSOR_HM10_RX "|" D_SENSOR_HM10_TX "|"
|
||||
|
@ -204,7 +204,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_AS3935 "|"
|
||||
D_ANALOG_INPUT "|"
|
||||
D_TEMPERATURE "|" D_LIGHT "|"
|
||||
D_SENSOR_BUTTON "|" D_SENSOR_BUTTON "i|"
|
||||
D_SENSOR_BUTTON "|" D_SENSOR_BUTTON "_i|"
|
||||
D_RANGE "|"
|
||||
D_CT_POWER "|"
|
||||
D_GPIO_WEBCAM_PWDN "|" D_GPIO_WEBCAM_RESET "|" D_GPIO_WEBCAM_XCLK "|"
|
||||
|
|
|
@ -230,6 +230,11 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
|
|||
const char HTTP_MODULE_TEMPLATE_REPLACE[] PROGMEM =
|
||||
"}2%d'>%s (%d}3"; // }2 and }3 are used in below os.replace
|
||||
|
||||
const char HTTP_MODULE_TEMPLATE_REPLACE_INDEX[] PROGMEM =
|
||||
"}2%d'>%s (%d)}3"; // }2 and }3 are used in below os.replace
|
||||
const char HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX[] PROGMEM =
|
||||
"}2%d'>%s}3"; // }2 and }3 are used in below os.replace
|
||||
|
||||
const char HTTP_SCRIPT_MODULE_TEMPLATE[] PROGMEM =
|
||||
#ifdef ESP8266
|
||||
"var os;"
|
||||
|
@ -257,7 +262,7 @@ const char HTTP_SCRIPT_MODULE_TEMPLATE[] PROGMEM =
|
|||
"t.style.visibility=(b>0)?'':'hidden';"
|
||||
"}"
|
||||
"function sk(s,g){" // s = value, g = id and name
|
||||
"var o=os.replace(/}2/g,\"<option value='\").replace(/}3/g,\")</option>\");"
|
||||
"var o=os.replace(/}2/g,\"<option value='\").replace(/}3/g,\"</option>\");"
|
||||
"eb('g'+g).innerHTML=o;"
|
||||
"eb('g'+g).value=(g<99)?s&0xffe0:s;"
|
||||
"if(g<99){ot(g,s);}"
|
||||
|
@ -1452,17 +1457,21 @@ void HandleTemplateConfiguration(void)
|
|||
|
||||
WSContentSend_P(HTTP_SCRIPT_TEMPLATE);
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(kGpioNiceList); i++) { // GPIO: }2'0'>None (0)}3}2'17'>Button1 (17)}3...
|
||||
#ifdef ESP8266
|
||||
if (1 == i) {
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, AGPIO(GPIO_USER), D_SENSOR_USER, AGPIO(GPIO_USER)); // }2'255'>User (255)}3
|
||||
}
|
||||
#ifdef ESP8266
|
||||
uint32_t midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), ridx);
|
||||
#else // ESP32
|
||||
if (1 == i) {
|
||||
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 midx = ridx >> 5;
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
|
||||
#endif // ESP8266 - ESP32
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), ridx);
|
||||
}
|
||||
WSContentSend_P(PSTR("\";"));
|
||||
|
||||
|
@ -1491,12 +1500,16 @@ void HandleTemplateConfiguration(void)
|
|||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, i, GetTextIndexed(stemp, sizeof(stemp), i, kAdc0Names), i);
|
||||
}
|
||||
WSContentSend_P(HTTP_SCRIPT_TEMPLATE3);
|
||||
#endif
|
||||
#endif // ESP8266
|
||||
|
||||
WSContentSend_P(HTTP_SCRIPT_TEMPLATE4);
|
||||
for (uint32_t i = 0; i < sizeof(kModuleNiceList); i++) { // "}2'%d'>%s (%d)}3" - "}2'0'>Sonoff Basic (1)}3"
|
||||
uint32_t midx = pgm_read_byte(kModuleNiceList + i);
|
||||
#ifdef ESP8266
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, midx, AnyModuleName(midx).c_str(), midx +1);
|
||||
#else // ESP32
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_INDEX, midx, AnyModuleName(midx).c_str(), midx +1);
|
||||
#endif // ESP8266 - ESP32
|
||||
}
|
||||
WSContentSend_P(HTTP_SCRIPT_TEMPLATE5);
|
||||
|
||||
|
@ -1617,20 +1630,27 @@ void HandleModuleConfiguration(void)
|
|||
midx = pgm_read_byte(kModuleNiceList + i -1);
|
||||
vidx = midx +1;
|
||||
}
|
||||
#ifdef ESP8266
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, midx, AnyModuleName(midx).c_str(), vidx);
|
||||
#else // ESP32
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_INDEX, midx, AnyModuleName(midx).c_str(), vidx);
|
||||
#endif // ESP8266 - ESP32
|
||||
}
|
||||
WSContentSend_P(PSTR("\";sk(%d,99);os=\""), Settings.module);
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(kGpioNiceList); i++) {
|
||||
#ifdef ESP8266
|
||||
midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // ESP32
|
||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||
midx = ridx >> 5;
|
||||
#endif // ESP8266 - ESP32
|
||||
if (!GetUsedInModule(midx, cmodule.io)) {
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), ridx);
|
||||
}
|
||||
#else // ESP32
|
||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||
midx = ridx >> 5;
|
||||
if (!GetUsedInModule(midx, cmodule.io)) {
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames));
|
||||
}
|
||||
#endif // ESP8266 - ESP32
|
||||
}
|
||||
WSContentSend_P(PSTR("\";"));
|
||||
|
||||
|
|
|
@ -791,7 +791,9 @@ void HAssAnyKey(void)
|
|||
|
||||
char stopic[TOPSZ];
|
||||
|
||||
if (state == 3) {
|
||||
if (state == 2) {
|
||||
snprintf_P(trg_state, sizeof(trg_state), PSTR("SINGLE"));
|
||||
} else if (state == 3) {
|
||||
snprintf_P(trg_state, sizeof(trg_state), GetStateText(3));
|
||||
} else {
|
||||
GetTextIndexed(trg_state, sizeof(trg_state), state -9, kHAssTriggerStringButtons);
|
||||
|
@ -847,4 +849,4 @@ bool Xdrv12(uint8_t function)
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_HOME_ASSISTANT
|
||||
#endif // USE_HOME_ASSISTANT
|
||||
|
|
|
@ -202,7 +202,7 @@ a_features = [[
|
|||
],[
|
||||
"USE_KEELOQ","USE_HRXL","USE_SONOFF_D1","USE_HDC1080",
|
||||
"USE_IAQ","USE_DISPLAY_SEVENSEG","USE_AS3935","USE_PING",
|
||||
"USE_WINDMETER","USE_OPENTHERM","","",
|
||||
"USE_WINDMETER","USE_OPENTHERM","USE_THERMOSTAT","",
|
||||
"","","","",
|
||||
"","","","",
|
||||
"","","","",
|
||||
|
|
Loading…
Reference in New Issue