diff --git a/src/config/conf_board.h b/src/config/conf_board.h index 13aaecc5befda25177f686ce392c5dbac0589208..94192c65b53d77c068da0c041a4637f4dfb8c365 100644 --- a/src/config/conf_board.h +++ b/src/config/conf_board.h @@ -30,5 +30,8 @@ #define SETTINGS_R3M_TRIM 0 #define SETTINGS_R30M_TRIM 0 #define SETTINGS_R100M_TRIM 0 +#define SETTINGS_EIS_CAL1 3000U +#define SETTINGS_EIS_CAL2 3000000UL + #endif // CONF_BOARD_H diff --git a/src/settings.c b/src/settings.c index ecbfdad41b003435d58315a0664b70f033ec70bb..50f48cfa0185c4a71bf4f0af2a6340bd7bc8136d 100644 --- a/src/settings.c +++ b/src/settings.c @@ -31,7 +31,7 @@ void settings_handler(char command){ break; case 'W': //Write new settings - scanf("%i%hhu%u%i%i%i%i%i%i%i", + scanf("%i%hhu%u%i%i%i%i%i%i%i%lu%lu", &settings.settings.max5443_offset, &settings.settings.tcs_enabled, &settings.settings.tcs_clear_threshold, @@ -41,7 +41,9 @@ void settings_handler(char command){ &settings.settings.r300k_trim, &settings.settings.r3M_trim, &settings.settings.r30M_trim, - &settings.settings.r100M_trim); + &settings.settings.r100M_trim, + &settings.settings.eis_cal1, + &settings.settings.eis_cal2); settings_write_eeprom(); break; @@ -80,7 +82,9 @@ void settings_read_eeprom(void){ printf("#INFO: r3M_trim = %i\n\r", settings.settings.r3M_trim); printf("#INFO: r30M_trim = %i\n\r", settings.settings.r30M_trim); printf("#INFO: r100M_trim = %i\n\r", settings.settings.r100M_trim); - printf("Smax5443_offset.%u:tcs_enabled.%u:tcs_clear_threshold.%u:r100_trim.%i:r3k_trim.%i:r30k_trim.%i:r300k_trim.%i:r3M_trim.%i:r30M_trim.%i:r100M_trim.%i\n\r", + printf("#INFO: eis_cal1 = %lu\n\r", settings.settings.eis_cal1); + printf("#INFO: eis_cal2 = %lu\n\r", settings.settings.eis_cal2); + printf("Smax5443_offset.%u:tcs_enabled.%u:tcs_clear_threshold.%u:r100_trim.%i:r3k_trim.%i:r30k_trim.%i:r300k_trim.%i:r3M_trim.%i:r30M_trim.%i:r100M_trim.%i:eit_cal1.%lu:eis_cal2.%lu\n\r", settings.settings.max5443_offset, settings.settings.tcs_enabled, settings.settings.tcs_clear_threshold, @@ -90,7 +94,9 @@ void settings_read_eeprom(void){ settings.settings.r300k_trim, settings.settings.r3M_trim, settings.settings.r30M_trim, - settings.settings.r100M_trim); + settings.settings.r100M_trim, + settings.settings.eis_cal1, + settings.settings.eis_cal2); } void settings_write_eeprom(void){ @@ -111,6 +117,8 @@ void settings_restore_defaults(void){ settings.settings.r3M_trim = SETTINGS_R3M_TRIM; settings.settings.r30M_trim = SETTINGS_R30M_TRIM; settings.settings.r100M_trim = SETTINGS_R100M_TRIM; + settings.settings.eis_cal1 = SETTINGS_EIS_CAL1; + settings.settings.eis_cal2 = SETTINGS_EIS_CAL2; settings_write_eeprom(); } diff --git a/src/settings.h b/src/settings.h index c63f014a3dace71c3b3ad69fac62505cd739d9e3..98e53caa90ff9ad6fea28739e5193192a5db5b06 100644 --- a/src/settings.h +++ b/src/settings.h @@ -28,7 +28,9 @@ struct settings_list { //Make sure this doesn't exceed 32 bytes int16_t r300k_trim; int16_t r3M_trim; int16_t r30M_trim; - int16_t r100M_trim; //20 bytes + int16_t r100M_trim; + uint32_t eis_cal1; + uint32_t eis_cal2; //28 bytes }; union {