From b384979b062804ae0bb004e1b26c6287685ddc0f Mon Sep 17 00:00:00 2001 From: mvdbro Date: Sat, 12 Aug 2017 09:59:42 +0200 Subject: [PATCH] Cleanup and RAM savings --- src/Misc.ino | 7 +++---- src/WebServer.ino | 42 +++++++++++++++++------------------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/src/Misc.ino b/src/Misc.ino index 64f4cf0..d074307 100644 --- a/src/Misc.ino +++ b/src/Misc.ino @@ -418,12 +418,11 @@ void fileSystemCheck() { String log = F("SD Mount successful"); Serial.println(log); - //ExecuteCommand(0,"sdcard"); if (!SD.exists("config.txt")) { String log = F("Creating config.txt"); Serial.println(log); - File f = SD.open("config.txt", FILE_WRITE); + File f = SD.open(F("config.txt"), FILE_WRITE); if (f) { for (unsigned long x = 0; x < 32768; x++) @@ -432,14 +431,14 @@ void fileSystemCheck() } log = F("Ready creating config.txt"); Serial.println(log); - f = SD.open("security.txt", FILE_WRITE); + f = SD.open(F("security.txt"), FILE_WRITE); if (f) { for (int x = 0; x < 512; x++) f.write((byte)0); f.close(); } - f = SD.open("rules.txt", FILE_WRITE); + f = SD.open(F("rules.txt"), FILE_WRITE); f.close(); } } diff --git a/src/WebServer.ino b/src/WebServer.ino index 9a2b6d9..35b3b1b 100644 --- a/src/WebServer.ino +++ b/src/WebServer.ino @@ -329,7 +329,6 @@ void handle_root(EthernetClient client, String &post) { if (Nodes[x].ip[0] != 0) { char url[80]; -// sprintf_P(url, PSTR("%u.%u.%u.%u"), Nodes[x].ip[0], Nodes[x].ip[1], Nodes[x].ip[2], Nodes[x].ip[3], Nodes[x].ip[0], Nodes[x].ip[1], Nodes[x].ip[2], Nodes[x].ip[3]); sprintf_P(url, PSTR("%u.%u.%u.%u"), Nodes[x].ip[0], Nodes[x].ip[1], Nodes[x].ip[2], Nodes[x].ip[3], Nodes[x].ip[0], Nodes[x].ip[1], Nodes[x].ip[2], Nodes[x].ip[3]); reply += F("Unit "); reply += x; @@ -512,7 +511,6 @@ void handle_config(EthernetClient client, String &post) { reply += F("'>"); reply += F(""); addFooter(reply); - // debugRAM(3,reply.length()); client.print(reply); } @@ -715,8 +713,6 @@ void handle_devices(EthernetClient client, String &post) { update_device(); - // debugRAM(2,0); - struct EventStruct TempEvent; String taskindex = WebServerarg(F("index")); @@ -804,10 +800,8 @@ void handle_devices(EthernetClient client, String &post) { { if (Device[DeviceIndex].Type == DEVICE_TYPE_I2C) { - reply += F("GPIO-"); - //reply += Settings.Pin_i2c_sda; // todo - reply += F("
GPIO-"); - //reply += Settings.Pin_i2c_scl; // todo + reply += F("GPIO-20"); + reply += F("
GPIO-21"); } if (Device[DeviceIndex].Type == DEVICE_TYPE_ANALOG) { @@ -1225,9 +1219,7 @@ void addDeviceSelect(String& str, String name, int choice) str += F("