versionInfoMacro - get actual firmware version

Hi - last weekend I decided to give the Arduino compiler a try, and got my first sketch compiling. All I had to do was to patiently read things including the github wiki, and the source code of the base sketch, to get it compiling and loading on my Model 01-Q. Thanks for those instructions!

Now I’m looking into making a macro to toggle my Japanese IME between English and Japanese (ctrl-space’ -ll do it), since that’s a key I use so many times a day. As I study a bit about macros, I notice this bit of code in the sketch:

static void versionInfoMacro(uint8_t keyState) {
  if (keyToggledOn(keyState)) {
    Macros.type(PSTR("Keyboardio Model 01-Q #003831 - Kaleidoscope "));
    Macros.type(PSTR(BUILD_INFORMATION));
  }
}

I added in the string from the label on the back of the keyboard into the included macro that outputs the version info, but I thought it would be good to add in some relevant info about the actual version of the firmware that the sketch is using.

Any way to do that automatically, checking what’s actually loaded? (the github doesn’t have things organized by release or anything, so this might be a challenge since the firmware is actually multiple header files…)

If you are compiling via the Arduino IDE, I don’t think there’s a decent solution yet. If using the CLI, I have a half-baked plugin that adds a version Focus command. It relies on the build system to supply it with enough information, like this, and you need to set up your sketch too.

Gives output like this:

Kaleidoscope#1cf25da4 algernon/Model01-Sketch#a61155d

It should be reasonably easy to use a macro to type the same text. In any case, as of right now, figuring out a useful firmware version is complicated. We chould probably have a hard-coded version and bump it on release… but that won’t help much if using the master branch of Kaleidoscope from git, and it would be way too easy to forget bumping it.

1 Like

thanks @algernon, if I have a free weekend I might try it!

I’ve got a (cheaty?) way of doing it when building from the command line, put this in Model01-Firmware/.kaleidoscope-builder.conf:

LOCAL_CFLAGS="-DBUILD_INFORMATION=\"$(git describe --dirty)\""

and that gets me this output:

Keyboardio Model 01 - Kaleidoscope v1.22-47-gcf6234b77e96-dirty
1 Like

Thanks for the tip, @flussence