Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added modifier key combination to allow keyboard shortcuts on t-deck #3668

Merged
merged 29 commits into from
May 8, 2024

Conversation

nbaddorf
Copy link
Contributor

The keyboard on the t-deck does not have a 'tab' button or a function button for triggering keyboard shortcuts. I added a 'modifier' key combo that is triggered by pressing shift and the mic (0) button on t-decks keyboard. Then press the letter for the shortcut you want. Currently implemented is: q (quit or cancel), t (tab), and m (mute/unmute).

Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
@CLAassistant
Copy link

CLAassistant commented Apr 19, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rcarteraz
Copy link
Member

Although the double button press is a little awkward, this does seem to work.

Is the shift + 0 and m combo supposed to cause the device to reboot? What specifically is this triggering to achieve mute? I checked external notification settings after pressing it several times and I'm not seeing a difference so unsure if it's working as intended.

@nbaddorf
Copy link
Contributor Author

nbaddorf commented Apr 20, 2024

All that the mute and tab code I added do are return the key code for that function, it doesnt actually change any values. All the t-deck thinks is that you are pressing the tab button or a mute button which just so happens to not actually have a phisical button on the keyboard. The code that actually handles the tab and mute functions are in the CannedMessagesModule.cpp

My t-deck mutes if it recieves a message before I try to mute it. It seems to reboot only when I mute it before getting a messag. I guess there is a bug in the CannedMessagesModule to figure out with that.

@nbaddorf
Copy link
Contributor Author

Related to the added functionality of the 'tab' key, we can remove two lines in the CannedMessagesModule.cpp which were forcing the node and channel selection to only change nodes.

On line 164 and 167 of the CannedMessagesModule.cpp you can remove these two lines: this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE;

Now when typing a message, toggle the tab function once to change nodes (swipe touchscreen or trackball to change nodes) or toggle the tab again to change which channels you are sending on.

@caveman99
Copy link
Member

The T-Deck keyboard is quite dumb, comparable to the BBQ10 beyboard we support as well. I just now got a t-deck and intend to port the bbq10 code to it, making sure both keyboards behave the same. It's a similar approach, just with different key combos.
I'd incorporate these suggestions...

nbaddorf added a commit to nbaddorf/firmware that referenced this pull request Apr 21, 2024
This enables the node and channel selection to be accessed by pressing the tab shortcut and then swiping between nodes or pressing tab again to change channels.

