Deactivated: Get WS2812 modes.

Message too large
This commit is contained in:
Tobias Blum 2017-08-06 16:32:39 +02:00
parent b699cf75a2
commit b71834bbb2
2 changed files with 13 additions and 9 deletions

View file

@ -8,6 +8,7 @@
#define ENABLE_OTA // If defined, enable Arduino OTA code.
#define ENABLE_MQTT // If defined, enable MQTT client code.
#define MQTT_MAX_PACKET_SIZE 4096
#ifdef ENABLE_MQTT
const char mqtt_intopic[] = "inTopic";
const char mqtt_outtopic[] = "outTopic";

View file

@ -342,14 +342,14 @@ void checkForRequests() {
// * ==> Set main color and light all LEDs (Shortcut)
if (payload[0] == '*') {
handleSetAllMode(payload);
DBG_OUTPUT_PORT.printf("MQTT: Set main color and light all LEDs [%u]\n", payload);
DBG_OUTPUT_PORT.printf("MQTT: Set main color and light all LEDs [%s]\n", payload);
mqtt_client.publish(mqtt_outtopic, "OK");
}
// ! ==> Set single LED in given color
if (payload[0] == '!') {
handleSetSingleLED(payload);
DBG_OUTPUT_PORT.printf("MQTT: Set single LED in given color [%u]\n", payload);
DBG_OUTPUT_PORT.printf("MQTT: Set single LED in given color [%s]\n", payload);
mqtt_client.publish(mqtt_outtopic, "OK");
}
@ -357,30 +357,33 @@ void checkForRequests() {
if (payload[0] == '=') {
String str_mode = String((char *) &payload[0]);
handleSetNamedMode(str_mode);
DBG_OUTPUT_PORT.printf("MQTT: Activate named mode [%u]\n", payload);
DBG_OUTPUT_PORT.printf("MQTT: Activate named mode [%s]\n", payload);
mqtt_client.publish(mqtt_outtopic, "OK");
}
// $ ==> Get status Info.
if (payload[0] == '$') {
DBG_OUTPUT_PORT.printf("MQTT: Get status info.");
DBG_OUTPUT_PORT.printf("MQTT: Get status info.\n");
mqtt_client.publish(mqtt_outtopic, listStatusJSON());
}
// ~ ==> Get WS2812 modes.
// TODO: Fix this, doesn't return anything. Too long?
if (payload[0] == '~') {
DBG_OUTPUT_PORT.printf("MQTT: Get WS2812 modes.");
String json_modes = listModesJSON();
DBG_OUTPUT_PORT.printf(json_modes.c_str());
DBG_OUTPUT_PORT.printf("MQTT: Get WS2812 modes.\n");
DBG_OUTPUT_PORT.printf("Error: Not implemented. Message too large for pubsubclient.");
mqtt_client.publish(mqtt_outtopic, "ERROR: Not implemented. Message too large for pubsubclient.");
//String json_modes = listModesJSON();
//DBG_OUTPUT_PORT.printf(json_modes.c_str());
mqtt_client.publish(mqtt_outtopic, json_modes.c_str());
//int res = mqtt_client.publish(mqtt_outtopic, json_modes.c_str(), json_modes.length());
//DBG_OUTPUT_PORT.printf("Result: %d / %d", res, json_modes.length());
}
// / ==> Set WS2812 mode.
if ((char)payload[0] == '/') {
handleSetWS2812FXMode(payload);
DBG_OUTPUT_PORT.printf("MQTT: Set WS2812 mode [%u]\n", payload);
DBG_OUTPUT_PORT.printf("MQTT: Set WS2812 mode [%s]\n", payload);
mqtt_client.publish(mqtt_outtopic, "OK");
}
}