Over this weekend I overhauled the scanning module.
XTant turned out to be quite a temperamental beast and I started seeing double actuations and sometimes even "d3f" when quicky typing "df". Scoping showed wildly fluctuating voltages when "d" key is pressed - discharge periods I had were not enough to pull the line all the way to the ground. Had to add 10us wait after reading to quiet those down. Also seems like some keys (but not others) physically bounce on keypress, causing double actuations.
So I implemented slightly modified algorithm from
this document, and it works like a charm, while simplifying threshold management. I use 5 bits for debouncing buffer, so it generates keypress on 4th successive reading above (below for beamspring) threshold. Which takes about 1.5ms.
Bonus is that new debouncing algo uses half as much CPU because of less array lookups.
I also chose not to put the case back, so now I have this on my table:
- xtant.jpg (72.28 KiB) Viewed 7617 times
For those who already has previous version flashed (__red__, I'm talking about you!) - EXPORT YOUR LAYOUT BEFORE UPGRADING! EEPROM layout has changed, and base layer of the layout uses the space occupied by HiThresholds previously.