@@ -144,21 +144,24 @@ def update(self):
144
144
# Check for press and release
145
145
if (button_states_changed ):
146
146
147
- if (new_status [0 ] == 1 and previous_status [0 ] == 0 and self . _on_button_a_press ):
147
+ if (new_status [0 ] == 1 and previous_status [0 ] == 0 ):
148
148
self ._last_press_timestamps [0 ] = ticks_ms ()
149
- self ._on_button_a_press ()
149
+ if (self ._on_button_a_press ):
150
+ self ._on_button_a_press ()
150
151
elif (new_status [0 ] == 0 and previous_status [0 ] == 1 and self ._on_button_a_release ):
151
152
self ._on_button_a_release ()
152
153
153
- if (new_status [1 ] == 1 and previous_status [1 ] == 0 and self . _on_button_b_press ):
154
+ if (new_status [1 ] == 1 and previous_status [1 ] == 0 ):
154
155
self ._last_press_timestamps [1 ] = ticks_ms ()
155
- self ._on_button_b_press ()
156
+ if (self ._on_button_b_press ):
157
+ self ._on_button_b_press ()
156
158
elif (new_status [1 ] == 0 and previous_status [1 ] == 1 and self ._on_button_b_release ):
157
159
self ._on_button_b_release ()
158
160
159
- if (new_status [2 ] == 1 and previous_status [2 ] == 0 and self . _on_button_c_press ):
161
+ if (new_status [2 ] == 1 and previous_status [2 ] == 0 ):
160
162
self ._last_press_timestamps [2 ] = ticks_ms ()
161
- self ._on_button_c_press ()
163
+ if (self ._on_button_c_press ):
164
+ self ._on_button_c_press ()
162
165
elif (new_status [2 ] == 0 and previous_status [2 ] == 1 and self ._on_button_c_release ):
163
166
self ._on_button_c_release ()
164
167
0 commit comments