debug and smoothing
This commit is contained in:
@ -11,10 +11,10 @@
|
||||
#include <Metro.h>
|
||||
#include "cmd.h"
|
||||
|
||||
const bool DEBUG = false;
|
||||
const bool DEBUG = true;
|
||||
const bool INFO = true;
|
||||
|
||||
const unsigned long DEFAULT_PERIOD = 10000;
|
||||
const unsigned long DEFAULT_PERIOD = 1000;
|
||||
const unsigned int NUM_OF_CHANNELS = 4;
|
||||
const unsigned long N_MAX = 0xffffff;
|
||||
const float R_REF = 6000.0;
|
||||
@ -23,20 +23,53 @@ const float PT1000_Coeff = 3.85e-3;
|
||||
const unsigned long CONV_TIMEOUT = 0xfffff;
|
||||
|
||||
|
||||
|
||||
class Thermometer;
|
||||
|
||||
class ThermConfig : public Cmd {
|
||||
public:
|
||||
ThermConfig(Thermometer *thermometer) : m_thermometer(thermometer) {};
|
||||
virtual String getCmdName() { return "TCFG"; }
|
||||
virtual String getHelp() { return "Thermometer configuration operations"; }
|
||||
virtual String exec(String params);
|
||||
private:
|
||||
Thermometer *m_thermometer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class Thermometer {
|
||||
public:
|
||||
Thermometer();
|
||||
void begin(CmdServer *cmdServer);
|
||||
void exec();
|
||||
friend class ThermConfig;
|
||||
|
||||
private:
|
||||
Metro m_period;
|
||||
unsigned long m_periodMillis;
|
||||
ThermConfig thermConfig;
|
||||
|
||||
bool m_debug;
|
||||
bool m_info;
|
||||
|
||||
unsigned long m_n[NUM_OF_CHANNELS];
|
||||
float m_calibrateFactor[NUM_OF_CHANNELS];
|
||||
float m_temperature[NUM_OF_CHANNELS];
|
||||
float m_lastSmoothedTemperature[NUM_OF_CHANNELS];
|
||||
float m_smoothedTemperature[NUM_OF_CHANNELS];
|
||||
unsigned long m_timeOutFailureCnt;
|
||||
unsigned long m_cylceCnt;
|
||||
|
||||
float m_alpha;
|
||||
|
||||
void startSingleConv();
|
||||
void prepareAdc();
|
||||
|
||||
void setTemperature(unsigned int index, float t);
|
||||
void setPeriodMeasure(unsigned long p);
|
||||
void setAlpha(float a);
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user