Simplify the control flow of UsbCommand_ApplyConfig() a bit.
This commit is contained in:
@@ -48,14 +48,12 @@ void UsbCommand_ApplyConfig(void)
|
|||||||
// Switch to the keymap of the updated configuration of the same name or the default keymap.
|
// Switch to the keymap of the updated configuration of the same name or the default keymap.
|
||||||
|
|
||||||
for (uint8_t keymapId = 0; keymapId < AllKeymapsCount; keymapId++) {
|
for (uint8_t keymapId = 0; keymapId < AllKeymapsCount; keymapId++) {
|
||||||
if (AllKeymaps[keymapId].abbreviationLen != oldKeymapAbbreviationLen) {
|
if (AllKeymaps[keymapId].abbreviationLen == oldKeymapAbbreviationLen &&
|
||||||
continue;
|
!memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen))
|
||||||
|
{
|
||||||
|
SwitchKeymap(keymapId);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
SwitchKeymap(keymapId);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchKeymap(DefaultKeymapIndex);
|
SwitchKeymap(DefaultKeymapIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user