Skip to content

Commit

Permalink
Merge pull request #1063 from UltimateHackingKeyboard/always_reload_k…
Browse files Browse the repository at this point in the history
…eymap_on_module

Always reload keymap on any module change.
  • Loading branch information
mondalaci authored Dec 27, 2024
2 parents 890a617 + 925b017 commit 10704b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions device/src/state_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ static void receiveModuleStateData(sync_command_module_state_t *buffer) {
uhk_module_state_t *moduleState = &UhkModuleStates[driverId];

// once we have multiple left modules, reload keymap here
bool leftModuleChanged = buffer->slotId != SlotId_LeftKeyboardHalf && moduleState->moduleId != buffer->moduleId;

module_connection_state_t *moduleConnectionState = &ModuleConnectionStates[driverId];
moduleConnectionState->moduleId = buffer->moduleId;
Expand All @@ -249,6 +250,10 @@ static void receiveModuleStateData(sync_command_module_state_t *buffer) {
Utils_SafeStrCopy(moduleState->gitRepo, buffer->gitRepo, MAX_STRING_PROPERTY_LENGTH);
Utils_SafeStrCopy(moduleState->gitTag, buffer->gitTag, MAX_STRING_PROPERTY_LENGTH);
memcpy(moduleState->firmwareChecksum, buffer->firmwareChecksum, MD5_CHECKSUM_LENGTH);

if (DEVICE_IS_UHK80_RIGHT && leftModuleChanged) {
EventVector_Set(EventVector_KeymapReloadNeeded);
}
}

static void receiveProperty(device_id_t src, state_sync_prop_id_t propId, const uint8_t *data, uint8_t len) {
Expand Down
4 changes: 2 additions & 2 deletions right/src/slave_drivers/uhk_module_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "state_sync.h"
#else
#include "peripherals/test_led.h"
#include "test_switches.h"
#include "device.h"
#endif

Expand All @@ -27,6 +26,7 @@
#include "macros/core.h"
#include "versioning.h"
#include "layouts/key_layout_60_to_universal.h"
#include "test_switches.h"

uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_SLOT_COUNT];
module_connection_state_t ModuleConnectionStates[UHK_MODULE_MAX_SLOT_COUNT];
Expand Down Expand Up @@ -113,7 +113,7 @@ static void reloadKeymapIfNeeded()
someoneElseWillDoTheJob |= uhkModuleState->moduleId == 0 && slave->isConnected;
}
#ifdef __ZEPHYR__
if (DEVICE_ID == DeviceId_Uhk80_Right) {
if (DEVICE_ID == DeviceId_Uhk80_Right && !TestSwitches) {
EventVector_Set(EventVector_KeymapReloadNeeded);
EventVector_WakeMain();
}
Expand Down

0 comments on commit 10704b7

Please sign in to comment.