(To access the tab function look at my other pull request meshtastic#3668)
@ChDel
Copy link

ChDel commented Apr 21, 2024

The keyboard on the t-deck does not have a 'tab' button or a function button for triggering keyboard shortcuts. I added a 'modifier' key combo that is triggered by pressing shift and the mic (0) button on t-decks keyboard. Then press the letter for the shortcut you want. Currently implemented is: q (quit or cancel), t (tab), and m (mute/unmute).

That is amazing!
While you are there, is there any chances you could add shortcuts to increase and decrease the screen brightness? On a sunny day ☀️, there is no way to see anything outside and there is currently no way to change the brightness at all...
🙏

@caveman99
Copy link
Member

@nbaddorf the t-deck kb code is really retarded. I didn't mange to make shift-mic work, however shift-speaker will issue the 0x04 scancode for me. (0x24 minus 0x20) - there are really no other scancodes that are sent from the KB to the host, except alt-c

Short of flashing a decent kb firmware to the t-deck (which is not something the average user would do) - what do you think of alt+c as a trigger/escape? it's easier to hit than either shift-mic or shift-speaker...

Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
alt+t does not work on a t-deck so I removed it to avoid confusion.
@nbaddorf
Copy link
Contributor Author

Thanks for your comment! I didn't know about alt+c and I like that better. The alt+c combo also worked on both t-decks I have access too so I can change that over. I did just notice that one of the t-decks keyboards has more symbols for a different language on it as well as not having the $ symbol printed on the keyboard.

@rcarteraz
Copy link
Member

@nbaddorf the t-deck kb code is really retarded. I didn't mange to make shift-mic work, however shift-speaker will issue the 0x04 scancode for me. (0x24 minus 0x20) - there are really no other scancodes that are sent from the KB to the host, except alt-c

Short of flashing a decent kb firmware to the t-deck (which is not something the average user would do) - what do you think of alt+c as a trigger/escape? it's easier to hit than either shift-mic or shift-speaker...

Alt + c would be much easier!

@nbaddorf
Copy link
Contributor Author

I also started working on adding brightness shortcuts. I think the screen is default set to the brightest setting so keep that in mind as I dont think it will be getting any brighter. There is currently code implemented using the OLEDDisplay library for setting brightness. I added functions and keyboard shortcuts to change brightness but the OLEDDisplay library doesnt apear to be set to the backlight pin for the t-decks display. It looks like the backlight is currently being set high from digitalWrite but I dont remember where I found that. I can continue looking into changing that implementation to use the OLEDDisplay command.

@nbaddorf
Copy link
Contributor Author

Thanks Caveman99. I looked through CannedMessages but couldnt find any new code. Are you maybe refering to this pull request? #3627

As for a delay when setting the brightness to max, I have no idea what could be causing that, both of my t-decks work just fine with no delay.

thebentern and others added 2 commits April 25, 2024 14:24
… shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
@nbaddorf
Copy link
Contributor Author

I would love yalls input, I just added some code to display usefull info in the bottom right corner of the screen like if notifications are muted. Are there any other symbals (letters, not images) that would be usefull to display? Should I even keep this addition? It does sometimes take a second for the symbol to show up, but it is generally pretty quick.

I also changed how the keyboard shortcuts were sent to CannedMessages. I added a MODKEY value so that functions we want like muting notifications or changing brightness does not reset the display back to the default screen.

Finally I fixed the warning about potentially undefined brightness value.

I wasn’t  happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
@nbaddorf
Copy link
Contributor Author

nbaddorf commented Apr 27, 2024

Hey, thinking about it after the fact, I wasn't verry happy with some of the code in my previous implementation so I changed part of it making it simpler, and I dont think it will cause any issues with other devices. Id apretiate it if you would test it and let me know if you have any concerns. I think I am finally done chainging this unless yall want me too!

I do see that there is an issue on Github saying that I have conflicts with CannedMessages perticually with the mute notification function. I moved that modifier code to a different location in the file (along with most of the others) to make it work without setting the screen back to the default display. If I have to change something there let me know.
Edit: It looks like all that needs to be done to fix the conflict is to add showTemporaryMessage("Notifications \nEnabled"); and similar to the different modifiers. @caveman99 or @rcarteraz is this something you have permissions to fix?

I did just see that there was a pull request accepted which added a line to a function I moved so I may have to add that in. (This is my first pull request and I am no master programmer (age 19) so any suggestions would be appreciated.) Thanks!

@nbaddorf nbaddorf requested a review from caveman99 April 27, 2024 17:47
@ChrDel
Copy link

ChrDel commented May 5, 2024

Is there any hold backs on merging this?

@thebentern
Copy link
Contributor

Is there any hold backs on merging this?

Upstream has some changes so we are waiting for the author to resolve the merge conflicts

@rcarteraz
Copy link
Member

@nbaddorf Can you resolve the conflicts so this can be merged? It appears when #3695 was merged, it broke DM selection because it relies on this PR to add the modifier key.

@meshtastic-bot
Copy link

This pull request has been mentioned on Meshtastic. There might be relevant details there:

https://meshtastic.discourse.group/t/t-deck-firmware-2-3-7-2-3-8/12460/5

@nbaddorf
Copy link
Contributor Author

nbaddorf commented May 7, 2024

Sorry, I have been rather busy at home. I will try to get this fixed.

@GeneralZodGit
Copy link

After updating my T-Deck to 2.3.7 I can no longer swipe left and right or use the ball to change channels. Also, none of the keyboard shortcuts listed here work as written at all. So, unless I connect via bluetooth with a phone, I can only send to the broadcast primary channel now... Shift-0 or ALT-C plus T don't work.

@rcarteraz
Copy link
Member

After updating my T-Deck to 2.3.7 I can no longer swipe left and right or use the ball to change channels. Also, none of the keyboard shortcuts listed here work as written at all. So, unless I connect via bluetooth with a phone, I can only send to the broadcast primary channel now... Shift-0 or ALT-C plus T don't work.

After updating my T-Deck to 2.3.7 I can no longer swipe left and right or use the ball to change channels. Also, none of the keyboard shortcuts listed here work as written at all. So, unless I connect via bluetooth with a phone, I can only send to the broadcast primary channel now... Shift-0 or ALT-C plus T don't work.

Yes, this is known. See my previous comment. It’ll be fixed when this is merged and a new release drops.

@thebentern thebentern merged commit 147de75 into meshtastic:master May 8, 2024
65 of 67 checks passed
tavdog pushed a commit to tavdog/meshtastic-firmware that referenced this pull request May 10, 2024
…eshtastic#3668)

* Updated kbI2cBase.cpp

Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).

