 #include "string.h"
+#include "LowPower.h"
 
 #define TRUE  1
 #define FALSE 0

  return STATUS_OK;
}

int dat_liveNotif() {
  /* If the current time since our last notif is greater than
    DEF_NOTIF_INTERVAL, then send out a reading */
  if ( (_lLastNotif + DEF_NOTIF_INTERVAL) < millis() ) {
    char aBaseStr[32];
    char aValStr[10];
    
    memset(aBaseStr, 0, sizeof(aBaseStr));
    memset(aValStr, 0, sizeof(aValStr));

//    float dVal = 14.0 * (random(20, 80) / 100.0);

    int iAdcVal = analogRead(PH_SENSOR_PIN);
    float dVoltage = (iAdcVal * 5.0) / 1024;
    float dVal = dVoltage;
    //float dVal = dVoltage * 2.2570 + 2.6675;

    dtostrf(dVal, 5, 2, aValStr);
    
    strcpy(aBaseStr, " RDATA:pH=");
    strcat(aBaseStr, aValStr);
    strcat(aBaseStr, ";");
    
    Serial.println(aBaseStr);
    
    _lLastNotif = millis();
  }


  Serial.begin(115200);

  pinMode(DEPLOY_STATUS_PIN, OUTPUT);
  digitalWrite(DEPLOY_STATUS_PIN, LOW);

  pinMode(13, OUTPUT);

  _lStartTime = millis();
  sys_setState(INACTIVE);
  //sys_setState(IDLE);
  return;
}

void loop() {
  if (_bFirstActivate) {
    digitalWrite(DEPLOY_STATUS_PIN, HIGH);
    delay(50);
    digitalWrite(DEPLOY_STATUS_PIN, LOW);
    delay(50);
    digitalWrite(DEPLOY_STATUS_PIN, HIGH);
    delay(50);
    digitalWrite(DEPLOY_STATUS_PIN, LOW);
    _bFirstActivate = FALSE;
  }
  
  _iRecvIdx = 0;
  memset(_aRecvBuf, 0, sizeof(_aRecvBuf));

