diff --git a/right/src/usb_commands/usb_command_apply_config.c b/right/src/usb_commands/usb_command_apply_config.c index 8824c79..88e6c7d 100644 --- a/right/src/usb_commands/usb_command_apply_config.c +++ b/right/src/usb_commands/usb_command_apply_config.c @@ -48,14 +48,12 @@ void UsbCommand_ApplyConfig(void) // Switch to the keymap of the updated configuration of the same name or the default keymap. for (uint8_t keymapId = 0; keymapId < AllKeymapsCount; keymapId++) { - if (AllKeymaps[keymapId].abbreviationLen != oldKeymapAbbreviationLen) { - continue; + if (AllKeymaps[keymapId].abbreviationLen == oldKeymapAbbreviationLen && + !memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen)) + { + SwitchKeymap(keymapId); + return; } - if (memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen)) { - continue; - } - SwitchKeymap(keymapId); - return; } SwitchKeymap(DefaultKeymapIndex);