* Update kbI2cBase.cpp

* fixed formatting issues in kbI2cBase.cpp

* Removed keyboard shortcut code that doesnt work

alt+t does not work on a t-deck so I removed it to avoid confusion.

* Updated kbI2cBase.cpp

Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).

* Update kbI2cBase.cpp

* fixed formatting issues in kbI2cBase.cpp

* Removed keyboard shortcut code that doesnt work

alt+t does not work on a t-deck so I removed it to avoid confusion.

* Changed modifier key to alt+c

* Added screen brightness functionality

Use modifier key with o(+) to increase brightness or i(-) to decrease.

Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.

* Added checks to disable screen brightness changes on unsupported hardware

* Setting the brightness code to work on only applicable devices

* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.

* commented out a log

* Reworked how modifier functions worked, added

I wasn’t  happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.

* Added back the function I moved causing issue with versions

* Fixed the version conflicts, everything seems to work fine now

---------

Co-authored-by: Ben Meadors <[email protected]>
Co-authored-by: Thomas Göttgens <[email protected]>
@joneyes
Copy link

joneyes commented May 14, 2024

From what I was told by 2 people working on the firmware, the brightness is set at 50%... So we can still hope to get some brightness out of it hopefully :)
This is beyond my scope of expertise, So I really appreciate you taking the time...

The default use of green makes it harder to read.
I found editing src/graphics/TFTDisplay.cpp to bring the color565 hex values to FF (which is white), the screen was far more readable.
I'm not sure if this impacts any other implementations.

I'm a bit of a long in the tooth noob and botched the pull request and havent got around to having another. Happy for someone else to fix it properly.

@caveman99
Copy link
Member

The default use of green makes it harder to read. I found editing src/graphics/TFTDisplay.cpp to bring the color565 hex values to FF (which is white), the screen was far more readable. I'm not sure if this impacts any other implementations.

That's what #define TFT_MESH COLOR565(0xFF, 0xFF, 0xFF) in the variant file is for. The picomputer uses it.

@joneyes
Copy link

joneyes commented May 15, 2024

OK, so it's perfectly feasible to add #define TFT_MESH COLOR565(0xFF, 0xFF, 0xFF) to the T-Deck variant.h file? That will override the default green values of TFT_MESH COLOR565(0x67, 0xEA, 0x94) in TFTDisplay.cpp?

@caveman99
Copy link
Member

yes, that should work. If it doesan't the macro was not added in every screen definiton but that can be rectified :-)

@joneyes
Copy link

joneyes commented May 17, 2024

yes, that should work. If it doesan't the macro was not added in every screen definiton but that can be rectified :-)

It appears to have worked OK on my T-Deck.
See pull request #3926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants