 void updateStats(boolean debug)
 {
 
-  if (now() - startOfPeriod1 <= monPeriod1)
+  if (now() - startOfPeriod1 <= monPeriod1Len)
   {
     count_t1++;
   }

  for (int i = 0; i < sizeof(thermalSensor) / sizeof(DeviceAddress); i++)
  {

    tt1m[i] = tt1m[i] + sensors.getTempC(thermalSensor[i]);
    tt1m_avg[i] = round(tt1m[i] / count_t1);

    tt2m[i] = tt2m[i] + sensors.getTempC(thermalSensor[i]);
    tt2m_avg[i] = round(tt2m[i] / count_t2);

    tt3m[i] = tt3m[i] + sensors.getTempC(thermalSensor[i]);
    tt3m_avg[i] = round(tt3m[i] / count_t3);

    if (debug) {
      Serial.print("TEMP"); Serial.print(i); Serial.print(":");

int last_call_hour;
int last_message_hour;

int monPeriod1Len = 600;                              // 10 minutes
float dataPeriod1[4][600];

int monPeriod2Len = 36000;                             // 60 minutes
float dataPeriod2[4][60];

int monPeriod3Len = 21600;                            // 12 hours 
float dataPeriod3[4][36];

long count_t1,        count_t2,       count_t3;
long startOfPeriod1,  startOfPeriod2, startOfPeriod3;


float gsm_signal;
float tt1m[4],      tt2m[4],      tt3m[4];
float tt1mLast[4],  tt2mLast[4],  tt3mLast[4];
float tt1mTrend[4], tt2mTrend[4], tt3mTrend[4];
int   tt1m_avg[4],  tt2m_avg[4],  tt3m_avg[4];


boolean call_done;
boolean message_done;
