diff options
author | David Crocker <dcrocker@eschertech.com> | 2017-06-11 00:19:50 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2017-06-11 00:23:47 +0300 |
commit | 310b7c0e1ae92d65421276c3779efeddfb6977ff (patch) | |
tree | 56afba8162017646c4f1a47b8da0512482c7f336 /src/Heating/Sensors/TemperatureSensor.h | |
parent | d026b0e4d2a7d5fda771e843cfca12e0370440d7 (diff) |
Version 1.19beta6
Refactored temperatyure sensor code
Refactored fan control code
Support invisible axes (M584 P parameter)
Supprt user-defined virtual heaters
Support heater names
Support proportional thermostatic fan control
Fix G10 retraction command
Removed delta probe code
Diffstat (limited to 'src/Heating/Sensors/TemperatureSensor.h')
-rw-r--r-- | src/Heating/Sensors/TemperatureSensor.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/Heating/Sensors/TemperatureSensor.h b/src/Heating/Sensors/TemperatureSensor.h new file mode 100644 index 00000000..26aec74e --- /dev/null +++ b/src/Heating/Sensors/TemperatureSensor.h @@ -0,0 +1,55 @@ +#ifndef TEMPERATURESENSOR_H +#define TEMPERATURESENSOR_H + +#include "RepRapFirmware.h" +#include "Heating/TemperatureError.h" // for result codes + +class GCodeBuffer; + +class TemperatureSensor +{ +public: + TemperatureSensor(unsigned int chan, const char *type); + + // Configure the sensor from M305 parameters. + // If we find any parameters, process them and return true. If an error occurs while processing them, set 'error' to true and write an error message to 'reply. + // if we find no relevant parameters, report the current parameters to 'reply' and return 'false'. + virtual bool Configure(unsigned int mCode, unsigned int heater, GCodeBuffer& gb, StringRef& reply, bool& error); + + // Initialise or re-initialise the temperature sensor + virtual void Init() = 0; + + // Try to get a temperature reading + virtual TemperatureError GetTemperature(float& t) = 0; + + // Return the channel number + unsigned int GetSensorChannel() const { return sensorChannel; } + + // Return the sensor type + const char *GetSensorType() const { return sensorType; } + + // Configure then heater name, if it is provided + void TryConfigureHeaterName(GCodeBuffer& gb, bool& seen); + + // Virtual destructor + virtual ~TemperatureSensor(); + + // Set the name - normally called only once + void SetHeaterName(const char *newName); + + // Get the name. Returns nullptr if no name has been assigned. + const char *GetHeaterName() const { return heaterName; } + + // Factory method + static TemperatureSensor *Create(unsigned int channel); + +protected: + void CopyBasicHeaterDetails(unsigned int heater, StringRef& reply) const; + +private: + const unsigned int sensorChannel; + const char * const sensorType; + const char *heaterName; +}; + +#endif // TEMPERATURESENSOR_H |