// This module implements saving and restoring the configurable parameters // to/from the data eeprom memory. #pragma once #include #include #include "ahrs_task.h" #include "control.h" #include "motor.h" #include "rf_task.h" void parameters_save(); bool parameters_load(); void parameters_print(BaseSequentialStream *chp, bool machine_readable); bool parameter_set(const char *name, int32_t value); bool parameter_get(const char *name, int32_t *value); // This is an X-macro list of the parameters to save. // All variables should be 32-bit integers. // X(variable) #define PARAMETERS \ X(pitch_ctrl.P) \ X(pitch_ctrl.I) \ X(pitch_ctrl.D) \ X(pitch_ctrl.lowpass) \ X(pitch_ctrl.min_output) \ X(pitch_ctrl.max_output) \ X(heading_ctrl.P) \ X(heading_ctrl.I) \ X(heading_ctrl.D) \ X(heading_ctrl.lowpass) \ X(heading_ctrl.min_output) \ X(heading_ctrl.max_output) \ X(servo_center) \ X(servo_delta) \ X(AHRS_MAG_BIAS_X) \ X(AHRS_MAG_BIAS_Y) \ X(AHRS_MAG_BIAS_Z) \ X(AHRS_MAG_SCALE_X) \ X(AHRS_MAG_SCALE_Y) \ X(AHRS_MAG_SCALE_Z) \ X(AHRS_ACC_BIAS_X) \ X(AHRS_ACC_BIAS_Y) \ X(AHRS_ACC_BIAS_Z) \ X(AHRS_ACC_SCALE_X) \ X(AHRS_ACC_SCALE_Y) \ X(AHRS_ACC_SCALE_Z) \ X(AHRS_MAG_SERVO_BIAS_X_A) \ X(AHRS_MAG_SERVO_BIAS_X_B) \ X(AHRS_MAG_SERVO_BIAS_X_C) \ X(AHRS_MAG_SERVO_BIAS_Y_A) \ X(AHRS_MAG_SERVO_BIAS_Y_B) \ X(AHRS_MAG_SERVO_BIAS_Y_C) \ X(AHRS_MAG_SERVO_BIAS_Z_A) \ X(AHRS_MAG_SERVO_BIAS_Z_B) \ X(AHRS_MAG_SERVO_BIAS_Z_C) \ X(rf_max_delay_ms) \ X(CONTROL_ZERO_PITCH) // Increment this to force reset of all parameters. // Do that if you reorder the existing items, adding new items to end is ok. #define PARAMETERS_VERSION 1