File tree 1 file changed +14
-15
lines changed
1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -73,21 +73,15 @@ def MakeHeatMapColor():
73
73
mini = 0
74
74
maxi = 0
75
75
76
- a1 = 20
77
- a2 = 37
76
+ my_a1 = 20
77
+ my_a2 = 37
78
78
79
- def temp2index (s ):
79
+ def temp2index (s , a1 , a2 ):
80
80
global mini , maxi
81
- global a1 , a2
82
81
83
- b1 = 1
82
+ b1 = 0
84
83
b2 = number_of_colors - 1
85
84
86
- if s > maxi :
87
- maxi = s
88
- if s < mini :
89
- mini = s
90
-
91
85
if s < a1 :
92
86
r = b1
93
87
elif s > a2 :
@@ -106,6 +100,7 @@ def temp2index(s):
106
100
mlx .refresh_rate = adafruit_mlx90640 .RefreshRate .REFRESH_4_HZ
107
101
108
102
frame = [0 ] * 768
103
+
109
104
while True :
110
105
stamp = time .monotonic ()
111
106
try :
@@ -121,13 +116,17 @@ def temp2index(s):
121
116
for h in range (24 ):
122
117
for w in range (32 ):
123
118
t = frame [h * 32 + w ]
124
- image_bitmap [w , (23 - h )] = temp2index (t ) # Convert temperature to palette index
119
+ if t > maxi :
120
+ maxi = t
121
+ if t < mini :
122
+ mini = t
123
+ image_bitmap [w , (23 - h )] = temp2index (t , my_a1 , my_a2 )
125
124
126
- min_label .text = "%0.2f" % (mini )
125
+ min_label .text = "%0.2f" % (my_a1 )
127
126
128
- max_string = "%0.2f" % (maxi )
127
+ max_string = "%0.2f" % (my_a2 )
129
128
max_label .x = 120 - (5 * len (max_string )) # Tricky calculation to left align
130
129
max_label .text = max_string
131
130
132
- a1 = mini # Automatically change the color scale
133
- a2 = maxi
131
+ my_a1 = mini # Automatically change the color scale
132
+ my_a2 = maxi
You can’t perform that action at this time.
0 commit comments