 }
 
 // compose alarm message for SMS sending
-String makeMessage(int deviceid)
-{
-  int timeToDeath =  makeForecast(deviceid);
+String makeMessage(int sensor)
+{
+  int timeToDeath =  makeForecast(sensor, false);
   int minToDeath = timeToDeath / 60;
   int secToDeath = timeToDeath - minToDeath * 60;
 



// forecast in seconds elasped time to DestroyAlarmTemp[]
int makeForecast(int deviceid)
{
  float forecastSeconds ;
  float delta_temp;
  float cur_temp = sensors.getTempC(thermalSensor[deviceid]);
  // Serial.print("[mF] Cur_temp:"); Serial.println(cur_temp);

  if (tt1mTrend[deviceid] < 0 )
  { //recovery time calculation
    delta_temp = cur_temp - HighAlarmTemp[deviceid];
    //Serial.print("[mF] Trend < 0. delta_temp:"); Serial.println(delta_temp);

  }

  if (tt1mTrend[deviceid] > 0 )
  { //Destroy time calculation
    delta_temp = DestroyAlarmTemp[deviceid] - cur_temp;
    // Serial.print("[mF] Trend > 0. delta_temp:"); Serial.println(delta_temp);
  }

  forecastSeconds = delta_temp / tt1mTrend[deviceid];
  //Serial.print(delta_temp); Serial.print("/"); Serial.print(tt1mTrend[deviceid]); Serial.print("="); Serial.println(forecastSeconds);
  return int(round(forecastSeconds));
}

// proceed a call just for make a loud sound in the middle of the "do not distrub" mode on smartphone
boolean makecall(String number)

int last_call_hour;
int last_message_hour;

int monPeriodLen[3] = {600, 3600, 21600};                              // 10 minutes // 60 minutes // 12 hours


float gsm_signal;
float tempSumm[3][4];
float tempTrend[3][4];
int   tempAvgCur[3][4];
int   tempAvgPrev[3][4];
int   measuresCount[3];
int   measuresPerPeriod[3];
long  startOfPeriod[3];


boolean call_done;
