Skip to content

T-Deck Pro support#6936

Merged
caveman99 merged 29 commits into
masterfrom
t-deck-pro
Jul 21, 2025
Merged

T-Deck Pro support#6936
caveman99 merged 29 commits into
masterfrom
t-deck-pro

Conversation

@mverch67

@mverch67 mverch67 commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator

Implementation status (standard UI)

  • E-Ink display GxEPD2_310_GDEQ031T10
  • Touch driver CST328
  • LoRa Radio SX1262/SX1268
  • TCA8418 keyboard
  • GPS M10Q
  • SD card
  • BQ25896 battery fast charger
  • BQ27220 battery fuel gauge
  • [ ] LTR-553ALS light sensor
  • BHI260AP gyroscope (self-learning AI fitness tracker)
  • PCM5102A DAC

Note: reused keyboard code provided by @Szetya 🙏

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

@mverch67 mverch67 requested a review from caveman99 June 1, 2025 13:09
@mverch67 mverch67 marked this pull request as ready for review June 1, 2025 13:09
@mverch67

mverch67 commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator Author

CannedMessage module function (keys) are missing currently.

@mverch67 mverch67 mentioned this pull request Jun 1, 2025
12 tasks
@Szetya

Szetya commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

The BQ27220 does not provide useful information.

OperationConfigA Values:0x0
External Thermistor Selected: NO
BATT_GD Pin Polarity High: NO
BATT_GD Function Enabled: NO
Can Enter SLEEP State: NO
slpwakechg Function Enabled: NO
Write Temperature Function Enabled: NO
Battery Insertion Detection Enabled: NO
Battery Insertion Pin Pull - Up Enabled: NO
Pin Function Code (PFC) Mode: 0
Wake - Up Function Enabled: NO
Wake - Up Threshold 1: 0
Wake - Up Threshold 0: 0

OperationConfigB Values:0x0
Default Seal Option Enabled: NO
Non - Removable Option Set: NO
INT_BREM Function Enabled: NO
INT_BATL Function Enabled: NO
INT_STATE Function Enabled: NO
INT_OCV Function Enabled: NO
INT_OT Function Enabled: NO
INT_POL Function Enabled (High - Level Polarity): NO
INT_FOCV Function Enabled: NO

Standard query:
        - AtRate:0 mA
        - AtRateTimeToEmpty:0 minutes
        - Temperature:-273.15 ℃
        - BatteryVoltage:0 mV
        - InstantaneousCurrent:0 mAh
        - RemainingCapacity:0 mAh
        - FullChargeCapacity:0 mAh
        - DesignCapacity:0 mAh
        - TimeToEmpty:0 minutes
        - TimeToFull:0 minutes
        - StandbyCurrent:0 mA
        - StandbyTimeToEmpty:0 minutes
        - MaxLoadCurrent:0 mA
        - MaxLoadTimeToEmpty:0 minute
        - RawCoulombCount:0 mAh
        - AveragePower:0 mW
        - InternalTemperature:-273.15 ℃
        - CycleCount:0
        - StateOfCharge:0 %
        - StateOfHealth:0 %
        - RequestChargingVoltage:0 mV
        - RequestChargingCurrent:0 mA
        - BTPDischargeSet:0 mAh
        - BTPChargeSet:0 mAh

Operation Status:
        - getIsConfigUpdateMode:NO
        - getIsBtpThresholdExceeded:NO
        - getIsCapacityAccumulationThrottled:NO
        - getIsInitializationComplete:NO
        - getIsDischargeCycleCompliant:NO
        - getIsBatteryVoltageBelowEdv2:NO
        - getSecurityAccessLevel:0
        - getIsCalibrationModeEnabled:NO

Battery Status:
===============================================

@Szetya

Szetya commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

TCA8418 treatment is a bit better but still needs some work.
There is a modifierFlag variable for the modifier keys, so the TCA8418TapMap can have 7 columns.
Shift: modifierFlag bit 1
alt: modifierFlag bit 2
Sym: modifierFlag bit 3
src_input.zip
The formatting needs a little tweaking. . :)

@kstrauser

Copy link
Copy Markdown

I can confirm that this is somewhat working today, as-is. Keyboard input is very slow and the shift keys don't work (but you can double-tap a letter to make it caps). Backspace and enter work. You can send and receive messages through the radio.

It's not polished yet, but it does actually function as a standalone device with keyboard, screen, radio, and buzzer notifications.

This is awesome. My little TDP is alive and usable for the first time now! Thank you both for getting it to this point!

@Szetya

Szetya commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

I can confirm that this is somewhat working today, as-is. Keyboard input is very slow and the shift keys don't work (but you can double-tap a letter to make it caps). Backspace and enter work. You can send and receive messages through the radio.

