// Wait for a maximum amount of time - sleep if WiFi is not connected
// Wake up and try again afterwards
// TODO: either use this or just WiFi connection (below)
-// Particle.connect();
-// if (!waitFor(Particle.connected, RETRY_TIME))
-// System.sleep(SLEEP_MODE_DEEP, RETRY_SLEEP_TIME);
+ //Particle.connect();
+ //if (!waitFor(Particle.connected, RETRY_TIME))
+ // System.sleep(SLEEP_MODE_DEEP, RETRY_SLEEP_TIME);
// Connect only to WiFi
WiFi.on();
// Check if any reads failed and exit early (to try again).
if (isnan(humid) || isnan(tempF))
return;
+
+ // TODO: Update values separately to different keys
+ /*
// Humidity
// Key
sprintf(keyBuffer, "h%04x", machineId);
iValueHumid->releaseRef();
iKeyTempF->releaseRef();
iValueTempF->releaseRef();
+ */
// TODO: Collapse temperature and humidity into one key
-/* sprintf(keyBuffer, "%04x", machineId);
+ sprintf(keyBuffer, "humtemp%04x", machineId);
IoTString * iKey = new IoTString(keyBuffer);
// Do updates for the temperature
- sprintf(dataBuffer, "%0.2f%0.2f", humid, tempF);
+ sprintf(dataBuffer, "%0.2f-%0.2f", humid, tempF);
IoTString * iValue = new IoTString(dataBuffer);
t1->createNewKey(iKey, machineId);
transStatusList->add(t1->commitTransaction());
iKey->releaseRef();
- iValue->releaseRef();*/
+ iValue->releaseRef();
/*for (uint i = 0; i < transStatusList->size(); i++) {
TransactionStatus * status = transStatusList->get(i);
digitalWrite(PWRPIN, LOW);
// TODO: Profiling
- //Serial.print("Time end loop: ");
+ //Serial.print("Elapsed time: ");
//Serial.println(micros());
- //while(true) { }
+ //while(true);
+
System.sleep(SLEEP_MODE_DEEP, SLEEP_TIME);
}