mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
Add control of WifiConfig when power ON is pressed for over 5 seconds or single press
Add control of WifiConfig when power ON is pressed for over 5 seconds or single press
This commit is contained in:
parent
546653a8f2
commit
fdda0429d6
@ -167,12 +167,10 @@ void PS16DZSerialInput(void)
|
|||||||
ps16dz_rx_buffer[ps16dz_byte_counter++] = 0x00;
|
ps16dz_rx_buffer[ps16dz_byte_counter++] = 0x00;
|
||||||
|
|
||||||
// AT+RESULT="sequence":"1554682835320"
|
// AT+RESULT="sequence":"1554682835320"
|
||||||
// AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":255,"colorB":255,"bright":100,"mode":19,"speed":100,"sensitive":100
|
|
||||||
// AT+SETTING=enterESPTOUCH - When ON button is held for over 5 seconds
|
|
||||||
// AT+SETTING=exitESPTOUCH - When ON button is pressed
|
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Received %s"), ps16dz_rx_buffer);
|
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Received %s"), ps16dz_rx_buffer);
|
||||||
|
|
||||||
if (!strncmp(ps16dz_rx_buffer+3, "UPDATE", 6)) {
|
if (!strncmp(ps16dz_rx_buffer+3, "UPDATE", 6)) {
|
||||||
|
// AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":255,"colorB":255,"bright":100,"mode":19,"speed":100,"sensitive":100
|
||||||
char *end_str;
|
char *end_str;
|
||||||
char *string = ps16dz_rx_buffer+10;
|
char *string = ps16dz_rx_buffer+10;
|
||||||
char *token = strtok_r(string, ",", &end_str);
|
char *token = strtok_r(string, ",", &end_str);
|
||||||
@ -255,9 +253,15 @@ void PS16DZSerialInput(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(ps16dz_rx_buffer+3, "SETTING", 7)) {
|
else if (!strncmp(ps16dz_rx_buffer+3, "SETTING", 7)) {
|
||||||
|
// AT+SETTING=enterESPTOUCH - When ON button is held for over 5 seconds
|
||||||
|
// AT+SETTING=exitESPTOUCH - When ON button is pressed
|
||||||
if (!Settings.flag.button_restrict) {
|
if (!Settings.flag.button_restrict) {
|
||||||
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_WIFICONFIG " 2"));
|
int state = WIFI_MANAGER;
|
||||||
ExecuteCommand(scmnd, SRC_BUTTON);
|
if (!strncmp(ps16dz_rx_buffer+10, "=exit", 5)) { state = WIFI_RETRY; }
|
||||||
|
if (state != Settings.sta_config) {
|
||||||
|
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_WIFICONFIG " %d"), state);
|
||||||
|
ExecuteCommand(scmnd, SRC_BUTTON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset(ps16dz_rx_buffer, 0, PS16DZ_BUFFER_SIZE);
|
memset(ps16dz_rx_buffer, 0, PS16DZ_BUFFER_SIZE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user