Solve getstatus not return values correctly
Resolve https://github.com/toblum/McLighting/issues/146
This commit is contained in:
parent
5d9fa4c966
commit
c1c24b42d0
1 changed files with 6 additions and 12 deletions
|
@ -283,18 +283,12 @@ void handleSetWS2812FXMode(uint8_t * mypayload) {
|
|||
|
||||
char* listStatusJSON() {
|
||||
char json[255];
|
||||
|
||||
char modeName[30];
|
||||
|
||||
// if (mode == SET_MODE) {
|
||||
strncpy_P(modeName, (PGM_P)strip.getModeName((uint8_t) ws2812fx_mode), sizeof(modeName)); // copy from progmem
|
||||
snprintf(json, sizeof(json), "{\"mode\":%d, \"ws2812fx_mode\":%d, \"ws2812fx_mode_name\":\"%s\", \"speed\":%d, \"brightness\":%d, \"color\":[%d, %d, %d]}",
|
||||
mode, ws2812fx_mode, modeName, ws2812fx_speed, brightness, main_color.red, main_color.green, main_color.blue);
|
||||
// }else {
|
||||
// strncpy_P(modeName, (PGM_P)strip.getModeName(strip.getMode()), sizeof(modeName)); // copy from progmem
|
||||
// snprintf(json, sizeof(json), "{\"mode\":%d, \"ws2812fx_mode\":%d, \"ws2812fx_mode_name\":\"%s\", \"speed\":%d, \"brightness\":%d, \"color\":[%d, %d, %d]}",
|
||||
// mode, strip.getMode(), modeName, ws2812fx_speed, brightness, main_color.red, main_color.green, main_color.blue);
|
||||
// }
|
||||
uint8_t tmp_mode = (mode == SET_MODE) ? (uint8_t) ws2812fx_mode : strip.getMode();
|
||||
|
||||
strncpy_P(modeName, (PGM_P)strip.getModeName(tmp_mode), sizeof(modeName)); // copy from progmem
|
||||
snprintf(json, sizeof(json), "{\"mode\":%d, \"ws2812fx_mode\":%d, \"ws2812fx_mode_name\":\"%s\", \"speed\":%d, \"brightness\":%d, \"color\":[%d, %d, %d]}",
|
||||
mode, tmp_mode, modeName, ws2812fx_speed, brightness, main_color.red, main_color.green, main_color.blue);
|
||||
return json;
|
||||
}
|
||||
|
||||
|
@ -1436,4 +1430,4 @@ bool readStateFS() {
|
|||
updateFS = false;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue