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

Customize LED segment display #660

Open
MattKunze opened this issue May 30, 2018 · 27 comments
Open

Customize LED segment display #660

MattKunze opened this issue May 30, 2018 · 27 comments

Comments

@MattKunze
Copy link

MattKunze commented May 30, 2018

Currently the LED segments show the currently selected keymap ('QWM', etc). For me at least this is something that will rarely/never change, so the display doesn't really provide much information. It would be awesome if these could be overridden with a console utility (uhk --leds 'FOO') to display arbitrary text.

Why? This is the ultimate hacking keyboard, so mainly it just seems like stuff like that should be hackable ;) I could see writing a script to update it with the current CPU load, polling the outside temperature, hooking it up to the current terminal to display additional status, who knows.

Not sure if this belongs here or the firmware repo, thought I'd get the discussion started somewhere though.

@mondalaci
Copy link
Member

mondalaci commented May 30, 2018

Good point, and this is something that we planned. Now we also have an issue for it. Will do eventually. :)

@luteijn
Copy link

luteijn commented Jun 19, 2018

To expose the LED (and future expansions, like e.g. an i2c lcd display or other gadget) it might be useful to have the uhk also present itself as a usb-serial converter so scripts have something straight-forward to talk to. Alternatively/additionally agent could act as a proxy, but I guess you already have some ideas for this.

@mondalaci
Copy link
Member

mondalaci commented Jun 19, 2018

@luteijn Yep, the plan is to expose Agent as a proxy. Regarding communication, the already existing generic USB HID interface will be used. It's binary, but creating an additional USB serial interface would create a lot of bulk.

@richrd
Copy link

richrd commented Aug 7, 2018

A command line tool for setting leds would be amazing! Not sure how easy and cross platform that would be though. I'd love to have it show various status info from my computer etc.

I'm curious whether the led display accepts just characters or can the segments be addressed individually?

PS just got my UHK today and gotta say it's even more fun than I expected! :)

@mondalaci
Copy link
Member

mondalaci commented Aug 7, 2018

@richrd Yep, the LED display segments will be individually controllable. This is much needed for showing characters that resemble the predator alphabet, and who are we to stop you from doing that. :)

So glad you're having fun with your UHK!

@lrascao
Copy link

lrascao commented Oct 12, 2018

👍 i would also like to see this, btw great job!

@seanonthenet
Copy link

seanonthenet commented Feb 13, 2019

Awesome.

@norrs
Copy link

norrs commented Mar 5, 2019

This would be awesome, could use it for showing current xkbkeymap language, ie if Im currently using english keyboard or native norwegian.

@FatBoyXPC
Copy link

FatBoyXPC commented Apr 7, 2019

I think it would be neat if we could include some scripts to be stored on the keyboard, triggerable by the keyboard as well. Similar to how you can change layouts with the keyboard.

@mondalaci
Copy link
Member

mondalaci commented Apr 7, 2019

@FatBoyXPC This is not planned. Generally speaking, Agent is only meant to configure the UHK. You can achieve what you're after by setting up an unused shortcut (such as Ctrl+Alt+Shift+F13) for a key and bind it to your window manager to execute a script.

@FatBoyXPC
Copy link

FatBoyXPC commented Apr 7, 2019

Yeah, I figured that would be the immediate implementation but I was hoping having scripts there were movable with the keyboard would be on road map, too. It's not a big deal, though, as really my main use case for this is only with one computer anyway.

@jsarbour
Copy link

jsarbour commented Jun 19, 2019

+1 to this FR. I'd love to use mine as a clock (and run the hours in Hexadecimal I guess on one digit)

@BrianGaucher
Copy link

BrianGaucher commented Oct 11, 2019

Using it as a clock would be great. What if there was a LED display module?

@mhantsch
Copy link

mhantsch commented Jun 8, 2020

The idea of an UHK clock inspired me: there are three positions in the display. If you consider only the segments pointing outwards from the center, you have 8 of those in 360 degrees. Does not work well for advanced the "hand" every hour, or every minute, but try this:

image

@kareltucek
Copy link
Contributor

kareltucek commented Jun 8, 2020

...I guess you could also make the brightness change independently per segment and make it "continuous"...

@mondalaci
Copy link
Member

mondalaci commented Jun 8, 2020

All of this will be possible as the individual segments and per-key backlights will be exposed via the UHK USB protocol. Writing must be possible by the host, but I'm wondering whether reading LED states would make sense.

@csmote
Copy link

csmote commented Aug 13, 2020

Realize this isn't a priority, but just something to add.

