1- from pyb import LED
21from machine import Pin , I2C
32from AHT20 import AHT20
43from BMP280 import BMP280
@@ -62,7 +61,7 @@ def screen_2_graphics(value):
6261 tft .ellipse (60 , 80 , 44 , 44 , tft .WHITE )
6362 tft .ellipse (60 , 80 , 40 , 40 , tft .WHITE )
6463
65- dial = contrain (value , 0 , 100 )
64+ dial = constrain (value , 0 , 100 )
6665 line = map_value (dial , 0 , 100 , - 2.618 , 2.618 )
6766 tft .line (60 , 80 , (60 + int (36 * math .sin (line ))), int (80 - (36 * math .cos (line ))), tft .YELLOW )
6867 tft .line (60 , 80 , (60 - int (10 * math .sin (line ))), int (80 + (10 * math .cos (line ))), tft .YELLOW )
@@ -93,7 +92,7 @@ def screen_3_graphics(value):
9392 tft .text ("900" , 138 , 108 , tft .BLACK )
9493 tft .text ("1100" , 194 , 108 , tft .BLACK )
9594
96- temp = contrain (value , 300 , 1200 )
95+ temp = constrain (value , 300 , 1200 )
9796 temp = int (map_value (temp , 300 , 1200 , 10 , 230 ))
9897 tft .line (temp , 95 , (temp - 4 ), 90 , tft .WHITE )
9998 tft .line (temp , 95 , (temp + 4 ), 90 , tft .WHITE )
@@ -109,7 +108,7 @@ def map_value(v, x_min, x_max, y_min, y_max):
109108 return int (y_min + (((y_max - y_min )/ (x_max - x_min )) * (v - x_min )))
110109
111110
112- def contrain (value , min_value , max_value ):
111+ def constrain (value , min_value , max_value ):
113112 if (value > max_value ):
114113 return max_value
115114
0 commit comments