 static byte checkbutton(){
   return ((LOW == newButtonStateRed) && (HIGH == lastButtonStateRed));
 }
-void loop()
-{
+
+void loop() {
   newButtonStateRed = digitalRead(buttRed);
   newButtonStateEnc = digitalRead(buttEnc);
   int status = tc.read();

  if (POWER == mode){
    Output = power;
  }
  long now = millis();
  if(now - windowStartTime>WindowSize)
  { //time to shift the Relay Window
    windowStartTime += WindowSize;
  }

  if(now - refreshTime>refreshPeriod){
    refreshScr();
    refreshTime +=refreshPeriod;
  }

//TODO: use only descrete output 10ms intervals
  if(Output < now - windowStartTime) digitalWrite(ssr,LOW);
  else digitalWrite(ssr,HIGH);

  while (Serial.available()) {
    message.process(Serial.read());
  }
}


char mode_str[4][6] = {"IDLE ", "POWER", "POINT", "PROGR"};

void setup() {
  Serial.begin(115200);
  lcd.init();
  lcd.backlight();