It's not polished yet, but it does actually function as a standalone device with keyboard, screen, radio, and buzzer notifications.

This is awesome. My little TDP is alive and usable for the first time now! Thank you both for getting it to this point!

Try the contents of the zip file. The code is a bit messy but it works better. Shift, alt, Sym too.

@adrianTNT

Copy link
Copy Markdown

These firmware updates are for the T-Deck Pro "4G" version or the "voice" version? Or is it irrelevant?
Thank you.

@kstrauser

Copy link
Copy Markdown

@Szetya Yep, that's a nice improvement.

@adrianTNT I'm using it on the 4G.

@Szetya

Szetya commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

@adrianTNT It is irrelevant at the moment because neither option is supported. It will probably have to be split later as it uses common PINs.

Has anyone disassembled it yet? 😉 LTR553ALS location found? I ordered from aliexpress. Also plan on installing a BME280 or BME688 once I take the time.

@mverch67

mverch67 commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator Author

@Nasimovy
You may try if the refactored class is still working with your keyboard device 😅

@Szetya

Szetya commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

@Nasimovy You may try if the refactored class is still working with your keyboard device 😅

WAO! I'll look at this tomorrow on t-deck pro. The value of modifierFalg can be up to 7 at the moment (shift + alt + sym) so the tapMap array can be up to 7+1 columns. There are plenty of possibilities to handle special events or use special characters. And the two shifts can be handled separately and then 15+1 combinations are possible for each key (which is a lot) 😂
(The t-lora pager is coming soon. Version 868MHz is already available on the official site (ordered today))

@mverch67

mverch67 commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator Author

WAO! I'll look at this tomorrow on t-deck pro. The value of modifierFalg can be up to 7 at the moment (shift + alt + sym) so the tapMap array can be up to 7+1 columns.

I tried to use the same keys as on the T-Deck with quite similar behavior. The only difference is that instead of ALT+C - key now can use ALT+key directly.

@Szetya

Szetya commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

TCA8418 is capable of requesting 3 buttons at once (under certain matrix rules) which is not currently used and I don't think it is needed. Currently shift increases the modifierFalg value by 1, alt by 2 and sym by 4. Before the _TCA8418_MULTI_TAP_THRESHOLD time expires, the modifier keys can be pressed in sequence to use different combinations e.g. shift & alt & key. Which gives the index of the third key of tapMap.
It would be a good idea to have some information about the state of the modifierFalg on the display but the top line of the display is full.

@mverch67

mverch67 commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator Author

TCA8418 is capable of requesting 3 buttons at once (under certain matrix rules) which is not currently used and I don't think it is needed. Currently shift increases the modifierFalg value by 1, alt by 2 and sym by 4. Before the _TCA8418_MULTI_TAP_THRESHOLD time expires, the modifier keys can be pressed in sequence to use different combinations e.g. shift & alt & key. Which gives the index of the third key of tapMap. It would be a good idea to have some information about the state of the modifierFalg on the display but the top line of the display is full.

I've modified all this already, i.e. implemented the multi-key press and removed the long press which we don't use on T-Deck. I guess nobody wants to press more than one modifier key in sequence which would also simplify the logic and the programming.
What is currently not working is that the shift key can be held while typing a series of capital alphabetic characters. Looks like an issue with the modifier state.
From what you are suggesting I assume you've never worked with a T-Deck, right?

@Szetya

Szetya commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

TCA8418 is capable of requesting 3 buttons at once (under certain matrix rules) which is not currently used and I don't think it is needed. Currently shift increases the modifierFalg value by 1, alt by 2 and sym by 4. Before the _TCA8418_MULTI_TAP_THRESHOLD time expires, the modifier keys can be pressed in sequence to use different combinations e.g. shift & alt & key. Which gives the index of the third key of tapMap. It would be a good idea to have some information about the state of the modifierFalg on the display but the top line of the display is full.

I've modified all this already, i.e. implemented the multi-key press and removed the long press which we don't use on T-Deck. I guess nobody wants to press more than one modifier key in sequence which would also simplify the logic and the programming. What is currently not working is that the shift key can be held while typing a series of capital alphabetic characters. Looks like an issue with the modifier state. From what you are suggesting I assume you've never worked with a T-Deck, right?

