void display_print_splash_screen(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
  ucg.clearScreen();
  ucg.setColor(153, 203, 255);    // Celeste
  ucg.setFont(ucg_font_fub35_hr);
  ucg.setPrintPos(50, 100);
  ucg.print("SST WiFi");
  ucg.setFont(ucg_font_fub14_hr);
  ucg.setPrintPos(30, 130);
  ucg.print("Souliss Smart Thermostat");
  ucg.setPrintPos(135, 180);
  ucg.print(VERSION);
  delay(2000);
  ucg.clearScreen();
}
void display_layout2_HomeScreen(Ucglib_ILI9341_18x240x320_HWSPI ucg, float temperature, float humidity, float setpoint) {
  SERIAL_OUT.println("Refresh HOME Screen "); 
  //uso flag_onetime per visualizzare almeno una volta la schermata, anche in assenza di variazione di temperatura
  //flag_onetime_HomeScreen è rimessa a false display_layout1_setpointPage
  if (arrotonda2(temperature) != arrotonda2(temp2_prec) || (arrotonda2(setpoint) != arrotonda2(setpoint2_prec))) {
    if (!flag_onetime2_HomeScreen) {
      ucg.clearScreen();
    }
    //HOMESCREEN
    int temp = (int) temperature;
    int diff = dopovirgola2(temperature);
    //Temperatura
    //ucg.setColor(111, 0, 255);         // Blu Elettrico
    //ucg.setColor(0, 255, 255, 255);    // Bianco
    ucg.setColor(102, 255, 0);           // Verde Chiaro
    ucg.setFontMode(UCG_FONT_MODE_SOLID);
    ucg.setPrintPos(-4, 80);
    ucg.setScale2x2();
    ucg.setFont(ucg_font_inb46_mr);
    ucg.print(temp);
    ucg.undoScale();
    ucg.setFont(ucg_font_inb46_mr);
    ucg.setPrintPos(147, 160);
    ucg.print(diff);
    ucg.drawDisc(143, 156, 3, UCG_DRAW_ALL);
    ucg.drawDisc(187, 116, 3, UCG_DRAW_ALL);
    SERIAL_OUT.print("Refresh Temperature to: "); SERIAL_OUT.print(temp); SERIAL_OUT.print("."); SERIAL_OUT.println(diff);

    //Umidità
    ucg.setColor(30, 144, 255);    // Blu Dodger
    ucg.setFontMode(UCG_FONT_MODE_SOLID);
    ucg.setPrintPos(24, 209);
    ucg.setFont(ucg_font_inb21_mr);
    ucg.print("uR"); ucg.print(humidity, 1);
    ucg.setFont(ucg_font_9x18_mf);
    ucg.setPrintPos(135, 209);
    ucg.print("%");
    //ucg.setFont(ucg_font_profont11_mr);
    //ucg.setPrintPos(60,190);
    ucg.undoScale();
    //ucg.print("UMIDITA'");
    SERIAL_OUT.print("Refresh Humidity to: "); SERIAL_OUT.println(humidity,1); 

    temp2_prec = temp;
    setpoint2_prec = setpoint;
    flag_onetime2_HomeScreen = true;
    SERIAL_OUT.println("Refresh HOME Screen OK ");
  }
}
//compone la pagina dedicata al setpoint
void display_layout1_setpointPage(Ucglib_ILI9341_18x240x320_HWSPI ucg, float setpoint, float temp, float hum, boolean bSystemOn) {
  SERIAL_OUT.println("display_setpointPage");

  if (!flag_onetime_clear_SetpointPage) {
    //viene ripristinata in homepage
    flag_onetime_clear_SetpointPage = true;
    ucg.clearScreen();
  }
  flag_onetime_HomeScreen = false;

  display_layout1_print_setpoint(ucg, setpoint);
  display_layout1_print_B3(ucg, TEMP_TEXT, temp) ;

  if (bSystemOn)
    display_layout1_print_B4_Hum(ucg, HUM_TEXT, hum) ;
  else
    display_layout1_print_B4_SystemOff(ucg, SYSTEM_OFF_TEXT) ;
}
void display_layout1_HomeScreen(Ucglib_ILI9341_18x240x320_HWSPI ucg, float temp, float hum, float setpoint, boolean bSystemOn, boolean bChildLock) {
  //ripristina la variabile bool. Viene fatto il clear della pagina ogni volta soltato una volta
  setOnetime_clear_SetpointPage();
  //uso flag_onetime per visualizzare almeno una volta la schermata, anche in assenza di variazione di temperatura
  //flag_onetime_HomeScreen è rimessa a false display_layout1_setpointPage
  //flag_initScreen è impostato true all'uscita dal menu
  if ( getUIChanged() || arrotonda(temp) != arrotonda(temp_prec) || (arrotonda(setpoint) != arrotonda(setpoint_prec))) {
    if (!flag_onetime_HomeScreen) {
      ucg.clearScreen();
      resetUIChanged();
      flag_onetime_HomeScreen = true;
    }


    ucg.setFontMode(UCG_FONT_MODE_SOLID);

    display_layout1_printBigChar(ucg, temp);

    temp_prec = temp;
    setpoint_prec = setpoint;

    if (!bChildLock) {
      display_layout1_print_B3(ucg, SETPOINT_TEXT, setpoint);
    } else
    {
      display_layout1_print_B3_ChildLock(ucg, CHILDLOCK_TEXT);
    }

    if (bSystemOn) {
      display_layout1_print_B4_Hum(ucg, HUM_TEXT, hum) ;
    }
    else
    {
      display_layout1_print_B4_SystemOff(ucg, SYSTEM_OFF_TEXT);
    }
    resetUIChanged();
  }
  //la funzione display_layout1_print_B1 aggiorna soltanto se l'orario è cambiato
  display_layout1_print_B1_datetime(ucg);
}