Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always reload keymap on any module change. #1063

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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