75
75
param_list = [("ALARM" , WHITE ), ("RANGE" , RED ), ("RANGE" , CYAN )]
76
76
77
77
### Helpers ###
78
- def element_grid (col , row ): # Determine display coordinates for column, row
79
- x = int (ELEMENT_SIZE * col + 30 ) # x coord + margin
80
- y = int (ELEMENT_SIZE * row + 1 ) # y coord + margin
78
+ def element_grid (col0 , row0 ): # Determine display coordinates for column, row
79
+ x = int (ELEMENT_SIZE * col0 + 30 ) # x coord + margin
80
+ y = int (ELEMENT_SIZE * row0 + 1 ) # y coord + margin
81
81
return x , y # Return display coordinates
82
82
83
83
def flash_status (text = "" , duration = 0.05 ): # Flash status message once
@@ -98,13 +98,13 @@ def update_image_frame(): # Get camera data and display
98
98
99
99
sum_bucket = 0 # Clear bucket for building average value
100
100
101
- for row in range (0 , 8 ): # Parse camera data list and update display
102
- for col in range (0 , 8 ):
103
- value = map_range (image [7 - row ][7 - col ],
101
+ for row1 in range (0 , 8 ): # Parse camera data list and update display
102
+ for col1 in range (0 , 8 ):
103
+ value = map_range (image [7 - row1 ][7 - col1 ],
104
104
MIN_SENSOR_C , MAX_SENSOR_C ,
105
105
MIN_SENSOR_C , MAX_SENSOR_C )
106
106
color_index = int (map_range (value , MIN_RANGE_C , MAX_RANGE_C , 0 , 7 ))
107
- image_group [((row * 8 ) + col ) + 1 ].fill = element_color [color_index ]
107
+ image_group [((row1 * 8 ) + col1 ) + 1 ].fill = element_color [color_index ]
108
108
sum_bucket = sum_bucket + value # Calculate sum for average
109
109
minimum = min (value , minimum )
110
110
maximum = max (value , maximum )
@@ -121,9 +121,9 @@ def update_histo_frame():
121
121
sum_bucket = 0 # Clear bucket for building average value
122
122
123
123
histo_bucket = [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] # Clear histogram bucket
124
- for row in range (7 , - 1 , - 1 ): # Collect camera data and calculate spectrum
125
- for col in range (0 , 8 ):
126
- value = map_range (image [col ][ row ],
124
+ for row2 in range2 (7 , - 1 , - 1 ): # Collect camera data and calculate spectrum
125
+ for col2 in range (0 , 8 ):
126
+ value = map_range (image [col2 ][ row2 ],
127
127
MIN_SENSOR_C , MAX_SENSOR_C ,
128
128
MIN_SENSOR_C , MAX_SENSOR_C )
129
129
histo_index = int (map_range (value , MIN_RANGE_C , MAX_RANGE_C , 0 , 7 ))
@@ -132,14 +132,15 @@ def update_histo_frame():
132
132
minimum = min (value , minimum )
133
133
maximum = max (value , maximum )
134
134
135
- for col in range (0 , 8 ): # Display histogram
136
- for row in range (0 , 8 ):
137
- if histo_bucket [col ] / 8 > 7 - row :
138
- image_group [((row * 8 ) + col ) + 1 ].fill = element_color [col ]
135
+ for col2 in range (0 , 8 ): # Display histogram
136
+ for row2 in range (0 , 8 ):
137
+ if histo_bucket [col2 ] / 8 > 7 - row2 :
138
+ image_group [((row2 * 8 ) + col2 ) + 1 ].fill = element_color [col2 ]
139
139
else :
140
- image_group [((row * 8 ) + col ) + 1 ].fill = BLACK
140
+ image_group [((row2 * 8 ) + col2 ) + 1 ].fill = BLACK
141
141
return minimum , maximum , sum_bucket
142
142
143
+ #pylint: disable=too-many-branches,too-many-statements
143
144
def setup_mode (): # Set alarm threshold and minimum/maximum range values
144
145
status_label .color = WHITE
145
146
status_label .text = "-SET-"
@@ -213,6 +214,7 @@ def setup_mode(): # Set alarm threshold and minimum/maximum range values
213
214
ave_label .color = YELLOW
214
215
ave_value .color = YELLOW
215
216
return int (alarm_value .text ), int (max_value .text ), int (min_value .text )
217
+ #pylint: enable=too-many-branches,too-many-statements
216
218
217
219
def move_buttons (joystick = False ): # Read position buttons and joystick
218
220
move_u = move_d = False
@@ -326,6 +328,8 @@ def move_buttons(joystick=False): # Read position buttons and joystick
326
328
display_image = True # Image display mode; False for histogram
327
329
display_hold = False # Active display mode; True to hold display
328
330
display_focus = False # Standard display range; True to focus display range
331
+ orig_max_range_f = 0 # There are no initial range values
332
+ orig_min_range_f = 0
329
333
330
334
# Activate display and play welcome tone
331
335
board .DISPLAY .show (image_group )
0 commit comments