Use global variables to handle websocket request
modified handleSetWS2812FXMode to use global variables
This commit is contained in:
parent
c1c24b42d0
commit
ba5146d3d7
1 changed files with 3 additions and 6 deletions
|
@ -273,12 +273,9 @@ void setModeByStateString(String saved_state_string) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void handleSetWS2812FXMode(uint8_t * mypayload) {
|
void handleSetWS2812FXMode(uint8_t * mypayload) {
|
||||||
mode = HOLD;
|
mode = SET_MODE;
|
||||||
uint8_t ws2812fx_mode = (uint8_t) strtol((const char *) &mypayload[1], NULL, 10);
|
uint8_t ws2812fx_mode_tmp = (uint8_t) strtol((const char *) &mypayload[1], NULL, 10);
|
||||||
ws2812fx_mode = constrain(ws2812fx_mode, 0, 255);
|
ws2812fx_mode = constrain(ws2812fx_mode_tmp, 0, strip.getModeCount() - 1);
|
||||||
strip.setColor(main_color.red, main_color.green, main_color.blue);
|
|
||||||
strip.setMode(ws2812fx_mode);
|
|
||||||
strip.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* listStatusJSON() {
|
char* listStatusJSON() {
|
||||||
|
|
Loading…
Reference in a new issue