diff --git a/keyboards/truestrike42/config.h b/keyboards/truestrike42/config.h index 5a42d84964e..fa59ed6b85c 100644 --- a/keyboards/truestrike42/config.h +++ b/keyboards/truestrike42/config.h @@ -29,7 +29,7 @@ #define DEFAULT_BOTTOMING_READING 0 #define DEFAULT_CALIBRATION_STARTER true -#define EECONFIG_KB_DATA_SIZE 256 +#define EECONFIG_KB_DATA_SIZE 105 #define DEBUG_MATRIX_SCAN_RATE diff --git a/keyboards/truestrike42/he_switch_matrix.h b/keyboards/truestrike42/he_switch_matrix.h index 98421a14e89..27c5bd16148 100644 --- a/keyboards/truestrike42/he_switch_matrix.h +++ b/keyboards/truestrike42/he_switch_matrix.h @@ -49,6 +49,9 @@ typedef struct { uint16_t bottoming_reading[MATRIX_ROWS][MATRIX_COLS]; // bottoming reading } he_config_t; +// Check if the size of the reserved persistent memory is the same as the size of struct eeprom_ec_config_t +_Static_assert(sizeof(eeprom_he_config_t) == EECONFIG_KB_DATA_SIZE, "Mismatch in keyboard EECONFIG stored data"); + extern eeprom_he_config_t eeprom_he_config; extern he_config_t he_config; diff --git a/keyboards/truestrike42/truestrike42.c b/keyboards/truestrike42/truestrike42.c index df9dce9308e..62fb4eedeec 100644 --- a/keyboards/truestrike42/truestrike42.c +++ b/keyboards/truestrike42/truestrike42.c @@ -39,7 +39,7 @@ void eeconfig_init_kb(void) { } } // Write default value to EEPROM now - eeconfig_update_kb_datablock(&eeprom_he_config); + eeconfig_update_kb_datablock(&eeprom_he_config, 0, EECONFIG_KB_DATA_SIZE); eeconfig_init_user(); } @@ -50,7 +50,7 @@ void keyboard_post_init_kb(void) { keyboard_post_init_user(); // Read custom menu variables from memory - eeconfig_read_kb_datablock(&eeprom_he_config); + eeconfig_read_kb_datablock(&eeprom_he_config, 0, EECONFIG_KB_DATA_SIZE); // Set runtime values to EEPROM values he_config.actuation_mode = eeprom_he_config.actuation_mode; diff --git a/keyboards/truestrike42/via_he.c b/keyboards/truestrike42/via_he.c index 145d7f8e8db..1673aeb2483 100644 --- a/keyboards/truestrike42/via_he.c +++ b/keyboards/truestrike42/via_he.c @@ -262,7 +262,7 @@ void he_save_threshold_data(uint8_t option) { eeprom_he_config.mode_1_release_offset = he_config.mode_1_release_offset; he_rescale_values(2); } - eeconfig_update_kb_datablock(&eeprom_he_config); + eeconfig_update_kb_datablock(&eeprom_he_config, 0, EECONFIG_KB_DATA_SIZE); uprintf("####################################\n"); uprintf("# New thresholds applied and saved #\n"); uprintf("####################################\n"); @@ -287,7 +287,7 @@ void he_save_bottoming_reading(void) { he_rescale_values(0); he_rescale_values(1); he_rescale_values(2); - eeconfig_update_kb_datablock(&eeprom_he_config); + eeconfig_update_kb_datablock(&eeprom_he_config, 0, EECONFIG_KB_DATA_SIZE); } // Show the calibration data