Add settings load function for PID parameters
This commit is contained in:
		@@ -22,8 +22,7 @@
 | 
			
		||||
#define __SETTINGS_SETTINGS_SD_CARD_H__
 | 
			
		||||
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
#define CALIBRATION_FILE_NAME "settings.ini"
 | 
			
		||||
#include <reflow-controller/settings/settings.h>
 | 
			
		||||
 | 
			
		||||
int sd_card_settings_save_calibration(float sens_deviation, float offset, bool active);
 | 
			
		||||
 | 
			
		||||
@@ -35,4 +34,6 @@ int sd_card_settings_save_calibration(float sens_deviation, float offset, bool a
 | 
			
		||||
 */
 | 
			
		||||
int sd_card_settings_try_load_calibration(float *sens_deviation, float *offset);
 | 
			
		||||
 | 
			
		||||
enum settings_load_result sd_card_settings_load_pid_oven_parameters(struct oven_pid_settings *settings);
 | 
			
		||||
 | 
			
		||||
#endif /* __SETTINGS_SETTINGS_SD_CARD_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,23 @@
 | 
			
		||||
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
struct oven_pid_settings {
 | 
			
		||||
	float kd;
 | 
			
		||||
	float kp;
 | 
			
		||||
	float ki;
 | 
			
		||||
	float t_sample;
 | 
			
		||||
	float max_integral;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum settings_load_result {
 | 
			
		||||
	SETT_LOAD_SUCCESS = 0,
 | 
			
		||||
	SETT_LOAD_FILE_NOT_FOUND,
 | 
			
		||||
	SETT_LOAD_ERR,
 | 
			
		||||
	SETT_LOAD_DISK_ERR
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define SETTINGS_PID_PARAMETER_FILE "pid.conf"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Save the calibration
 | 
			
		||||
 * @param sens_deviation
 | 
			
		||||
@@ -34,4 +51,6 @@ int settings_save_calibration(float sens_deviation, float offset, bool active);
 | 
			
		||||
 | 
			
		||||
int settings_load_calibration(float *sens_dev, float *offset);
 | 
			
		||||
 | 
			
		||||
enum settings_load_result settings_load_pid_oven_parameters(struct oven_pid_settings *settings);
 | 
			
		||||
 | 
			
		||||
#endif /* __SETTINGS_SETTINGS_H__ */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user