1
- from pyb import LED
2
1
from machine import Pin , I2C
3
2
from AHT20 import AHT20
4
3
from BMP280 import BMP280
@@ -62,7 +61,7 @@ def screen_2_graphics(value):
62
61
tft .ellipse (60 , 80 , 44 , 44 , tft .WHITE )
63
62
tft .ellipse (60 , 80 , 40 , 40 , tft .WHITE )
64
63
65
- dial = contrain (value , 0 , 100 )
64
+ dial = constrain (value , 0 , 100 )
66
65
line = map_value (dial , 0 , 100 , - 2.618 , 2.618 )
67
66
tft .line (60 , 80 , (60 + int (36 * math .sin (line ))), int (80 - (36 * math .cos (line ))), tft .YELLOW )
68
67
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):
93
92
tft .text ("900" , 138 , 108 , tft .BLACK )
94
93
tft .text ("1100" , 194 , 108 , tft .BLACK )
95
94
96
- temp = contrain (value , 300 , 1200 )
95
+ temp = constrain (value , 300 , 1200 )
97
96
temp = int (map_value (temp , 300 , 1200 , 10 , 230 ))
98
97
tft .line (temp , 95 , (temp - 4 ), 90 , tft .WHITE )
99
98
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):
109
108
return int (y_min + (((y_max - y_min )/ (x_max - x_min )) * (v - x_min )))
110
109
111
110
112
- def contrain (value , min_value , max_value ):
111
+ def constrain (value , min_value , max_value ):
113
112
if (value > max_value ):
114
113
return max_value
115
114
0 commit comments