
Menelaus: A firmware for the Atreus keyboard, written in Microscheme - lelf
https://atreus.technomancy.us/firmware
======
Syzygies
QMK is an amazing project. I'm using it for three keyboards so far.

That said, tweaking the behavior of tap/hold dual function keys is voodoo.
There are a few flags one can set, or one can replace the keystroke inner
loop, which I'm about to do. 18 of my 30 core alpha keys are dual function,
either modifiers or access to other layers. I have many shortcuts that involve
one finger from each hand in sequence, easy chording. However, change
keyboards and I trip over myself on fast ordinary typing, accidentally
triggering sequences that rearrange the orbits of the planets. (I used to use
Emacs, so I'm used to this.)

Everyone types differently, so "this works for me" rarely helps. Every
mechanical switch activates differently, so one can adapt to one keyboard and
be back at ground zero on another keyboard.

Scheme would be great for creating a DSL implementing arbitrary flow charts
for the state transitions as keypresses register down or up, and timers fire.
Writing this in C is tedious. And if chording ever "just worked" many more
people would adopt it.

~~~
jkaptur
Any advice for getting started in QMK? I'm an experienced programmer, so every
tutorial that starts with git and the basics of C is frustrating, but I don't
have a lot of experience with hardware, keyboards, etc.

For example, I have no idea what "keystroke inner loop" you're referring to -
where can I read more about that?

~~~
technomancy
The docs for using QMK are pretty good, but trying to actually understand the
code made my head spin; that's why I decided to write my own firmware. Right
now it doesn't have any of the fancy features of QMK, but it currently clocks
in at under 200 lines, so I have a suspicion it'd be easier to implement those
features from scratch in Microscheme than understand their current
implementation in QMK.

~~~
Syzygies
There's a middle ground. One wants to take advantage of the prior work
supporting all these keyboards, while improving and/or making more
understandable the core keystroke processing logic. Develop a user language
for this logic, that translates to C code that can be included in QMK?

~~~
technomancy
If the root problem with QMK is that there are too many moving parts, adding a
completely new language and compiler into the mix seems like a step in the
wrong direction.

The extra features that QMK has and Menelaus doesn't aren't really all that
appealing to me to begin with.

------
1MachineElf
Title ahould contain "(2015)" \- you'll see the "2015-01-07" date at the
bottom.

The original Atreus was programmed with Microscheme, but it has not been that
way for a few years at least. TMK was the recommended firmware when I started
using one in 2016. Currently you'll see QMK as the defacto. That will likely
change this year after the Atreus 2 is released. The kickstarter campaign for
it launched one week ago.

Scheme still is used in the project, just not for firmware. The git repo has a
scheme program in it to generate a PCB for an Atreus provided one specifies
the desired number of rows, number of columns, angle, and column-stagger.

------
thaumasiotes
Geez, I feel like by the time you're releasing utilities named "Menelaus" for
your product named "Atreus", you kind of need to address the question "why is
your product named after a guy whose only notable feature was that all of his
descendants experienced ruin and death?"

~~~
technomancy
That's a good point, but it ignores two other notable descendants: Orestes
(who is legendary for establishing the precursor to the modern judicial system
and who I named my firmware written in Forth after
[http://github.com/technomancy/orestes](http://github.com/technomancy/orestes))
and Paul Atreides, who as you may know was Muad'Dib and was capable of seeing
the flow of cause and effect unfold across spacetime.

------
jmiskovic
That code is as procedural as it gets. MicroPython would be a far more natural
fit, I think.

~~~
technomancy
MicroPython would not work; a basic hello world in MicroPython takes 3x more
memory than the total amount of RAM of the atmega32u4.

------
dang
We changed the URL from
[https://git.sr.ht/~technomancy/menelaus/tree/master/README.m...](https://git.sr.ht/~technomancy/menelaus/tree/master/README.md)
to the article that's linked there, which gives more background.

~~~
technomancy
Hi; original author here.

That article goes into more background but it's based on a much earlier
version of the firmware; as of last week I've gotten it to be feature-complete
and stable, and I've been using it as my daily driver.

I have been meaning to follow up the article with a part 3 that covers the
rest of the features, but in the mean time I have added copious comments to
the source link above such that it covers almost everything you need to know.
(This is probably the most heavily-commented piece of code I've ever written
with a 1:1 code:comments ratio.)

I have also been working on a GUI configuration tool in Racket that emits
Microscheme source files you can compile and upload to your keyboard:
[https://git.sr.ht/~technomancy/menelaus/tree/master/gui.rkt](https://git.sr.ht/~technomancy/menelaus/tree/master/gui.rkt)
[https://p.hagelb.org/menelaus.png](https://p.hagelb.org/menelaus.png)

If you've looked at building an Atreus before but gotten intimidated by the
soldering, we have a kickstarter for a non-DIY version that's significantly
cheaper than the kit:
[https://www.kickstarter.com/projects/keyboardio/atreus](https://www.kickstarter.com/projects/keyboardio/atreus)

~~~
dang
Would you prefer us to switch the link back? Author's call!

Also, is the title inaccurate?

~~~
technomancy
Thanks; the title is fine. The current link is probably a better starting
point; I've added links to the most recent revision so folks can see the final
product if they want.

