|
52 | 52 | backlight_on_state=st7789.STATE_PWM, |
53 | 53 | offset_x=0, |
54 | 54 | offset_y=35 |
55 | | -) |
| 55 | +) # this will trigger lv.init() |
56 | 56 | mpos.ui.main_display.set_power(True) # set RD pin to high before the rest, otherwise garbled output |
57 | 57 | mpos.ui.main_display.init() |
58 | 58 | mpos.ui.main_display.set_backlight(100) # works |
59 | 59 |
|
60 | | -lv.init() |
61 | 60 | mpos.ui.main_display.set_rotation(lv.DISPLAY_ROTATION._270) # must be done after initializing display and creating the touch drivers, to ensure proper handling |
62 | 61 | mpos.ui.main_display.set_color_inversion(True) |
63 | 62 |
|
@@ -119,7 +118,7 @@ def keypad_read_cb(indev, data): |
119 | 118 | if near_simul or single_press_wait: |
120 | 119 | dt_a = time.ticks_diff(current_time, last_a_down_time) if last_a_down_time else None |
121 | 120 | dt_b = time.ticks_diff(current_time, last_b_down_time) if last_b_down_time else None |
122 | | - print(f"combo guard: a={btn_a_pressed} b={btn_b_pressed} near={near_simul} wait={single_press_wait} dt_a={dt_a} dt_b={dt_b}") |
| 121 | + #print(f"combo guard: a={btn_a_pressed} b={btn_b_pressed} near={near_simul} wait={single_press_wait} dt_a={dt_a} dt_b={dt_b}") |
123 | 122 |
|
124 | 123 | # While in an on-screen keyboard, PREV button is LEFT and NEXT button is RIGHT |
125 | 124 | focus_group = lv.group_get_default() |
@@ -156,32 +155,33 @@ def keypad_read_cb(indev, data): |
156 | 155 | key_press_start = 0 |
157 | 156 | last_repeat_time = 0 |
158 | 157 | elif last_key is None or current_key != last_key: |
159 | | - print(f"New key press: {current_key}") |
| 158 | + #print(f"New key press: {current_key}") |
160 | 159 | data.key = current_key |
161 | 160 | data.state = lv.INDEV_STATE.PRESSED |
162 | 161 | last_key = current_key |
163 | 162 | last_state = lv.INDEV_STATE.PRESSED |
164 | 163 | key_press_start = current_time |
165 | 164 | last_repeat_time = current_time |
166 | 165 | else: |
167 | | - print(f"key repeat because current_key {current_key} == last_key {last_key}") |
| 166 | + #print(f"key repeat because current_key {current_key} == last_key {last_key}") |
168 | 167 | elapsed = time.ticks_diff(current_time, key_press_start) |
169 | 168 | since_last_repeat = time.ticks_diff(current_time, last_repeat_time) |
170 | 169 | if elapsed >= REPEAT_INITIAL_DELAY_MS and since_last_repeat >= REPEAT_RATE_MS: |
171 | 170 | next_state = lv.INDEV_STATE.PRESSED if last_state == lv.INDEV_STATE.RELEASED else lv.INDEV_STATE.RELEASED |
172 | 171 | if current_key == lv.KEY.PREV: |
173 | | - print("Repeated PREV does not do anything, instead it triggers ESC (back) if long enough") |
| 172 | + #print("Repeated PREV does not do anything, instead it triggers ESC (back) if long enough") |
174 | 173 | if since_last_repeat > REPEAT_PREV_BECOMES_BACK: |
175 | | - print("back button trigger!") |
| 174 | + print("Long press on PREV triggered back button") |
176 | 175 | data.key = lv.KEY.ESC |
177 | 176 | data.state = next_state |
178 | 177 | last_key = current_key |
179 | 178 | last_state = data.state |
180 | 179 | last_repeat_time = current_time |
181 | 180 | else: |
182 | | - print("repeat PREV ignored because not pressed long enough") |
| 181 | + #print("repeat PREV ignored because not pressed long enough") |
| 182 | + pass |
183 | 183 | else: |
184 | | - print("Send a new PRESSED/RELEASED pair for repeat") |
| 184 | + #print("Send a new PRESSED/RELEASED pair for repeat") |
185 | 185 | data.key = current_key |
186 | 186 | data.state = next_state |
187 | 187 | last_key = current_key |
|
0 commit comments