Advertisement
GozuMezu

Retro-tv page3

Aug 30th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.25 KB | None | 0 0
  1.      - id: page3
  2.         lambda: |-
  3.          
  4.           //color temp bar DOWN
  5.           if ((id(temp_down).state) < 12) {
  6.             bar_color_down = id(my_grey);
  7.           } else if ((id(temp_down).state) < 16) {
  8.             bar_color_down = id(my_blue);
  9.           } else if ((id(temp_down).state) < 24) {
  10.             bar_color_down = id(my_green);
  11.           } else if ((id(temp_down).state) < 26) {
  12.             bar_color_down = id(my_orange);
  13.           } else {
  14.             bar_color_down = id(my_red);
  15.           }
  16.          
  17.           if ((id(temp_up).state) < 12) {
  18.             bar_color_up = id(my_grey);
  19.           } else if ((id(temp_up).state) < 16) {
  20.             bar_color_up = id(my_blue);
  21.           } else if ((id(temp_up).state) < 24) {
  22.             bar_color_up = id(my_green);
  23.           } else if ((id(temp_up).state) < 26) {
  24.             bar_color_up = id(my_orange);
  25.           } else {
  26.             bar_color_up = id(my_red);
  27.           }
  28.          
  29.           if ((id(temp_outside).state) < 12) {
  30.             bar_color_out = id(my_grey);
  31.           } else if ((id(temp_outside).state) < 16) {
  32.             bar_color_out = id(my_blue);
  33.           } else if ((id(temp_outside).state) < 24) {
  34.             bar_color_out = id(my_green);
  35.           } else if ((id(temp_outside).state) < 26) {
  36.             bar_color_out = id(my_orange);
  37.           } else {
  38.             bar_color_out = id(my_red);
  39.           }
  40.          
  41.           //grid
  42.           it.rectangle(0, 0, 132, 128, my_grey);
  43.           // bottom line = 0°
  44.           it.line(5, 120, 127, 120, my_grey);
  45.           // first line = 5°
  46.           it.line(5, 105 ,127 , 105, my_grey);
  47.           // 10°
  48.           it.line(5, 90 ,127 , 90, my_grey);
  49.           // 15°
  50.           it.line(5, 75 ,127 , 75, my_grey);
  51.           // 20°
  52.           it.line(5, 60 ,127 , 60, my_grey);
  53.           // 25°
  54.           it.line(5, 45 ,127 , 45, my_grey);
  55.           // 30°
  56.           it.line(5, 30 ,127 , 30, my_grey);
  57.           // 35°
  58.           it.line(5, 15 ,127 , 15, my_grey);
  59.           // 40°
  60.           it.line(5, 0 ,127 , 0, my_grey);
  61.          
  62.           //outside temp bar graph
  63.           int height = roundf(3 * (id(temp_outside).state));
  64.           it.filled_rectangle(10, 128 - height, 30, height, bar_color_out);
  65.           it.print(25, 108, id(roboto_reg), my_white, TextAlign::TOP_CENTER, "OUT");
  66.           it.printf(25, 128 - height - 16, id(roboto_reg), my_white, TextAlign::TOP_CENTER, "%.0f°",id(temp_outside).state);
  67.          
  68.           //inside temp bar graph
  69.           int heightIN = roundf(3 * (id(temp_down).state));
  70.           it.filled_rectangle(50, 128 - heightIN, 30, heightIN, bar_color_down);
  71.           it.print(65, 108, id(roboto_reg), my_white, TextAlign::TOP_CENTER, "IN");
  72.           it.printf(65, 128 - heightIN - 16, id(roboto_reg), my_white, TextAlign::TOP_CENTER, "%.0f°",id(temp_down).state);
  73.  
  74.           //upstairs temp bar graph
  75.           int heightUP = roundf(3 * (id(temp_up).state));
  76.           it.filled_rectangle(90, 128 - heightUP, 30, heightUP, bar_color_up);
  77.           it.print(105, 108, id(roboto_reg), my_white, TextAlign::TOP_CENTER, "UP");
  78.           it.printf(105, 128 - heightUP - 16, id(roboto_reg), my_white, TextAlign::TOP_CENTER, "%.0f°",id(temp_up).state);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement