Unfortunately, the firmware-update script was broken before, and did not add
this file. Lets do that now.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
macOS has the E00 (left of `1`) and B00 (between `shift` and `z`) keys swapped.
Our layout display code, the floating 104-key picker assumes a different layout.
So for display purposes, when reading from macOS layouts, swap E00 and B00.
Together with the previous commit, this fixes#1014, and makes the Croatian
layout *almost* correct on Windows and Linux too, with only one symbol
mis-mapped. There's nothing we can do about that at the moment.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When printing layout cards, the header does not add any useful information, but
takes up space - and colors - on the first page. Lets not show the header when
printing the layout card screen.
We do show it for everything else.
Fixes#943.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
`useEffectOnce`, just like `useEffect` itself, needs a plain, non-async
function. So instead of using doing initialization directly in the effect, push
it into an async function called _from_ the effect. The same pattern we use
elsewhere.
This gets rid of an error printed on the dev console when leaving the Layout
Cards screen.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
We want to present the list of supported layouts grouped by their language (or
if that is unavailable, the language code, or group), and the groups should be
alphabetically sorted too.
To achieve this, we need to sort the list the same way we group them.
Addresses another issue identified in #649.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Similarly how we treat `altR+caps?` as valid altR mapping, we need to treat
`shift+caps?`, `shift+cmd?`, and other combinations of `shift` and optional
modifiers as shift.
This addresses one part of #1014.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When flashing new firmware, the storage layout may change, and parts of it may
change owners. While we restore the previous contents in a structured manner, if
previously used space changes owner to a plugin that is new in the updated
firmware, it would start with random garbage in its storage slice.
To avoid this situation, clear the EEPROM before flashing, so when we restore,
we restore onto a fresh, empty state.
Fixes#934.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Our old flashing process suffered from a few shortcomings, biggest of which was
its reliance on timing, and retries being woefully incomplete. In practice, this
meant that if the key to help trigger bootloader mode was not pressed soon
enough, or was released too late, we ended up in a state Chrysalis could not
recover from, because it never tried the reset again.
The new process does away with the separate "bootloaderTrigger" and
"bootloaderWait" steps, and combines them into a single "bootloader" step, which
will take care of retrying the reboot too, whether from normal mode to
bootloader, or the other way around. This also moves the retry logic into the
flasher, out of `@api/focus`.
With the logic in the flasher, it can properly notify the renderer when the
keyboard is in an unexpected state, and the renderer can - and with this patch,
does - display an appropriate message the user can act on.
With retries in place, the flashing process should be more robust, and more
forgiving, and far less reliant on timing.
Fixes#941, and likely a whole lot of other, flashing related issues.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
The option to support an external flasher when there's an internal default was
introduced as a workaround for a bug we have fixed long since. It was only
available on Windows, for two devices, and had to be opted into.
As the bug it was meant to work around is no more, lets drop this unnecessary
complexity, along with the win32 avrdude shipped with Chrysalis.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
As long as this function existed, it was practically a no-op, it succeeded as
long as there was at least one USB device connected, of any kind. It did not
perform adequate checks to see if the requested VID/PID pair is among them.
This worked, because the flashing process rebooted the keyboard before checking
for the presence of a bootloader, so by the time we went to check, it was always
there anyway.
Things fell apart as soon as the function was supposed to do a real check. This
patch makes it do what it was always supposed to do: iterate over the devices
found, and only return success if the desired one is among them.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
We need a `focusDeviceDescriptor` for this function, which we were pulling out
of `activeDevice.focus` previously. However, for keyboards already in bootloader
mode, there is no `activeDevice` to pull from.
FirmwareUpdate itself already has the descriptor via props, and doesn't need to
pull it from anywhere else, so move `defaultFirmwareFilename` back there, where
we have all the information we need at hand anyway.
This, along with the previous commit, fixes flashing when starting from
bootloader mode.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
If we're "connected" to a keyboard, but do not have an `activeDevice`, then do
not make the Layout Cards screen available. This can happen if we're connected
to a device in bootloader mode, where layout cards do not make sense.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
We can land on the FirmwareUpdate page without having an `activeDevice` (such as
when the keyboard is in bootloader mode), don't try to query the active device,
but report the firmware version as unavailable.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
To allow the rest of the cells some more space to display, restrict the layer
name column to 33% of the total.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When formatting labels during the Overview widget's rendering, use custom layer
names, if available.
Together with the previous commit, this fixes#1003.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When adding custom layer names support, I added them for the Model100 and
Model01, but forgot all about the rest of them. This patch corrects that, and
adds custom layer name support for the rest of the keyboards.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
In case we can't detect the firmware version, display a default saying so,
rather than having a bit of empty space. Also display a suitably sized skeleton
box while the version is being retrieved.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
The `useFirmwareAutoUpdate` hook was initially copied from `useAutoUpdate`, and
as part of the process, it set the `updateAvailable` state on the global
context. That's unrelated to firmware auto-updates, and the hook should not
touch it at all, so this patch removes that.
The result of the mistake was that whenever there was a firmware update,
Chrysalis' main sidebar also showed an "Apply update & restart" menu item by
mistake. With the hook not fiddling with state it has no business with, this is
no longer the case.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>