| 175 | } |
| 176 | |
| 177 | void Everything::run() |
| 178 | { |
| 179 | updateSensors(); //call each st::Sensor object to refresh data |
| 180 | |
| 181 | #ifndef DISABLE_SMARTTHINGS |
| 182 | SmartThing->run(); //call the ST Shield Library to receive any data from the ST Hub |
| 183 | #endif |
| 184 | |
| 185 | #if defined(ENABLE_SERIAL) |
| 186 | readSerial(); //read data from the Arduino IDE Serial Monitor window (useful for debugging sometimes) |
| 187 | #endif |
| 188 | |
| 189 | sendStrings(); //send any pending updates to ST Cloud |
| 190 | |
| 191 | #ifndef DISABLE_REFRESH //Added new check to allow user to disable REFRESH feature - setting is in Constants.h) |
| 192 | if ((bTimersPending == 0) && ((millis() - refLastMillis) >= long(Constants::DEV_REFRESH_INTERVAL) * 1000)) //DEV_REFRESH_INTERVAL is set in Constants.h |
| 193 | { |
| 194 | refLastMillis = millis(); |
| 195 | refreshDevices(); //call each st::Device object to refresh data (this is just a safeguard to ensure the state of the Arduino and the ST Cloud stay in synch should an event be missed) |
| 196 | } |
| 197 | #endif |
| 198 | |
| 199 | if((debug) && (millis()%60000==0) && (millis()!=lastmillis)) |
| 200 | { |
| 201 | lastmillis = millis(); |
| 202 | Serial.print(F("Everything: Free Ram = ")); |
| 203 | Serial.println(freeRam()); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | bool Everything::sendSmartString(String &str) |
| 208 | { |