diff --git a/keyboards/keychron/common/analog_matrix/analog_matrix.c b/keyboards/keychron/common/analog_matrix/analog_matrix.c index 4d3862a431..579b086cf9 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, @@ -786,6 +787,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(); @@ -899,6 +918,10 @@ void analog_matrix_rx(uint8_t *data, uint8_t length) { success = get_realtime_travel(&data[2]); 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 3e1433eecd..9bab1d1823 100644 --- a/keyboards/keychron/common/analog_matrix/analog_matrix_eeconfig.h +++ b/keyboards/keychron/common/analog_matrix/analog_matrix_eeconfig.h @@ -26,7 +26,7 @@ #define CURVE_POINTS_COUNT 4 -#define KC_ANALOG_MATRIX_VERSION 0x34340002 +#define KC_ANALOG_MATRIX_VERSION 0x34340003 #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