Dreamforce 2013 MiniHack Thermostat Challenge
Dependencies: C12832_lcd EthernetInterface-ansond-patched HTTPClient-thermostat-remotes LM75B MMA7660 SocketIO WebSocketClient-ThermostatDemo mbed-rtos mbed picojson
Diff: Thermostat.cpp
- Revision:
- 2:e609c702e79e
- Parent:
- 1:4c7d9aee324f
--- a/Thermostat.cpp Tue Nov 05 22:12:13 2013 +0000 +++ b/Thermostat.cpp Sun Nov 10 16:28:40 2013 +0000 @@ -360,6 +360,29 @@ // announce our position this->updateCoordinates(); + + // if not connected... reconnect + if (!socketio.is_connected()){ + // announce + this->display("Re-connecting..."); + this->display_lcd("Re-connecting..."); + + // re-connect + if (this->connectWebSocketService()) { + // announce + this->display("Reconnect success"); + this->display_lcd("Reconnect: SUCCESS"); + this->turnRGBLEDGreen(); + this->resetAllLEDs(); + } + else { + // announce + this->display("Reconnect failure"); + this->display_lcd("Reconnect: FAILED"); + this->gracefullyDisconnect(); + this->turnRGBLEDRed(); + } + } // check and react to the joystick button press if (joystick_pressed) {