Commit | Line | Data |
---|---|---|
43424972 JM |
1 | /** |
2 | * Based on https://github.com/br3ttb/Arduino-PID-AutoTune-Library | |
3 | */ | |
4 | ||
3c308aeb MM |
5 | #ifndef _PID_AUTOTUNE_H |
6 | #define _PID_AUTOTUNE_H | |
7 | ||
8 | #include <stdint.h> | |
9 | ||
10 | #include "Module.h" | |
9ef9c12a JM |
11 | |
12 | class TemperatureControl; | |
13 | class StreamOutput; | |
3c308aeb | 14 | |
3c308aeb MM |
15 | class PID_Autotuner : public Module |
16 | { | |
17 | public: | |
43424972 | 18 | PID_Autotuner(); |
3c308aeb | 19 | |
8e8b938e | 20 | void on_module_loaded(void); |
3c308aeb | 21 | uint32_t on_tick(uint32_t); |
8e8b938e JM |
22 | void on_idle(void *); |
23 | void on_gcode_received(void *); | |
3c308aeb | 24 | |
43424972 | 25 | private: |
8e8b938e JM |
26 | void begin(float, StreamOutput *, int ); |
27 | void abort(); | |
43424972 | 28 | void finishUp(); |
827a49ca | 29 | |
8e8b938e | 30 | TemperatureControl *temp_control; |
43424972 | 31 | float target_temperature; |
3c308aeb MM |
32 | StreamOutput *s; |
33 | ||
f2fa9ba2 MM |
34 | volatile bool tick; |
35 | ||
43424972 JM |
36 | float *peaks; |
37 | int requested_cycles; | |
38 | float noiseBand; | |
39 | unsigned long peak1, peak2; | |
40 | int sampleTime; | |
41 | int nLookBack; | |
42 | int lookBackCnt; | |
43 | int peakType; | |
44 | float *lastInputs; | |
45 | int peakCount; | |
46 | bool justchanged; | |
47 | float absMax, absMin; | |
48 | float oStep; | |
49 | int output; | |
50 | unsigned long tickCnt; | |
3c308aeb MM |
51 | }; |
52 | ||
53 | #endif /* _PID_AUTOTUNE_H */ |