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 ");
  }
}
void display_layout2_print_datetime(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
 if (getClock()){
  SERIAL_OUT.println("Refresh Clock "); 
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosTop();
  //NTP
  String dateAndTime = "";
  if (now() != prev2Display) { //update the display only if time has changed
    prev2Display = now();
    //NTP
    ////////////////////////////////////////////////////////////////////////////
    String Time = "";
    String Date = "";
    Time = digitalClockDisplay_simple();
    Date = digitalDataDisplay();
    //ucg.setFont(ucg_font_inr19_mf);
    ucg.setFont(ucg_font_helvB14_hf);
    ucg.setColor(0, 255, 255, 255);       // Bianco
    ucg.setPrintPos(160, 4);
    ucg.print(Date);
    //ucg.setFont(ucg_font_inb21_mr);
    ucg.setFont(ucg_font_helvB18_hf);
    ucg.setPrintPos(260, 4);
    ucg.print(Time);
    SERIAL_OUT.print("New Clock: "); SERIAL_OUT.println(Time);
  }
 }
}
void display_HomeScreen(Ucglib_ILI9341_18x240x320_HWSPI ucg, float temp, float setpoint) {

  //la funzione display_print_B1 aggiorna soltanto se l'orario è cambiato
  display_print_B1(ucg);

  //uso flag_onetime per visualizzare almeno una volta la schermata, anche in assenza di variazione di temperatura
  //flag_onetime_HomeScreen è rimessa a false display_setpointPage
  if (!flag_onetime_HomeScreen || arrotonda(temp) != arrotonda(temp_prec) || (arrotonda(setpoint) != arrotonda(setpoint_prec))) {


    ucg.setColor(102, 255, 0);    // Verde Chiaro
    ucg.setFontMode(UCG_FONT_MODE_SOLID);
   // ucg.setFont(ucg_font_inb21_mr);
    ucg.setPrintPos(15, 80);
   // ucg.setScale2x2();
    //ucg.setFont(ucg_font_logisoso38_tf);
    ucg.setFont(ucg_font_inb38_mr);
    ucg.print(temp, 1);
    //ucg.undoScale();
    ucg.setFont(ucg_font_inb16_mr);
    ucg.print("o");

    temp_prec = temp;
    setpoint_prec = setpoint;
    flag_onetime_HomeScreen = true;
    display_print_B3(ucg, SETPOINT_TEXT, setpoint);
    //     display_print_B1(ucg);
  }
}
void display_layout1_print_B4_SystemOff(Ucglib_ILI9341_18x240x320_HWSPI ucg, String text) {
  SERIAL_OUT.println("display_print_B4 [SystemOff]");
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosBaseline();
  setRosso(&ucg);
  ucg.setPrintPos(5, ucg.getHeight() - 5);
  ucg.print(text);
}
void display_print_B3(Ucglib_ILI9341_18x240x320_HWSPI ucg, String text, float temp) {

  ucg.setPrintPos(20, 220);
  ucg.setColor(102, 255, 0);    // Verde Chiaro
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(ucg_font_inb16_mr);
  ucg.print(text);
  ucg.print(temp, 1);
}
void display_print_splash_waiting_connection_gateway(Ucglib_ILI9341_18x240x320_HWSPI ucg) {

  ucg.setColor(0, 255, 255, 255);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(ucg_font_inb21_mr);
  ucg.setPrintPos(4, 28);
  ucg.println(SPLASH_GW_LINE1);
  ucg.println(SPLASH_GW_LINE2);
  ucg.print("IP ");
  ucg.print(WiFi.localIP());
}
void display_print_splash_waiting_need_configuration(Ucglib_ILI9341_18x240x320_HWSPI ucg) {

  ucg.setColor(0, 255, 255, 255);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(ucg_font_inb21_mr);
  ucg.setPrintPos(4, 28);

  ucg.println(SPLASH_NEED_CONFIGURATION);
  ucg.print("IP ");
  ucg.print(WiFi.softAPIP());
}
void display_layout1_print_B4_Hum(Ucglib_ILI9341_18x240x320_HWSPI ucg, String text, float temp) {
  SERIAL_OUT.println("display_print_B4 [Humidity]");
  SERIAL_OUT.println("display_print_B4 [Humidity]");
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosBaseline();
  ucg.setPrintPos(5, ucg.getHeight() - 5);
  setBlu(&ucg);
  ucg.print(text);
  ucg.print(temp, 1);
  ucg.print("%");
}
void display_layout1_print_B3_ChildLock(Ucglib_ILI9341_18x240x320_HWSPI ucg, String text) {
  SERIAL_OUT.println("display_print_B4 [ChildClocked]");
  SERIAL_OUT.println("display_print_B3");
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosBaseline();
  String str = text;
  const char * c = str.c_str();
  setRosso(&ucg);
  ucg.setPrintPos(ucg.getWidth() - ucg.getStrWidth(c) - 5, ucg.getHeight() - 5);
  ucg.print(text);
}
Ejemplo n.º 10
0
void display_print_splash_waiting_connection_peer(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
  SERIAL_OUT.println("display_print_splash_waiting_connection_peer");
  ucg.setColor(0, 255, 255, 255);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SPLASH_SCREEN);
  ucg.setPrintPos(4, 28);
  ucg.println(SPLASH_PEER_LINE1);
  ucg.setPrintPos(4, 58);
  ucg.println(SPLASH_PEER_LINE2);
  ucg.setPrintPos(4, 88);
  ucg.print("IP ");
  ucg.print(WiFi.localIP());
}
void display_layout2_Setpoint(Ucglib_ILI9341_18x240x320_HWSPI ucg, float setpoint, boolean bSystemOn, boolean bChildLock) {
  
  
  if (bSystemOn){

      if (!bChildLock) {
    
            if(setpoint!=oldsetpoint){
             // SERIAL_OUT.print("Refresh Setpoint ");
              ucg.setColor(0, 255, 255, 255);     // Bianco
              ucg.setFontMode(UCG_FONT_MODE_SOLID);
              ucg.setPrintPos(25, 52);
              ucg.setFont(ucg_font_inb21_mr);
              ucg.print("Sp"); ucg.print(setpoint, 1);
              ucg.setFont(ucg_font_profont11_mr);
              ucg.setPrintPos(135, 36);
              ucg.print("o");
           //   SERIAL_OUT.print("new setpoint: "); SERIAL_OUT.print(setpoint);SERIAL_OUT.print("  old setpoint: "); SERIAL_OUT.println(oldsetpoint);
              oldsetpoint=setpoint;
              }
            }else{
          
            ucg.setColor(255, 0, 0);            // Rosso
            ucg.setFontMode(UCG_FONT_MODE_SOLID);
            ucg.setPrintPos(30, 52);
            ucg.setFont(ucg_font_inb21_mr);
            ucg.print(CHILDLOCK_TEXT); //necessario refresh dopo....
            }
      }
      else{
       //  SERIAL_OUT.print("Refresh Setpoint system OFF");
       ucg.setColor(255, 0, 0);            // Rosso
            ucg.setFontMode(UCG_FONT_MODE_SOLID);
            ucg.setPrintPos(30, 52);
            ucg.setFont(ucg_font_inb21_mr);
            ucg.print(SYSTEM_OFF_TEXT_LAYOUT2);  
      }
    
  }  
