kareltucek / firmware

This is fork of UHK's firmware featuring extended macro engine.
Other
82 stars 9 forks source link

Outputing register value to the LED display. #105

Closed bistabil closed 1 year ago

bistabil commented 2 years ago

Today, I've discovered it's possible to write to the LED display and I've started playing with it. Is it possible to output the value of a register to it? Registers are holding numeric values while setLedTxt expects custom text. I went through the reference manual but didn't find a command for this.

My use case: I would like to implement a countdown timer and display its value on the LED display. Moreover, the timer's starting value would be dynamic (set through another macro).

To be even more specific, yes it is a niche use case. In the game, I am playing I am required to perform certain actions after a set amount of time. While I could use a stopwatch, why not hack this keyboard instead? :D I could update the displays only after the register's value reaches zero BUT having the countdown actually helps to anticipate when I will need to switch my focus from current game actions to the one requiring my attention after the counter reaches zero.

If I would like to go from 999 to 000 (worst case scenario in decimal system) I don't see a way to avoid 1000 if statements if I can rely only on a custom text. If it was possible to control each of the 3 displays separately, then, I guess I could make this with 3 registers, and 30 if statements with some nested loops

bistabil commented 2 years ago

Even if I would go that distance and write 1000 if statements (that would require multiple macros calling each other because the number of actions is limited) I can see a problem with the performance. Evaluating 1000 statements every second let's say might be a challenge (assuming). It would be awesome having the ability to control individual displays as that would unlock even more possibilities.

kareltucek commented 2 years ago

No, not possible at the moment.

kareltucek commented 1 year ago

I don't have strong feelings about the LED display. I would prefer not to flood the codebase with extensive LED display API which would pollute the namespaces and add a lot of new code which would have to be maintained.

I guess I am open to merging such functionality, although I don't intend to invest too much time into it at the moment.

If I may suggest a way forward, then please do reformulate the proposals in terms of proposed macro syntaxes, and do so in one thread for all the proposed features...

kareltucek commented 1 year ago

Is/will be solved by https://github.com/UltimateHackingKeyboard/firmware/pull/674