Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
3c132bd0 AW |
2 | this file is part of smoothie (http://smoothieware.org/). the motion control part is heavily based on grbl (https://github.com/simen/grbl). |
3 | smoothie is free software: you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation, either version 3 of the license, or (at your option) any later version. | |
4 | smoothie is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. see the gnu general public license for more details. | |
df27a6a3 | 5 | you should have received a copy of the gnu general public license along with smoothie. if not, see <http://www.gnu.org/licenses/>. |
cd011f58 AW |
6 | */ |
7 | ||
76f53dc6 JM |
8 | #ifndef TEMPERATURECONTROL_H |
9 | #define TEMPERATURECONTROL_H | |
ded56b35 | 10 | |
aa4d694a | 11 | #include "Module.h" |
827a49ca | 12 | #include "Pwm.h" |
9d955060 | 13 | #include "TempSensor.h" |
2fa50ca0 | 14 | #include "TemperatureControlPublicAccess.h" |
e84c3be3 | 15 | |
ded56b35 | 16 | class TemperatureControl : public Module { |
47339e4a | 17 | |
b19aa09d | 18 | public: |
8e8b938e | 19 | TemperatureControl(uint16_t name, int index); |
d8baddd9 | 20 | ~TemperatureControl(); |
907d5e8a | 21 | |
ded56b35 | 22 | void on_module_loaded(); |
b6c86164 | 23 | void on_main_loop(void* argument); |
b0be67b5 | 24 | void on_gcode_received(void* argument); |
8ccab7cf | 25 | void on_second_tick(void* argument); |
b19aa09d | 26 | void on_get_public_data(void* argument); |
77047e76 | 27 | void on_set_public_data(void* argument); |
3d1a4519 | 28 | void on_halt(void* argument); |
8ccab7cf | 29 | |
1ad23cd3 | 30 | void set_desired_temperature(float desired_temperature); |
10e66797 | 31 | |
8e8b938e JM |
32 | float get_temperature(); |
33 | ||
10e66797 JM |
34 | friend class PID_Autotuner; |
35 | ||
36 | private: | |
71cc73eb | 37 | void load_config(); |
d8baddd9 | 38 | uint32_t thermistor_read_tick(uint32_t dummy); |
1ad23cd3 | 39 | void pid_process(float); |
907d5e8a | 40 | |
8e8b938e JM |
41 | int pool_index; |
42 | ||
1ad23cd3 | 43 | float target_temperature; |
3a014cbb | 44 | float max_temp, min_temp; |
ded56b35 | 45 | |
1ad23cd3 MM |
46 | float preset1; |
47 | float preset2; | |
f4bd4fc3 | 48 | |
d8baddd9 | 49 | TempSensor *sensor; |
2fa50ca0 | 50 | |
907d5e8a | 51 | // PID runtime |
1ad23cd3 | 52 | float i_max; |
907d5e8a | 53 | |
907d5e8a MM |
54 | int o; |
55 | ||
1ad23cd3 | 56 | float last_reading; |
907d5e8a | 57 | |
1ad23cd3 | 58 | float readings_per_second; |
ded56b35 | 59 | |
3c132bd0 AW |
60 | uint16_t name_checksum; |
61 | ||
7dee00e4 | 62 | Pwm heater_pin; |
907d5e8a | 63 | |
1306ba99 AW |
64 | uint16_t set_m_code; |
65 | uint16_t set_and_wait_m_code; | |
66 | uint16_t get_m_code; | |
2fa50ca0 | 67 | struct pad_temperature public_data_return; |
7b625dcc | 68 | |
e0d0ea84 | 69 | std::string designator; |
3c308aeb | 70 | |
1ad23cd3 MM |
71 | void setPIDp(float p); |
72 | void setPIDi(float i); | |
73 | void setPIDd(float d); | |
201e6dcf | 74 | |
989d0e94 | 75 | float hysteresis; |
1ad23cd3 MM |
76 | float iTerm; |
77 | float lastInput; | |
201e6dcf | 78 | // PID settings |
1ad23cd3 MM |
79 | float p_factor; |
80 | float i_factor; | |
81 | float d_factor; | |
82 | float PIDdt; | |
08f89868 JM |
83 | |
84 | struct { | |
85 | bool use_bangbang:1; | |
86 | bool waiting:1; | |
01004e36 | 87 | bool temp_violated:1; |
08f89868 JM |
88 | bool link_to_tool:1; |
89 | bool active:1; | |
90 | bool readonly:1; | |
91 | bool windup:1; | |
f1e38d95 | 92 | bool sensor_settings:1; |
08f89868 | 93 | }; |
ded56b35 AW |
94 | }; |
95 | ||
96 | #endif |