As a (hopefully) soon, to be owner of an UHK, I'd love to see the LED show the current "modifier" level (for those that aren't already shown in the images in the same area), as I imagine was the original intent behind including it, i.e., MOD, FN, CTL, ALT, SUP, CMD, WIN, MOU, NUM, etc. and also love to be able to have those flash and control the rate of flash per code displayed. Particularly useful for getting a visual reminder to switch out of tenkey (Numlock) or arrow mode (especially arrow mode since that's going to be used often - I'd even have that flash all segs rapidly to really have a "warning" that not in standard alpha mode.)

Such a great piece of engineering. Keeping an eye on my resources to get an order together.

@mhantsch
Copy link

mhantsch commented Aug 28, 2020

@csmote I configured my NumPad "layer" not as a layer, but as a keymap. When I switch to it, the LED display shows that I am on the NumPad map. I guess that's a little bit of what you wanted (although only for NumPad, not for all the other modifiers).

@csmote
Copy link

csmote commented Sep 29, 2020

@mhantsch. Thanks for replying with your work-around - very slick! Understanding that the UHK is an evolving platform that's made tremendous progress so far!

@stn1986
Copy link

stn1986 commented Apr 13, 2022

While I don't actually own the keyboard yet (just ordered it) I was also wondering about this. I'd love for this tiny display to tell me the status of some of my projects, servers, emergencies, that sort of thing. I'm kinda bummed this LED is not directly programmable, but it's not a deal breaker. Anyway:

I see on YT you can create custom keymaps and name them, which is then displayed on the LED when activated. I only ever use one keymap, so my idea is to create a bunch of copies of that map, name them differently and switch them externally when some event is triggered.

Let's say I use the three digits as code. 000 = no problems, 100 = project 1 is in trouble, 010 = project 2 is in trouble and 003 = project 3 is in trouble. I create four duplicate keymaps that are exactly the same except for the name ("000", "100", etc). Let's assume I have some sort of code running externally that detects these problems and can run the same code the actual keyboard software uses to switch keymaps. In that case I can set the display to 000 and 100 and so on by automatically switching keymaps (which are actually the same so it doesn't impact my typing), right?

I'm not familiar with the maximum number of keymaps UHK supports. Using these scheme you can customize the LED up to whatever the maximum number of different keymaps is. I don't suppose it's 256^3 though..

Let me know if I'm talking out of my ass here. I'm a developer so I don't mind the code, but perhaps I'm fundamentally misunderstanding something else here.

PS: I see

public async switchKeymap(keymapAbbreviation: string): Promise<void> {
is the code to switch keymaps. The codebase looks really clean by the way. Real easy to navigate.

@kareltucek
Copy link
Contributor

kareltucek commented Apr 13, 2022

Let me know if I'm talking out of my ass here.

In theory, it works. In practice, it would be extremely impractical.

Since you can code, just add new usb command similar to the referenced switchKeymap, and set the LED display to the desired text. It will not change until something else changes it - in practice, until next keymap switch.

Some references:

  • agent/packages/usb/switch-keymap.ts
  • in firmware: LedDisplay_SetText,
  • right/src/usb_commands/usb_command_switch_keymap.c, or maybe more relevant: the set variable command.

@stn1986
Copy link

stn1986 commented Apr 13, 2022

I was indeed wondering if I could write arbitrary strings there, but I assumed the device must know the name.

What is impractical about it? It sounds like I directly write any string to the display.

Edit: o.. I see, you mean my method. Yeah, of course, that's just a workaround. If I can write any string it'd be awesome.

@stn1986
Copy link

stn1986 commented Apr 13, 2022

Thanks @kareltucek !

@kareltucek
Copy link
Contributor

kareltucek commented Apr 13, 2022

You are welcome!

@stn1986
Copy link

stn1986 commented Apr 13, 2022

So sorry to keep hammering on this, but I see in the FW in led_display.c that I can control the segments individually, which is.. making me giddy like a little girl. I'm not familiar with "the scene" so to speak, but is there a tool or something already written by someone to control the display directly? To me it'd be really cool to do what I want with it. I guess I could be of service to the community here if I'd provide such a tool until the UHK teams releases their own implementation. If someone did not beat me to it that is, which would be awesome as well.

@kareltucek
Copy link
Contributor

kareltucek commented Apr 13, 2022

but is there a tool or something already written by someone to control the display directly?

I am not aware of it.

(edit: actually there is my fork of the firmware, which allows settings text from macros - which I don't consider relevant in this context.)

I guess I could be of service to the community here if I'd provide such a tool until the UHK teams releases their own implementation. If someone did not beat me to it that is, which would be awesome as well.

I am sure a PR will be welcome, just consult your API proposal with @mondalaci to make sure you are on the same page.

@stn1986
Copy link

stn1986 commented Apr 13, 2022

OK, cool. I'll mess around with it first when I get mine and I'll look at your fork. Thanks again.

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

No branches or pull requests