# versionInfoMacro - get actual firmware version

**URL:** https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467
**Category:** Programming
**Created:** [January 28, 2019, 3:28am UTC](https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467 "2019-01-28T03:28:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rickcogley](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/rickcogley/32/2478_2.png) [@rickcogley](https://community.keyboard.io/u/rickcogley)
#### Post date: [January 28, 2019, 3:28am UTC](https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467/1 "2019-01-28T03:28:26Z")

</div>

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:

```auto
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…)

---

<div class="post-metadata">

### Author: ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)
#### Post date: [January 28, 2019, 8:37am UTC](https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467/2 "2019-01-28T08:37:41Z")

</div>

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](https://git.madhouse-project.org/algernon/Kaleidoscope-Focus-Version) that adds a `version` Focus command. It relies on the build system to supply it with enough information, like [this](https://git.madhouse-project.org/algernon/Model01-Sketch/src/branch/master/.kaleidoscope-builder.conf#L29-L36), and you need to set up [your sketch too](https://git.madhouse-project.org/algernon/Model01-Sketch/src/branch/master/src/algernon.ino#L112-L114).

Gives output like this:

```nohighlight
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.

---

<div class="post-metadata">

### Author: ![rickcogley](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/rickcogley/32/2478_2.png) [@rickcogley](https://community.keyboard.io/u/rickcogley)
#### Post date: [January 28, 2019, 8:43am UTC](https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467/3 "2019-01-28T08:43:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![flussence](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/flussence/32/19_2.png) [@flussence](https://community.keyboard.io/u/flussence)
#### Post date: [January 29, 2019, 6:43pm UTC](https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467/4 "2019-01-29T18:43:36Z")

</div>

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

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

```

and that gets me this output:

```auto
Keyboardio Model 01 - Kaleidoscope v1.22-47-gcf6234b77e96-dirty

```

---

<div class="post-metadata">

### Author: ![rickcogley](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/rickcogley/32/2478_2.png) [@rickcogley](https://community.keyboard.io/u/rickcogley)
#### Post date: [January 29, 2019, 11:13pm UTC](https://community.keyboard.io/t/versioninfomacro-get-actual-firmware-version/2467/5 "2019-01-29T23:13:09Z")

</div>

Thanks for the tip, @flussence
