 
   for (int i = 0; i < sizeof(thermalSensor) / sizeof(DeviceAddress); i++)
   {
-  //  Serial.println(getData(thermalSensor[i]));
-
-  }
-  
-  execRemoteCommand();
+    Serial.println(getData(thermalSensor[i]));
+    Serial.print("TREND "); Serial.print(i); Serial.print(":"); Serial.println(tempTrend[0][i]);
+    makeForecast(i, true);
+  }
+
+  //execRemoteCommand();
   //printAlarms(t0); // Вывод пороговых значений на экран
-  delay(30000);  // задержка проверки
+  delay(cycleDelay);  // задержка проверки
   //getNetworkStatus(false); Serial.println(toProgressBar(2, 30, gsm_signal)); // Network signal quality print
 }

int last_call_hour;
int last_message_hour;

int monPeriod1Len = 600;                              // 10 minutes
int monPeriod2Len = 36000;                             // 60 minutes
int monPeriod3Len = 21600;                            // 12 hours


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;

void updateStats(boolean debug)
{

  for (int period = 0; period < 3; period++)
  {
    for (int sensor = 0; sensor < sizeof(thermalSensor) / sizeof(DeviceAddress); sensor++)
    {
      if (now() - startOfPeriod[period] <= monPeriodLen[period])
      {
        measuresCount[period]++;
        tempSumm[period][sensor] = tempSumm[period][sensor] + sensors.getTempC(thermalSensor[sensor]); // Calcluating summ of temperature vaules for average calculation
      }
      else
      {
        startOfPeriod[period] = now();
        tempAvgPrev[period][sensor] = tempAvgCur[period][sensor];

        tempAvgCur[period][sensor] = round(tempSumm[period][sensor] / measuresCount[period]); // Calculating average value for period 1;
        tempTrend[period][sensor] = (tempAvgCur[period][sensor] - tempAvgPrev[period][sensor]) / measuresCount[period];

        tempSumm[period][sensor] = 0;
        measuresCount[period] = 0;
        if (debug)
        {
          Serial.print("[DBG] TREND "); Serial.print(sensor); Serial.print(":"); Serial.println(tempTrend[period][sensor]);
          makeForecast(sensor, true);
        }
      }
      measuresCount[period] = 1;


    }
  }
  if (debug) {

    for (int sensor = 0; sensor < sizeof(thermalSensor) / sizeof(DeviceAddress); sensor++)
    {
      Serial.print("TEMP"); Serial.print(sensor); Serial.print(":");
      Serial.print(sensors.getTempC(thermalSensor[sensor]));
      for (int period = 0; period < 3; period++)
      {
        Serial.print("/"); Serial.print(tempAvgCur[period][sensor]);
      }
      Serial.println();
    }
  }
