diff --git a/device/src/state_sync.c b/device/src/state_sync.c index bac8bf47e..a2c9e5651 100644 --- a/device/src/state_sync.c +++ b/device/src/state_sync.c @@ -234,8 +234,10 @@ void receiveBacklight(sync_command_backlight_t *buffer) { static void receiveModuleStateData(sync_command_module_state_t *buffer) { uint8_t driverId = UhkModuleSlaveDriver_SlotIdToDriverId(buffer->slotId); uhk_module_state_t *moduleState = &UhkModuleStates[driverId]; - module_connection_state_t *moduleConnectionState = &ModuleConnectionStates[driverId]; + // once we have multiple left modules, reload keymap here + + module_connection_state_t *moduleConnectionState = &ModuleConnectionStates[driverId]; moduleConnectionState->moduleId = buffer->moduleId; moduleState->moduleId = buffer->moduleId; moduleState->moduleProtocolVersion = buffer->moduleProtocolVersion; diff --git a/right/src/config_parser/parse_keymap.c b/right/src/config_parser/parse_keymap.c index 9e7380a30..d472e1d91 100644 --- a/right/src/config_parser/parse_keymap.c +++ b/right/src/config_parser/parse_keymap.c @@ -254,15 +254,18 @@ static parser_error_t parseLayer(config_buffer_t *buffer, uint8_t layer, parse_m } } - // if current config doesn't configuration of the connected module, fill in hardwired values + // if current config doesn't contain configuration of the connected module, fill in hardwired values bool rightUhkModuleUnmapped = moduleCount <= UhkModuleStates[UhkModuleSlaveDriver_SlotIdToDriverId(SlotId_RightModule)].moduleId; bool touchpadUnmapped = moduleCount <= ModuleId_TouchpadRight && IsModuleAttached(ModuleId_TouchpadRight); if (rightUhkModuleUnmapped || touchpadUnmapped) { applyDefaultRightModuleActions(layer, parseMode); } - // if current config doesn't configuration of the connected module, fill in hardwired values - if (moduleCount <= UhkModuleStates[UhkModuleSlaveDriver_SlotIdToDriverId(SlotId_LeftModule)].moduleId) { + // if current config doesn't contain configuration of the connected module, fill in hardwired values + uint8_t leftModuleId = UhkModuleStates[UhkModuleSlaveDriver_SlotIdToDriverId(SlotId_LeftModule)].moduleId; + bool leftUhkModuleUnmapped = moduleCount <= leftModuleId; + bool keyclusterUnmapped = moduleCount <= ModuleId_KeyClusterLeft; + if ((leftModuleId != 0 && leftUhkModuleUnmapped) || (leftModuleId == 0 && keyclusterUnmapped)) { applyDefaultLeftModuleActions(layer, parseMode); }