diff --git a/keyboards/keychron/common/analog_matrix/analog_matrix.c b/keyboards/keychron/common/analog_matrix/analog_matrix.c index d4e64c0ec3fd..1b53ce1d4d1e 100644 --- a/keyboards/keychron/common/analog_matrix/analog_matrix.c +++ b/keyboards/keychron/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(); @@ -940,6 +959,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_SAVE_PROFILE: success = profile_save(data[2]); data[2] = success ? 0 : 1; diff --git a/keyboards/keychron/common/analog_matrix/analog_matrix_eeconfig.h b/keyboards/keychron/common/analog_matrix/analog_matrix_eeconfig.h index a8fa4c823a7d..331ad6026835 100644 --- a/keyboards/keychron/common/analog_matrix/analog_matrix_eeconfig.h +++ b/keyboards/keychron/common/analog_matrix/analog_matrix_eeconfig.h @@ -30,7 +30,7 @@ #define CURVE_POINTS_COUNT 4 -#define KC_ANALOG_MATRIX_VERSION 0x34340004 +#define KC_ANALOG_MATRIX_VERSION 0x34340005 #define SIZE_OF_CALIB_VALUE_T 3 // Size of calibrated_value_t #define SIZE_OF_ANALOG_KEY_CONFIG_T 4 // Size of analog_key_config_t #define SIZE_OF_OKMC_CONFIG_T 19 // Size of okmc_config_t