I've rewritten DevTerm keyboard & trackball firmware

I rewrote DevTerm keyboard & trackball firmware from scratch to fix trackball movements.

I think that a good trackball controller satisfies these conditions:

  • It should be responsive to your rolling speed. The faster you roll, the faster it moves.
  • But it should be precise if you want, without ‘Fn’ key mode.
  • Also it shouldn’t be janky when you move diagonally in any angle.
  • While doing so, it shouldn’t be slippery. It stops to move immediately when you stop to roll.

I’ve also rewrote the keyboard part.
It uses the open draining mode, so it might be a little bit better on simultaneous input than before (I’m not sure).

There is still room for improvements.
I’m constantly experimenting with the interpolation and heuristics.
Also I found that we can cut down the power usage to few milliamps (currently it constantly draws ~30mA).
I might rewrite it again with newer, official stm32duino package.

31 Likes

I’ve tested the code and the trackball works very well

very looking forward to the release

right now it seems the direction keys of joystick are little buggy
besides that ,everything is perfect

and code borrowed

5 Likes

genius! thanks so much

I created an automatic flashing package for the new firmware
The commands are as follows

sudo apt install dfu-util -y

wget https://github.com/clockworkpi/DevTerm/raw/main/Code/devterm_keyboard/bin/DevTerm_keyboard_firmware_v0.2_utils.sh


chmod +x  DevTerm_keyboard_firmware_v0.2_utils.sh

sudo ./DevTerm_keyboard_firmware_v0.2_utils.sh

Problems and solutions

  1. usually the first time of flashing will be no response,so you need to run
    sudo ./DevTerm_keyboard_firmware_v0.2_utils.sh again, and keyboard might not woking during the first flashing, so strongly recommend to do the whole job in SSH

  2. make sure you have /dev/ttyACM0 when the keyboard is ON the devterm,in the rare cases , keyboard will be renamed to other like /dev/ttyAEM0 or else, that will cause the flashing failed,try the flashing when /dev/ttyACM0 appears

here is no response screenshot


here is flashing successful screeshot

If you want old firmware back

sudo apt install dfu-util -y
wget https://github.com/clockworkpi/DevTerm/raw/main/Code/devterm_keyboard/bin/DevTerm_keyboard_firmware_v0.1_utils.sh

chmod +x DevTerm_keyboard_firmware_v0.1_utils.sh
sudo ./DevTerm_keyboard_firmware_v0.1_utils.sh

same process

for coding/hacking tips

I only did the coding under Linux with Arduino IDE ,and I found out that, I need to use root with Arduino IDE so that the uploading process will work mostly,and I never succeeded to upload the code with Arduino in Windows,don’t know why

14 Likes

Thank you! This is fantastic!
However, I noticed that the trackball push functioned as a mouse wheel button (middle click). Isn’t it perfect if this is fixed?

Thank you!
It seems that you’ve installed the cuu’s official firmware.

I intended it to be a left click button:

2 Likes

after rechecking the code I found out that I misunderstand your code
and then I fixed the issue

now with the mid key pressed on keyboard bottom area,the trackball will scrolling

2 Likes

The behavior of trackball and middle click button that I’ve implemented is subtle, but I’m sure that you’ll find it to be more intuitive than it looks.

  1. Clicking the trackball sends a left mouse button signal.
  2. Pressing the middle button makes the trackball to send wheel signals.
  3. Releasing the middle button sends a middle mouse button signal unless:
    1. the time between pressing and releasing is short enough (<500ms)
    2. trackball hasn’t been rolled since middle button pressing.
3 Likes

So, if I read between the lines here that means you can flash the keyboard without taking it out and connecting to the separate programming port? And /dev/ttyACM0 is actually the keyboard’s virtual COM port?

What’s the separate microUSB connector useful for then?

1 Like

yeah, that’s right ,flashing the keyboard when the kbd is on the devterm

and for the separate microUSB connector , I always plug the dt’s keyboard through the separate microUSB connector to desktop Linux ,and the keyboard is as /dev/ttyACM0 on desktop linux,too

then I flashed the keyboard as the same process

the real programming port of the keyboard is the FPC gpio connector on the back

that is the place to save the keyboard from being a brick if any failed coding happened

4 Likes

Just some feedback here. Just flashed the new firmware. I had to run it twice from ssh, worked perfectly the second time!

WOW. The trackball is like really really good now! It went from “certainly usable” to “This is GREAT!”

Thanks so much for your hard work @foriequal0 and @guu !!!

4 Likes

here is new update for the keyboard followed with new updates from foriequal0’s git code

sudo apt install dfu-util -y

wget https://github.com/clockworkpi/DevTerm/raw/main/Code/devterm_keyboard/bin/DevTerm_keyboard_firmware_v0.21_utils.sh


chmod +x  DevTerm_keyboard_firmware_v0.21_utils.sh

sudo ./DevTerm_keyboard_firmware_v0.21_utils.sh
7 Likes

Flashed the latest version, and I echo others: absolutely massive improvement in trackball usability. Thanks!

1 Like

This is absolutely a must have for any DevTerm user! So glad to see so much development from the community and the clockwork team; even after getting my unit later than most!
Huge kudos sent your way!

3 Likes

little feedback:
first of all thank you very much! it is perfect for long distance (very fast and accurately). but there are a few minor problems, when you are trying to select some detail (short distance moving). Sometimes it is not that good in responding.

2 Likes

status error ? normally re-plug the keyboard will reset the keyboard to be normal state

I need more info if it’s possible

and as I said before, keyboard will be saved if we try to flash it through FPC GPIO connector on the back with firmware in hex format

Please email to alex@clockworkpi.com. I’ll help you through it.

I suspect it might be due to the exponential velocity curve that I’ve applied here:

Can you test the new linear curve and tell me which one do you prefer? You can find it here: GitHub - foriequal0/devterm_keyboard at linear , and you can see what I’ve changed Apply flat curve · foriequal0/devterm_keyboard@71d41e7 · GitHub

And feel free to experiment with the code and make a Pull Request if you want. I’ll appreciate it.

4 Likes

I just flashed it and its great!

I think the issue is in the vertical coordinate, you can reproduce it only scrolling down not too slow and not too fast, it jumps up. My guess is that it overflows the value (It happened to me when I was modifying the firmware).

Just a fast guess, I would have to put serial prints to see the actual values.

2 Likes