Heater for threaded program
Dependents: LEX_Threaded_Programming_V3
Diff: Heater.h
- Revision:
- 46:47c394467c66
- Parent:
- 45:5f588512529b
- Child:
- 48:cd2a9b799e89
--- a/Heater.h Sat Nov 16 06:05:55 2019 +0000 +++ b/Heater.h Mon Nov 18 13:48:31 2019 +0000 @@ -12,6 +12,8 @@ #include "FastPWM.h" #include "memspcr.pb.h" +#define R_SMOOTH_FACTOR 0.5 // resisstance smoothing factor (0 = no smoothing, 1 = infinite smoothing) + class Heater { //This class provides the interface through which each heater can be controlled @@ -52,7 +54,8 @@ int curr; //Latest current reading from ADC int v; //Latest voltage reading from ADC float R; //Latest resistance calculated from ADC current and voltage - float R_avg; //Average resitance since last log event + float R_smooth; //Smoothed resistance for more noise-tolerant heater control + float R_avg; //Average resistance since last log event float R_var; //Variance resistance since last log event float R_acc; //Accumulated sum of resistance values since last log event float R2_acc; //Accumulated sum of squares of resistance values since last log event