emma controller code in production board v1

Dependencies:   ADE7758_v1 Crypto DHT11 MQTT MbedJSONValueEmma SDFileSystem TFT_ILI9341 SWSPI SetRTC TFT_fonts Touch W5500Interface mbed-rtos mbed-src SoftSerial

Fork of emma_controller_energy by Emma

Revision:
28:7561035e3df5
Parent:
27:562a95c120cc
Child:
29:4d94a03d38e0
--- a/emmaCode.cpp	Wed Jul 29 14:09:47 2015 +0000
+++ b/emmaCode.cpp	Fri Jul 31 06:16:46 2015 +0000
@@ -277,6 +277,10 @@
     DBG.printf("proxyPORT:%s\r\n",proxyPORT.c_str());
     proxyAUTH = readSetting("proxyAUTH");
     DBG.printf("proxyAUTH:%s\r\n",proxyAUTH.c_str());
+    wifiSSID = readSetting("wifiSSID");
+    DBG.printf("wifiSSID:%s\r\n",wifiSSID.c_str());
+    wifiPASS = readSetting("wifiPASS");
+    DBG.printf("wifiPASS:%s\r\n",wifiPASS.c_str());
     
     //check proxy
     if(!proxySERVER.empty() && !proxyPORT.empty() && !proxyAUTH.empty()) {
@@ -2491,14 +2495,17 @@
     TFT.printf("EMMA: setup wifi");
     wait(1);
     esp.wifiCb.attach(&wifiCb);
-    esp.wifiConnect("Tritronik Mobile","Tri12@11");
+    //esp.wifiConnect("Tritronik Mobile","Tri12@11");
+    esp.wifiConnect(wifiSSID.c_str(),wifiPASS.c_str());
     DBG.printf("EMMA: system started\r\n");
     TFT.locate(0,20);
     TFT.printf("EMMA: system started");
     t.start();
-    while(t.read_ms() < 5000);
+    while(t.read() < 20);
     t.stop();
     t.reset();
+    TFT.locate(0,20);
+    TFT.printf("                                        ");
     
     if(wifiAvailable) {
         _ESP.printf("MODE=B");
@@ -2517,7 +2524,7 @@
         }
         wait(2);
         t.start();
-        while(!esp.ready() && t.read_ms() < 5000);
+        while(!esp.ready() && t.read() < 20);
         t.stop();
         t.reset();
         if(rest.begin(connHost.c_str(),connPort,false)) {