Data Structures |
struct | heater_definition_t |
| simply holds pinout data- port, pin, pwm channel if used More...
|
struct | EE_factor |
| this lives in the eeprom so we can save our PID settings for each heater More...
|
Defines |
#define | DEFINE_HEATER(name, port, pin, pwm) { &(port), (pin), &(pwm) }, |
| helper macro to fill heater definition struct from config.h
|
#define | DEFAULT_P 8192 |
| default scaled P factor, equivalent to 8.0
|
#define | DEFAULT_I 512 |
| default scaled I factor, equivalent to 0.5
|
#define | DEFAULT_D 24576 |
| default scaled D factor, equivalent to 24
|
#define | DEFAULT_I_LIMIT 384 |
| default scaled I limit
|
Functions |
void | heater_init () |
| initialise heater subsystem Set directions, initialise PWM timers, read PID factors from eeprom, etc
|
void | heater_save_settings () |
| Write PID factors to eeprom.
|
void | heater_tick (heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t target_temp) |
| run heater PID algorithm
|
void | heater_set (heater_t index, uint8_t value) |
| manually set PWM output
|
uint8_t | heaters_all_off () |
| turn off all heaters
|
void | pid_set_p (heater_t index, int32_t p) |
| set heater P factor
|
void | pid_set_i (heater_t index, int32_t i) |
| set heater I factor
|
void | pid_set_d (heater_t index, int32_t d) |
| set heater D factor
|
void | pid_set_i_limit (heater_t index, int32_t i_limit) |
| set heater I limit
|
void | heater_print (uint16_t i) |
| send heater debug info to host
|
Variables |
struct { |
int32_t p_factor |
| scaled P factor
|
int32_t i_factor |
| scaled I factor
|
int32_t d_factor |
| scaled D factor
|
int16_t i_limit |
| scaled I limit, such that
|
} | heaters_pid [NUM_HEATERS] |
struct { |
int16_t heater_i |
| integrator,
|
uint16_t temp_history [TH_COUNT] |
| store last TH_COUNT readings in a ring, so we can smooth out our differentiator
|
uint8_t temp_history_pointer |
| pointer to last entry in ring
|
uint8_t heater_output |
| this is the PID value we eventually send to the heater
|
} | heaters_runtime [NUM_HEATERS] |
EE_factor EEMEM | EE_factors [NUM_HEATERS] |
Manage heaters.