Skip to content

Add support for Lemokey P1 HE - #5

Merged
Sainan merged 1 commit into
AnalogSense:senpaifrom
Azarattum:senpai
Mar 8, 2025
Merged

Add support for Lemokey P1 HE#5
Sainan merged 1 commit into
AnalogSense:senpaifrom
Azarattum:senpai

Conversation

@Azarattum

@Azarattum Azarattum commented Mar 8, 2025

Copy link
Copy Markdown
Contributor

Added support for Lemokey P1 HE. Originally brought it up here.

Also I've compiled the custom firmware for this keyboard as well: lemokey_p1_he_ansi_via.bin.zip (tested with JS SDK, works as expected).

@Sainan

Sainan commented Mar 8, 2025

Copy link
Copy Markdown
Member

What modifications did you make to the firmware? I kinda forgot to look at it, but I guess the same patches just need to be applied to the lemokey analog_matrix.

@Sainan
Sainan merged commit 6146382 into AnalogSense:senpai Mar 8, 2025
@Azarattum

Copy link
Copy Markdown
Contributor Author

Yeah. They are exactly the same. I've even copied your version overwrite.

diff --git a/keyboards/lemokey/common/analog_matrix/analog_matrix.c b/keyboards/lemokey/common/analog_matrix/analog_matrix.c
index d4e64c0ec3..21173b1b94 100644
--- a/keyboards/lemokey/common/analog_matrix/analog_matrix.c
+++ b/keyboards/lemokey/common/analog_matrix/analog_matrix.c
@@ -94,6 +94,7 @@ enum {
     AMC_SET_GAME_CONTROLLER_MODE,
 
     AMC_GET_REALTIME_TRAVEL = 0x30,
+    AMC_GET_REALTIME_TRAVEL_ALL,
 
     AMC_CALIBRATE = 0x40,
     AMC_GET_CALIBRATE_STATE,
@@ -811,6 +812,24 @@ bool get_realtime_travel(uint8_t *data) {
     return true;
 }
 
+bool get_realtime_travel_all(uint8_t *data) {
+    uint8_t i = 2;
+
+    for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
+        for (uint8_t c = 0; c < MATRIX_COLS; c++) {
+            data[i++] = analog_key_matrix[r][c].travel;
+            if (i == RAW_EPSIZE) {
+                // Ran out of space for this chunk.
+                raw_hid_send(data, RAW_EPSIZE);
+                i = 2;
+                memset(&data[2], 0, RAW_EPSIZE - 2);
+            }
+        }
+    }
+
+    return true;
+}
+
 void analog_matrix_task(void) {
     calibrate();
     profile_indication_timer_check();
@@ -873,6 +892,7 @@ void analog_matrix_rx(uint8_t *data, uint8_t length) {
     switch (cmd) {
         case AMC_GET_VERSION:
             data[2] = KC_ANALOG_MATRIX_VERSION & 0xFF;
+            data[RAW_EPSIZE - 1] = 0x45;
             break;
 
         case AMC_GET_PROFILES_INFO:
@@ -934,6 +954,10 @@ void analog_matrix_rx(uint8_t *data, uint8_t length) {
             data[2] = success ? 0 : 1;
             break;
 
+        case AMC_GET_REALTIME_TRAVEL_ALL:
+            success = get_realtime_travel_all(data);
+            break;
+
         case AMC_RESET_PROFILE:
             success = profile_reset(data[2]);
             update_travel_configs();
diff --git a/keyboards/lemokey/common/lemokey_raw_hid.c b/keyboards/lemokey/common/lemokey_raw_hid.c
index 30b56f2c7c..fd3b78f3ef 100644
--- a/keyboards/lemokey/common/lemokey_raw_hid.c
+++ b/keyboards/lemokey/common/lemokey_raw_hid.c
@@ -105,6 +105,10 @@ bool kc_raw_hid_rx(uint8_t *data, uint8_t length) {
             itoa((DEVICE_VER >> 4) & 0xF, (char *)&data[i++], 16);
             data[i++] = '.';
             itoa(DEVICE_VER & 0xF, (char *)&data[i++], 16);
+            data[i++] = '+';
+            data[i++] = 'f';
+            data[i++] = 'a';
+            data[i++] = 'r';
             data[i++] = ' ';
             memcpy(&data[i], QMK_BUILDDATE, sizeof(QMK_BUILDDATE));
             i += sizeof(QMK_BUILDDATE);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants