Skip to content

Commit a5b2fef

Browse files
authored
fix pylint errors
1 parent dd37a65 commit a5b2fef

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

PyGamer_Thermal_Camera/code.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575
param_list = [("ALARM", WHITE), ("RANGE", RED), ("RANGE", CYAN)]
7676

7777
### 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
8181
return x, y # Return display coordinates
8282

8383
def flash_status(text="", duration=0.05): # Flash status message once
@@ -98,13 +98,13 @@ def update_image_frame(): # Get camera data and display
9898

9999
sum_bucket = 0 # Clear bucket for building average value
100100

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],
104104
MIN_SENSOR_C, MAX_SENSOR_C,
105105
MIN_SENSOR_C, MAX_SENSOR_C)
106106
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]
108108
sum_bucket = sum_bucket + value # Calculate sum for average
109109
minimum = min(value, minimum)
110110
maximum = max(value, maximum)
@@ -121,9 +121,9 @@ def update_histo_frame():
121121
sum_bucket = 0 # Clear bucket for building average value
122122

123123
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],
127127
MIN_SENSOR_C, MAX_SENSOR_C,
128128
MIN_SENSOR_C, MAX_SENSOR_C)
129129
histo_index = int(map_range(value, MIN_RANGE_C, MAX_RANGE_C, 0, 7))
@@ -132,14 +132,15 @@ def update_histo_frame():
132132
minimum = min(value, minimum)
133133
maximum = max(value, maximum)
134134

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]
139139
else:
140-
image_group[((row * 8) + col) + 1].fill = BLACK
140+
image_group[((row2 * 8) + col2) + 1].fill = BLACK
141141
return minimum, maximum, sum_bucket
142142

143+
#pylint: disable=too-many-branches,too-many-statements
143144
def setup_mode(): # Set alarm threshold and minimum/maximum range values
144145
status_label.color = WHITE
145146
status_label.text = "-SET-"
@@ -213,6 +214,7 @@ def setup_mode(): # Set alarm threshold and minimum/maximum range values
213214
ave_label.color = YELLOW
214215
ave_value.color = YELLOW
215216
return int(alarm_value.text), int(max_value.text), int(min_value.text)
217+
#pylint: enable=too-many-branches,too-many-statements
216218

217219
def move_buttons(joystick=False): # Read position buttons and joystick
218220
move_u = move_d = False
@@ -326,6 +328,8 @@ def move_buttons(joystick=False): # Read position buttons and joystick
326328
display_image = True # Image display mode; False for histogram
327329
display_hold = False # Active display mode; True to hold display
328330
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
329333

330334
# Activate display and play welcome tone
331335
board.DISPLAY.show(image_group)

0 commit comments

Comments
 (0)