Skip to content

Commit a00e786

Browse files
committed
2.5.3 Retore T-Deck OTA
#212
1 parent 0f09b13 commit a00e786

File tree

4 files changed

+68
-44
lines changed

4 files changed

+68
-44
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ Things that needs to be done in next updates
8181
<details>
8282
<summary><h2>Changelog</h2></summary>
8383

84+
* 2.5.3:
85+
* [x] Restored T-Deck OTA
86+
* [x] Refined T-Deck Touchscreen inputs
87+
8488
* 2.5.2:
8589
* [x] Fixed Marauder V6 touchscreen and CYDs touchscreen unresponsive [issue](https://github.com/bmorcelli/Launcher/issues/210) and fixed Dim screen
8690
* [x] Fixed Marauder Mini and V7 screen dimming.

boards/lilygo-t-deck/interface.cpp

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ void _setup_gpio() {
7373
if (!touch.begin(Wire, GT911_SLAVE_ADDRESS_L)) {
7474
Serial.println("Failed to find GT911 - check your wiring!");
7575
}
76-
// Set touch max xy
77-
touch.setMaxCoordinates(320, 240);
78-
// Set swap xy
79-
touch.setSwapXY(true);
80-
// Set mirror xy
81-
touch.setMirrorXY(false, true);
8276

8377
pinMode(9, OUTPUT); // LoRa Radio CS Pin to HIGH (Inhibit the SPI Communication for this module)
8478
digitalWrite(9, HIGH);
@@ -129,30 +123,42 @@ void _setBrightness(uint8_t brightval) {
129123
**********************************************************************/
130124
void InputHandler(void) {
131125
char keyValue = 0;
132-
static unsigned long _tmptmp;
126+
static unsigned long tm = millis();
133127
TouchPointPro t;
134128
uint8_t touched = 0;
135-
touched = touch.getPoint(&t.x, &t.y);
136-
if ((millis() - _tmptmp) > 190 || LongPress) { // one reading each 190ms
137-
// Serial.printf("\nPressed x=%d , y=%d, rot: %d",t.x, t.y, rotation);
138-
if (touched) {
139-
140-
// Serial.printf("\nPressed x=%d , y=%d, rot: %d, millis=%d, tmp=%d",t.x, t.y, rotation, millis(),
141-
// _tmptmp);
142-
_tmptmp = millis();
143-
144-
if (!wakeUpScreen()) AnyKeyPress = true;
145-
else return;
146-
147-
// Touch point global variable
148-
touchPoint.x = t.x;
149-
touchPoint.y = t.y;
150-
touchPoint.pressed = true;
151-
touchHeatMap(touchPoint);
152-
touched = 0;
153-
return;
129+
uint8_t rot = 5;
130+
if (rot != rotation) {
131+
if (rotation == 1) {
132+
touch.setMaxCoordinates(320, 240);
133+
touch.setSwapXY(true);
134+
touch.setMirrorXY(true, true);
135+
}
136+
if (rotation == 3) {
137+
touch.setMaxCoordinates(320, 240);
138+
touch.setSwapXY(true);
139+
touch.setMirrorXY(false, false);
140+
}
141+
if (rotation == 0) {
142+
touch.setMaxCoordinates(240, 320);
143+
touch.setSwapXY(false);
144+
touch.setMirrorXY(false, true);
145+
}
146+
if (rotation == 2) {
147+
touch.setMaxCoordinates(240, 320);
148+
touch.setSwapXY(false);
149+
touch.setMirrorXY(true, false);
154150
}
151+
rot = rotation;
155152
}
153+
touched = touch.getPoint(&t.x, &t.y);
154+
delay(1);
155+
Wire.requestFrom(LILYGO_KB_SLAVE_ADDRESS, 1);
156+
while (Wire.available() > 0) {
157+
keyValue = Wire.read();
158+
delay(1);
159+
}
160+
if (millis() - tm < 200 && !LongPress) return;
161+
156162
// 0 - UP
157163
// 1 - Down
158164
// 2 - Left
@@ -168,7 +174,7 @@ void InputHandler(void) {
168174
ISR_rst();
169175
} else {
170176
if (!wakeUpScreen()) AnyKeyPress = true;
171-
else goto END;
177+
else return;
172178
}
173179
delay(50);
174180
// Print "bot - xx - yy", 1 is normal value for xx and yy 0 and 2 means movement on the axis
@@ -183,34 +189,48 @@ void InputHandler(void) {
183189
} // right, Down
184190
}
185191

186-
delay(1);
187-
Wire.requestFrom(LILYGO_KB_SLAVE_ADDRESS, 1);
188-
while (Wire.available() > 0) { keyValue = Wire.read(); }
189192
if (keyValue != (char)0x00) {
193+
if (!wakeUpScreen()) {
194+
AnyKeyPress = true;
195+
} else return;
190196
KeyStroke.Clear();
191197
KeyStroke.hid_keys.push_back(keyValue);
192198
if (keyValue == ' ') KeyStroke.exit_key = true; // key pressed to try to exit
193199
if (keyValue == (char)0x08) KeyStroke.del = true;
194200
if (keyValue == (char)0x0D) KeyStroke.enter = true;
195201
if (digitalRead(SEL_BTN) == BTN_ACT) KeyStroke.fn = true;
196202
KeyStroke.word.push_back(keyValue);
203+
if (KeyStroke.del) EscPress = true;
204+
if (KeyStroke.enter) SelPress = true;
197205
KeyStroke.pressed = true;
198-
} else KeyStroke.Clear();
206+
tm = millis();
207+
} else KeyStroke.pressed = false;
199208

200-
if (digitalRead(SEL_BTN) == BTN_ACT || KeyStroke.enter) {
209+
if (digitalRead(SEL_BTN) == BTN_ACT) {
210+
tm = millis();
201211
if (!wakeUpScreen()) {
202-
SelPress = true;
203212
AnyKeyPress = true;
204-
} else goto END;
205-
}
206-
if (keyValue == 0x08) {
207-
EscPress = true;
208-
AnyKeyPress = true;
213+
} else return;
214+
SelPress = true;
209215
}
210-
END:
211-
if (AnyKeyPress) {
212-
long tmp = millis();
213-
while ((millis() - tmp) < 200 && (digitalRead(SEL_BTN) == BTN_ACT));
216+
217+
if ((millis() - tm) > 190 || LongPress) { // one reading each 190ms
218+
if (touched) {
219+
220+
// Serial.printf("\nPressed x=%d , y=%d, rot: %d", t.x, t.y, rotation);
221+
tm = millis();
222+
223+
if (!wakeUpScreen()) AnyKeyPress = true;
224+
else return;
225+
226+
// Touch point global variable
227+
touchPoint.x = t.x;
228+
touchPoint.y = t.y;
229+
touchPoint.pressed = true;
230+
touchHeatMap(touchPoint);
231+
touched = 0;
232+
return;
233+
}
214234
}
215235
}
216236

boards/lilygo-t-deck/platformio.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ build_src_filter =${env.build_src_filter} +<../boards/lilygo-t-deck>
1515
build_flags =
1616
${env.build_flags}
1717
-Iboards/lilygo-t-deck
18-
-DDISABLE_OTA
1918

2019
-DBOARD_HAS_PSRAM=1
2120
-DARDUINO_USB_CDC_ON_BOOT=1

support_files/merge.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def q(p): return f'"{p}"'
111111
cmd_parts = [
112112
"pio pkg exec -p \"tool-esptoolpy\" -- esptool",
113113
"--chip", chip_arg,
114-
"merge-bin",
114+
"merge_bin",
115115
"--output", q(out_bin),
116116
hex(boot_offset), q(boot_bin),
117117
hex(PART_TABLE_OFFSET), q(part_bin),
@@ -135,6 +135,7 @@ def q(p): return f'"{p}"'
135135
print("[merge_bin] Merging binaries...")
136136
result = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
137137
rc = result.returncode
138+
# rc = env.Execute(cmd) # debug purposes
138139

139140
if rc != 0:
140141
print(f"[merge_bin] Failed with exit code {rc}")

0 commit comments

Comments
 (0)