//Stampa l'orologio. La zona B1 è quella in alto a sinistra
void display_print_B1(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
  //NTP
  String dateAndTime = "";
  if (now() != prevDisplay) { //update the display only if time has changed
    prevDisplay = now();

    dateAndTime = digitalClockDisplay();
    ucg.setPrintPos(10, 20);
    ucg.setColor(0, 255, 255, 255);    // Bianco
    ucg.setFontMode(UCG_FONT_MODE_SOLID);
    ucg.setFont(ucg_font_inb16_mr);
    display_print_DateTime(ucg, dateAndTime);
  }
}
Ejemplo n.º 13
0
void display_print_splash_connection_to_home_wifi(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
  SERIAL_OUT.println("display_print_splash_connection_to_home_wifi");
  setBianco(&ucg);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SPLASH_SCREEN);
  ucg.setPrintPos(4, 28);
  ucg.println(SPLASH_SSID_LINE1);
  ucg.setPrintPos(4, 58);
  ucg.print("WiFi SSID: ");
  ucg.setPrintPos(4, 88);
  ucg.print(WiFi_SSID);
  ucg.setPrintPos(4, 118);
  ucg.print("IP ");
  ucg.print(WiFi.localIP());
}
Ejemplo n.º 14
0
void display_print_splash_waiting_need_configuration(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
  SERIAL_OUT.println("display_print_splash_waiting_need_configuration");
  ucg.setColor(0, 255, 255, 255);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SPLASH_SCREEN);
  ucg.setPrintPos(4, 28);
  ucg.println(SPLASH_NEED_CONF_LINE1);
  ucg.setPrintPos(4, 58);
  ucg.println(SPLASH_NEED_CONF_LINE2);
  ucg.setPrintPos(4, 88);
  ucg.println(SPLASH_NEED_CONF_LINE3);
  ucg.setPrintPos(4, 118);
  ucg.print("IP ");
  ucg.print(WiFi.softAPIP());
}
Ejemplo n.º 15
0
void display_layout1_print_B3(Ucglib_ILI9341_18x240x320_HWSPI ucg, String text, float temp) {
  SERIAL_OUT.println("display_print_B3");
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosBaseline();
  String str = text + "00.00";
  const char * c = str.c_str();

  ucg.setColor(102, 255, 0);    // Verde Chiaro
  ucg.setPrintPos(ucg.getWidth() - ucg.getStrWidth(c) - 5, ucg.getHeight() - 5);
  ucg.print(text);
  ucg.print(temp, 1);
  ucg.setFont(ucg_font_inb21_mr);
  ucg.print("°");
}
Ejemplo n.º 16
0
//Stampa l'orologio. La zona B1 è quella in alto a sinistra
void display_layout1_print_B1_datetime(Ucglib_ILI9341_18x240x320_HWSPI ucg) {

  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosTop();
  //NTP
  String dateAndTime = "";
  if (now() != prevDisplay) { //update the display only if time has changed
    prevDisplay = now();
    ucg.setColor(0, 255, 255, 255);    // Bianco
    dateAndTime = digitalClockDisplay();
    ucg.setPrintPos(5, 5);
    display_layout1_print_DateTime(ucg, dateAndTime);
  }
}
//Stampa soltanto il setpoint grande al centro del display
void display_print_setpoint(Ucglib_ILI9341_18x240x320_HWSPI ucg, float setpoint) {

  ucg.setColor(0, 255, 255, 255);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);

  ucg.setPrintPos(4, 28);
  //ucg.setScale2x2();
  ucg.setFont(ucg_font_inb53_mr);
  ucg.print(setpoint, 1);

 // ucg.undoScale();
 // ucg.setPrintPos(280, 90);
  ucg.setFont(ucg_font_inb21_mr);
  ucg.print("°");
}
//compone la pagina dedicata al setpoint
void display_setpointPage(Ucglib_ILI9341_18x240x320_HWSPI ucg, float setpoint, float temp) {
  //TICK TIMER
  timerDisplay_setpoint_Tick();

  flag_onetime_HomeScreen = false;
  display_print_setpoint(ucg, setpoint);

  ucg.setColor(0, 255, 255, 255);    // Bianco
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(ucg_font_inb16_mr);
  ucg.setPrintPos(4, 220);

  ucg.print(TEMP_TEXT);
  ucg.print(temp, 1);
  ucg.print("°");



}
Ejemplo n.º 19
0
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);
}
Ejemplo n.º 20
0
//Stampa soltanto il setpoint grande al centro del display
void display_layout1_print_setpoint(Ucglib_ILI9341_18x240x320_HWSPI ucg, float setpoint) {
  SERIAL_OUT.println("display_print_setpoint");
  ucg.setColor(102, 255, 0);    // Verde Chiaro
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  display_layout1_printBigChar(ucg, setpoint);
}