Dreamforce 2013 MiniHack Thermostat Challenge - remotes

Dependencies:   C12832_lcd EthernetInterface-ansond-patched HTTPClient-thermostat-remotes LM75B MMA7660 SocketIO WebSocketClient-ThermostatDemo mbed-rtos mbed picojson

Fork of df-2013-minihack-thermostat-complete by MBED_DEMOS

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Tue Nov 05 22:10:30 2013 +0000
Parent:
0:26c48388f725
Child:
2:340477adb161
Commit message:
updates

Changed in this revision

Thermostat-BaseUtils.h Show annotated file Show diff for this revision Revisions of this file
Thermostat.cpp Show annotated file Show diff for this revision Revisions of this file
Thermostat.h Show annotated file Show diff for this revision Revisions of this file
--- a/Thermostat-BaseUtils.h	Tue Nov 05 21:31:01 2013 +0000
+++ b/Thermostat-BaseUtils.h	Tue Nov 05 22:10:30 2013 +0000
@@ -65,4 +65,15 @@
     this->logMessage(true);
 }
 
+// display text message output
+void Thermostat::displayTextMessage(const char *format, ...) {
+    memset(this->m_display_message,'\0',MAX_MESSAGE_LENGTH+1);
+    va_list args;
+    va_start(args, format);
+    vsprintf(this->m_display_message, format, args);
+    va_end(args);
+    this->logMessage(true);
+    wait_ms(3000);              // add wait state so that we can see the message!
+}
+
 #endif // THERMOSTAT_BASEUTILS_H_
--- a/Thermostat.cpp	Tue Nov 05 21:31:01 2013 +0000
+++ b/Thermostat.cpp	Tue Nov 05 22:10:30 2013 +0000
@@ -200,16 +200,15 @@
             if ((*iter).get("led3") != NULL) led3.write(this->translateLEDStatus((*iter).get("led3").get<string>().c_str(),(int)led3));
             if ((*iter).get("led4") != NULL) led4.write(this->translateLEDStatus((*iter).get("led4").get<string>().c_str(),(int)led4));
             if ((*iter).get("reset") != NULL) this->resetDeviceStatus();
-            if ((*iter).get("text") != NULL) this->display((*iter).get("text").get<string>().c_str());
             if ((*iter).get("blink") != NULL) this->blinkAllLEDs();
             
             //
             // 2013 DreamForce MiniHack - add code to look for a "text" message - send its contents to the LCD panel
-            // using the this->display(char *) method
+            // using the this->displayTextMessage(char *) method
             //
             // Answer:
             //
-            if ((*iter).get("text") != NULL) this->display((*iter).get("text").get<string>().c_str()); 
+            if ((*iter).get("text") != NULL) this->displayTextMessage((*iter).get("text").get<string>().c_str()); 
         }
    }
 }
--- a/Thermostat.h	Tue Nov 05 21:31:01 2013 +0000
+++ b/Thermostat.h	Tue Nov 05 22:10:30 2013 +0000
@@ -84,6 +84,7 @@
         void logMessage(bool do_lcd);
         void display(const char *format, ...);
         void display_lcd(const char *format, ...);
+        void displayTextMessage(const char *format, ...);
         
         // Stubs
         void updateCoordinates();