diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 1f76a66f6..833ed38b1 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -1252,24 +1252,6 @@ void HandleRoot(void) } } #endif // USE_TUYA_MCU -#ifdef USE_SONOFF_RF - if (SONOFF_BRIDGE == TasmotaGlobal.module_type) { - WSContentSend_P(HTTP_TABLE100); - WSContentSend_P(PSTR("")); - uint32_t idx = 0; - for (uint32_t i = 0; i < 4; i++) { - if (idx > 0) { WSContentSend_P(PSTR("")); } - for (uint32_t j = 0; j < 4; j++) { - idx++; - snprintf_P(stemp, sizeof(stemp), PSTR("%d"), idx); - WSContentSend_P(PSTR(""), idx, // &k is related to WebGetArg("k", tmp, sizeof(tmp)); - (strlen(SettingsText(SET_BUTTON1 + idx -1))) ? SettingsText(SET_BUTTON1 + idx -1) : stemp); - } - } - WSContentSend_P(PSTR("")); - } -#endif // USE_SONOFF_RF - #ifndef FIRMWARE_MINIMAL XdrvCall(FUNC_WEB_ADD_MAIN_BUTTON); XsnsCall(FUNC_WEB_ADD_MAIN_BUTTON); @@ -1405,13 +1387,6 @@ bool HandleRootStatusRefresh(void) } } #endif // USE_SHUTTER -#ifdef USE_SONOFF_RF - WebGetArg(PSTR("k"), tmp, sizeof(tmp)); // 1 - 16 Pre defined RF keys - if (strlen(tmp)) { - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_RFKEY "%s"), tmp); - ExecuteWebCommand(svalue); - } -#endif // USE_SONOFF_RF #ifdef USE_ZIGBEE WebGetArg(PSTR("zbj"), tmp, sizeof(tmp)); if (strlen(tmp)) { diff --git a/tasmota/xdrv_06_snfbridge.ino b/tasmota/xdrv_06_snfbridge.ino index bd3f99b34..62a7db8c1 100644 --- a/tasmota/xdrv_06_snfbridge.ino +++ b/tasmota/xdrv_06_snfbridge.ino @@ -501,6 +501,36 @@ void CmndRfRaw(void) ResponseCmndStateText(SnfBridge.receive_raw_flag); } +#ifdef USE_WEBSERVER + +void SonoffBridgeAddFuctionButtons(void) { + WSContentSend_P(HTTP_TABLE100); + WSContentSend_P(PSTR("")); + char number[4]; + uint32_t idx = 0; + for (uint32_t i = 0; i < 4; i++) { + if (idx > 0) { WSContentSend_P(PSTR("")); } + for (uint32_t j = 0; j < 4; j++) { + idx++; + WSContentSend_P(PSTR(""), idx, // &k is related to WebGetArg("k", tmp, sizeof(tmp)); + (strlen(SettingsText(SET_BUTTON1 + idx -1))) ? SettingsText(SET_BUTTON1 + idx -1) : itoa(idx, number, 10)); + } + } + WSContentSend_P(PSTR("")); +} + +void SonoffBridgeWebGetArg(void) { + char tmp[8]; // WebGetArg numbers only + WebGetArg(PSTR("k"), tmp, sizeof(tmp)); // 1 - 16 Pre defined RF keys + if (strlen(tmp)) { + char command[20]; + snprintf_P(command, sizeof(command), PSTR(D_CMND_RFKEY "%s"), tmp); + ExecuteWebCommand(command); + } +} + +#endif // USE_WEBSERVER + /*********************************************************************************************\ * Interface \*********************************************************************************************/ @@ -518,6 +548,14 @@ bool Xdrv06(uint8_t function) case FUNC_COMMAND: result = DecodeCommand(kSonoffBridgeCommands, SonoffBridgeCommand); break; +#ifdef USE_WEBSERVER + case FUNC_WEB_ADD_MAIN_BUTTON: + SonoffBridgeAddFuctionButtons(); + break; + case FUNC_WEB_GET_ARG: + SonoffBridgeWebGetArg(); + break; +#endif // USE_WEBSERVER case FUNC_INIT: SnfBridge.receive_raw_flag = 0; SonoffBridgeSendCommand(0xA7); // Stop reading RF signals enabling iTead default RF handling diff --git a/tasmota/xlgt_07_lsc_mcsl.ino b/tasmota/xlgt_07_lsc_mcsl.ino index 4b9abb6c0..d7c9bbfd2 100644 --- a/tasmota/xlgt_07_lsc_mcsl.ino +++ b/tasmota/xlgt_07_lsc_mcsl.ino @@ -249,8 +249,6 @@ void LscMcModuleSelected(void) { #ifdef USE_LSC_MCSL_GUI void LscMcAddFuctionButtons(void) { - char number[4]; - uint32_t rows = 1; uint32_t cols = 8; for (uint32_t i = 0; i < 8; i++) { @@ -262,6 +260,7 @@ void LscMcAddFuctionButtons(void) { } WSContentSend_P(HTTP_TABLE100); WSContentSend_P(PSTR("")); + char number[4]; uint32_t idx = 0; for (uint32_t i = 0; i < rows; i++) { if (idx > 0) { WSContentSend_P(PSTR("")); } @@ -277,11 +276,11 @@ void LscMcAddFuctionButtons(void) { } void LscMcWebGetArg(void) { - char tmp[8]; // WebGetArg numbers only - char command[20]; + char tmp[8]; // WebGetArg numbers only WebGetArg(PSTR("lsc"), tmp, sizeof(tmp)); // 0 - 7 functions if (strlen(tmp)) { uint32_t function = atoi(tmp); + char command[20]; snprintf_P(command, sizeof(command), PSTR(D_CMND_DIMMER " %d"), (function * (100 / 8)) + ((100 / 8) / 2)); ExecuteWebCommand(command); }