move checksum defines into cpp from h
[clinton/Smoothieware.git] / src / modules / tools / temperaturecontrol / PID_Autotuner.h
1 /**
2 * Based on https://github.com/br3ttb/Arduino-PID-AutoTune-Library
3 */
4
5 #ifndef _PID_AUTOTUNE_H
6 #define _PID_AUTOTUNE_H
7
8 #include <stdint.h>
9
10 #include "Module.h"
11 #include "TemperatureControl.h"
12 #include "StreamOutput.h"
13
14 class PID_Autotuner : public Module
15 {
16 public:
17 PID_Autotuner();
18 void begin(TemperatureControl *, double, StreamOutput *, int cycles = 8);
19 void abort();
20
21 void on_module_loaded(void);
22 uint32_t on_tick(uint32_t);
23 void on_idle(void *);
24 void on_gcode_received(void *);
25
26 private:
27 void finishUp();
28
29 TemperatureControl *t;
30 float target_temperature;
31 StreamOutput *s;
32
33 volatile bool tick;
34
35 float *peaks;
36 int requested_cycles;
37 float noiseBand;
38 unsigned long peak1, peak2;
39 int sampleTime;
40 int nLookBack;
41 int lookBackCnt;
42 int peakType;
43 float *lastInputs;
44 int peakCount;
45 bool justchanged;
46 float absMax, absMin;
47 float oStep;
48 int output;
49 unsigned long tickCnt;
50 };
51
52 #endif /* _PID_AUTOTUNE_H */