For me, it was not uncomfortable to press several buttons in a row during my tests. The beauty of it all is that you can approach the same thing in different ways. 😉
I have no problem with your solution, that's not why I wrote it. I haven't tried your version yet (I'll take the time this afternoon).
I have a first generation t-deck but I don't use it.

@Szetya

Szetya commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

TCA8418 is capable of requesting 3 buttons at once (under certain matrix rules) which is not currently used and I don't think it is needed. Currently shift increases the modifierFalg value by 1, alt by 2 and sym by 4. Before the _TCA8418_MULTI_TAP_THRESHOLD time expires, the modifier keys can be pressed in sequence to use different combinations e.g. shift & alt & key. Which gives the index of the third key of tapMap. It would be a good idea to have some information about the state of the modifierFalg on the display but the top line of the display is full.

I've modified all this already, i.e. implemented the multi-key press and removed the long press which we don't use on T-Deck. I guess nobody wants to press more than one modifier key in sequence which would also simplify the logic and the programming. What is currently not working is that the shift key can be held while typing a series of capital alphabetic characters. Looks like an issue with the modifier state. From what you are suggesting I assume you've never worked with a T-Deck, right?

For me, it was not uncomfortable to press several buttons in a row during my tests. The beauty of it all is that you can approach the same thing in different ways. 😉 I have no problem with your solution, that's not why I wrote it. I haven't tried your version yet (I'll take the time this afternoon). I have a first generation t-deck but I don't use it.

If you take a look at the meshtastic map of Hungary, you will understand why you don't need a qwerty device. It's currently a hobby for some crazy people. 😂 No good infrastructure and no good coverage. Also 433MHz and 868MHz devices are very mixed. Chances are high that messages will not reach their destination.

@factory-kirk

Copy link
Copy Markdown

At what point do we call this good enough to merge, then start adding incremental PRs to smooth out the remaining issues?

(I say "we" as if I wrote a single line of this, which I did not. 😀)

@mverch67

Copy link
Copy Markdown
Collaborator Author

At what point do we call this good enough to merge, then start adding incremental PRs to smooth out the remaining issues?

I would say when the biggest show stoppers are gone. Otherwise we'll get a sh*t storm of bug reports for the things we know already.

@mr-tbot

mr-tbot commented Jul 10, 2025

Copy link
Copy Markdown

Personally - I just compiled and flashed the "latest" version - based on 2.7.2 - and the battery reporting issues are still happening - some functionality is absolutely better - but there's clearly more work to do - otherwise - yeah - there's gonna be a slurry of bug reports.

It DID report it was charging when I first turned it on after this update - but the previous behavior has returned. (This is with an "update" rather than a full erase mind you) - if this has been fixed and I am doing something wrong - by all means call me out. lol

@mr-tbot

mr-tbot commented Jul 13, 2025

Copy link
Copy Markdown

@mverch67 Thanks for this!

Okay - just rebuilt and flashed your changes to the 4G variant I have here - my I2S variant is coming soon.

So far - the unit at first boot is reporting that it is plugged in (the plug notification - not battery and charging) - and is not changing from that state for quite a while - so far it still has not changed, and it has been about 15 minutes. This is obviously because it was just plugged in via USB for flashing - but it is not showing that it is on battery coming out of that state.

After a forced reboot - same thing - still reporting plugged in.

Now - I just plugged in the device to a simple power only USB after that to try and "trick" it into resetting the charging notification... and the device reboot itself.

After the random reset (after being plugged in) - it now shows a charging icon, and charging appears to be working.

Unplugging from that now properly shows that it is on battery.

SO - it works - mostly! There's some wonkiness in the first cycle, and the reporting percentage when it's charging versus what it actually has (mine is saying 42% when off battery - but it says it's at 60% when charging until I unplug it - so there's a pretty wide discrepancy there of 20-30% between what it reports while charging versus what it reports on battery... I will see if it gets to 100% on charging and then take it off the charger to see if that corrects the issue or if it's still reporting low when taking off charge.

I'll report back in a bit.

Cheers!

@mverch67

Copy link
Copy Markdown
Collaborator Author

@mr-tbot

If you've ever flashed one of the previous firmware versions you need to either remove the battery or let it completely run empty (until it does not wake up anymore), otherwise the PMM will not be reprogrammed correctly. That's why you saw that device is not charging.

@mr-tbot

mr-tbot commented Jul 13, 2025

Copy link
Copy Markdown

Copy - I will just let it run down today and cycle it.

In my instance - coming from a previous build - leaving it at 100% for a while it's now aligned in it's reporting initially - but in a couple minutes it's already down 2% - so - I almost guarantee it's the calibration like you said.

thanks!

@mr-tbot

mr-tbot commented Jul 15, 2025

Copy link
Copy Markdown

So - little follow-up here.

Fully charged my 4G variant - either it takes a while to realize it's unplugged - or is not detecting properly - detects after a reboot.

My battery life on this unit is not on par with what I would expect from an e-ink device - my t-deck plus lasts considerably longer... at least in my case so far. Once my I2S variant comes in I'll do a side by side battery test...

Looking forward to further updates!

@benjamind

Copy link
Copy Markdown

I've been experimenting with this build too. So far battery charging appears to be working after I let it run down completely, but can't really comment on expected battery life yet.

I have however been struggling to get the device to broadcast messages a lot, seems to have very poor signal. It also appears to be sending hi/bye messages on sleep and wake?

There's also an off-by-one error on the eink refresh with it not triggering an update on quite a few of the screens including when typing in free text messages it always misses the last pressed character in the update. Similarly disconnecting charging cable does not update until the next input.

Good to see things making progress though!

@mverch67

mverch67 commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator Author

@mr-tbot

I would expect from an e-ink device - my t-deck plus lasts considerably longer... at least in my case so far.

This is probably because you are running the T-Deck Pro with BT on but T-Deck Plus with BT off? If so I suggest to disable BT on the Pro and then compare the runtimes.
Also device role should be same (ideally client mute if you are indoors).

@Mirarak

Mirarak commented Jul 16, 2025

Copy link
Copy Markdown

In the LilyGo T-Deck main menu it is not visible where the device is connected, the name of the connected device could be added to the fifth icon from the top, where it is - signal status. Thank you. Mirarak

@mverch67

Copy link
Copy Markdown
Collaborator Author

In the LilyGo T-Deck main menu it is not visible where the device is connected, the name of the connected device could be added to the fifth icon from the top, where it is - signal status. Thank you. Mirarak

Sorry, you're wrong here. This PR is for T-Deck Pro...

@Mirarak

Mirarak commented Jul 16, 2025 via email

Copy link
Copy Markdown

@mr-tbot

mr-tbot commented Jul 17, 2025

Copy link
Copy Markdown

I2S version arrived today - so I have both variants now for testing! =)

@vidplace7 vidplace7 added the hardware-support Hardware related: new devices or modules, problems specific to hardware label Jul 18, 2025
@tajo48

tajo48 commented Jul 19, 2025

Copy link
Copy Markdown

1752866164117

Compiled and tested, works great!
Yet I'm wondering if the standard ui is the best choice and even if it is the navigation is not so great tbh

Comment thread src/main.cpp
@caveman99

Copy link
Copy Markdown
Member

maybe move the variant dir to the new structure before merging?

@caveman99 caveman99 merged commit b3525c2 into master Jul 21, 2025
100 of 102 checks passed
@Szetya

Szetya commented Jul 26, 2025

Copy link
Copy Markdown
Contributor

@mverch67
e.kbchar same in the following lines:

case TCA8418KeyboardBase::BT_TOGGLE:
e.inputEvent = INPUT_BROKER_ANYKEY;
e.kbchar = INPUT_BROKER_MSG_BLUETOOTH_TOGGLE;
break;
case TCA8418KeyboardBase::BL_TOGGLE:
e.inputEvent = INPUT_BROKER_ANYKEY;
e.kbchar = INPUT_BROKER_MSG_BLUETOOTH_TOGGLE;
break;

@firstel

firstel commented Aug 9, 2025

Copy link
Copy Markdown

I flashed my T-Deck Pro with the latest alpha. First I tried a full erase with the UI, and upon rebooting the keyboard led came on and started to flash, which is the first sign of life I have seen on this device since I let the battery run down months ago. But the display never changed, just flashing led. Then I tried again without the Mesh UI, and the device rebooting with the vibration motor going non-stop. Encouraging that this has an effect on the device, but not working for me yey. Any advice?

@mverch67

mverch67 commented Aug 9, 2025

Copy link
Copy Markdown
Collaborator Author

I flashed my T-Deck Pro with the latest alpha. First I tried a full erase with the UI, and upon rebooting the keyboard led came on and started to flash, which is the first sign of life I have seen on this device since I let the battery run down months ago. But the display never changed, just flashing led. Then I tried again without the Mesh UI, and the device rebooting with the vibration motor going non-stop. Encouraging that this has an effect on the device, but not working for me yey. Any advice?

Did you put the device into DFU mode before flashing?

@firstel

firstel commented Aug 9, 2025 via email

Copy link
Copy Markdown

@caveman99 caveman99 deleted the t-deck-pro branch August 11, 2025 08:47
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
* initial draft

* fix touchscreen

* fix touchscreen

* optimize GPS

* battery management

* cleanup comments

* enable vibration motor

* refactored TCA8418Keyboard

* update HW_VENDOR id

* manual fixes after merge

* fix keyboard/BQ27220 detection

* add BQ27220

* modify charge voltage and current

* update XpowerLib

* design capacity

* try-fix charge behavior

* improve Vbus detection

* moved variant into esp32s3 folder

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hardware-support Hardware related: new devices or modules, problems specific to hardware

Projects

None yet

Development

Successfully merging this pull request may close these issues.