Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Fix "universal" keyid parsing for uhk60 and bump config version.
Browse files Browse the repository at this point in the history
  • Loading branch information
kareltucek committed Oct 18, 2024
1 parent 819708f commit 39ad8e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion right/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void CopyRightKeystateMatrix(void)
uint8_t targetKeyId;

// TODO: optimize this? This translation is quite costly :-/
if (DataModelVersion.major >= 8) {
if (VERSION_AT_LEAST(DataModelVersion, 8, 2, 0)) {
targetKeyId = KeyLayout_Uhk60_to_Universal[SlotId_RightKeyboardHalf][keyId];
} else {
targetKeyId = keyId;
Expand Down
11 changes: 8 additions & 3 deletions right/src/slave_drivers/uhk_module_driver.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <string.h>
#include "config_parser/parse_config.h"
#include "i2c_addresses.h"
#include "i2c.h"

Expand Down Expand Up @@ -133,14 +134,18 @@ void UhkModuleSlaveDriver_ProcessKeystates(uint8_t uhkModuleDriverId, uhk_module
uint8_t targetKeyId;

// TODO: optimize this? This translation is quite costly :-/
if (DataModelVersion.major >= 8 && uhkModuleDriverId == UhkModuleDriverId_LeftKeyboardHalf) {
if (
DEVICE_IS_UHK60
&& VERSION_AT_LEAST(DataModelVersion, 8, 2, 0)
&& uhkModuleDriverId == UhkModuleDriverId_LeftKeyboardHalf
) {
targetKeyId = KeyLayout_Uhk60_to_Universal[SlotId_LeftKeyboardHalf][keyId];
} else {
targetKeyId = keyId;
}

if (KeyStates[slotId][targetKeyId].hardwareSwitchState != keyStatesBuffer[targetKeyId]) {
KeyStates[slotId][targetKeyId].hardwareSwitchState = keyStatesBuffer[targetKeyId];
if (KeyStates[slotId][targetKeyId].hardwareSwitchState != keyStatesBuffer[keyId]) {
KeyStates[slotId][targetKeyId].hardwareSwitchState = keyStatesBuffer[keyId];
stateChanged = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"firmwareVersion": "11.2.0",
"deviceProtocolVersion": "4.10.0",
"moduleProtocolVersion": "4.3.0",
"userConfigVersion": "8.1.0",
"userConfigVersion": "8.2.0",
"hardwareConfigVersion": "1.0.0",
"smartMacrosVersion": "2.5.0",
"devices": [
Expand Down

0 comments on commit 39ad8e0

Please sign in to comment.