Removed some unused code

This commit is contained in:
Tobias Blum 2018-06-20 00:23:50 +02:00
parent 1b79fa0874
commit 4bdde7daa0
4 changed files with 3 additions and 36 deletions

View file

@ -492,12 +492,6 @@ void setup() {
}, handleFileUpload);
//get heap status, analog input value and all GPIO statuses in one json call
server.on("/esp_status", HTTP_GET, []() {
//String json = "{";
//json += "\"heap\":" + String(ESP.getFreeHeap());
//// json += ", \"analog\":" + String(analogRead(A0));
//// json += ", \"gpio\":" + String((uint32_t)(((GPI | GPO) & 0xFFFF) | ((GP16I & 0x01) << 16)));
//json += "}";
DynamicJsonDocument jsonBuffer(JSON_OBJECT_SIZE(9));
JsonObject& json = jsonBuffer.to<JsonObject>();
@ -527,13 +521,11 @@ void setup() {
#else
json["home_assistant"] = "OFF";
#endif
//char buffer[json.measureLength() + 1];
//json.printTo(buffer, sizeof(buffer));
String json_str;
serializeJson(json, json_str);
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "application/json", json_str);
//json_str = String();
});

View file

@ -80,7 +80,6 @@ uint32_t autoParams[][4] = { // color, speed, mode, duration (seconds)
const char* mqtt_clientid = HOSTNAME; // MQTT ClientID
#endif
char mqtt_host[64] = "";
char mqtt_port[6] = "";
char mqtt_user[32] = "";

View file

@ -92,10 +92,6 @@ void handleSetAllMode(uint8_t * mypayload) {
main_color.green = ((rgb >> 8) & 0xFF);
main_color.blue = ((rgb >> 0) & 0xFF);
// for (int i = 0; i < strip.numPixels(); i++) {
// strip.setPixelColor(i, main_color.red, main_color.green, main_color.blue);
// }
// strip.show();
DBG_OUTPUT_PORT.printf("WS: Set all leds to main color: [%u] [%u] [%u]\n", main_color.red, main_color.green, main_color.blue);
#ifdef ENABLE_LEGACY_ANIMATIONS
exit_func = true;
@ -279,15 +275,8 @@ void handleSetWS2812FXMode(uint8_t * mypayload) {
}
String listStatusJSON(void) {
//char json[255];
//char modeName[30];
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);
const size_t bufferSize = JSON_ARRAY_SIZE(3) + JSON_OBJECT_SIZE(6);
DynamicJsonDocument jsonBuffer(bufferSize);
JsonObject& root = jsonBuffer.to<JsonObject>();
@ -301,9 +290,6 @@ String listStatusJSON(void) {
color.add(main_color.green);
color.add(main_color.blue);
// char* json = (char*) malloc(root.measureLength() + 1);
// root.printTo(json, sizeof(json));
String json;
serializeJson(root, json);
@ -316,17 +302,6 @@ void getStatusJSON() {
}
String listModesJSON(void) {
// String modes = "[";
// for (uint8_t i = 0; i < strip.getModeCount(); i++) {
// modes += "{\"mode\":";
// modes += i;
// modes += ", \"name\":\"";
// modes += strip.getModeName(i);
// modes += "\"},";
// }
// modes += "{}]";
// return modes;
const size_t bufferSize = JSON_ARRAY_SIZE(strip.getModeCount()+1) + strip.getModeCount()*JSON_OBJECT_SIZE(2);
DynamicJsonDocument jsonBuffer(bufferSize);
JsonArray& json = jsonBuffer.to<JsonArray>();
@ -354,7 +329,7 @@ void handleMinimalUpload() {
char temp[1500];
snprintf ( temp, 1500,
"<!DOCTYPE html>\
"<!DOCTYPE html>\
<html>\
<head>\
<title>ESP8266 Upload</title>\

View file

@ -9,4 +9,5 @@
*
* 17 Jun 2018 v 2.1.2
* - Upgrade to ArduinoJSON 6.xx from ArduinoJSON 5.xx
* - Added example for static IP
*/