diff options
Diffstat (limited to 'src/Heating/Sensors/TemperatureSensor.h')
-rw-r--r-- | src/Heating/Sensors/TemperatureSensor.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/Heating/Sensors/TemperatureSensor.h b/src/Heating/Sensors/TemperatureSensor.h index a68a99ea..d4b50a6d 100644 --- a/src/Heating/Sensors/TemperatureSensor.h +++ b/src/Heating/Sensors/TemperatureSensor.h @@ -12,19 +12,19 @@ struct CanSensorReport; class TemperatureSensor { public: - TemperatureSensor(unsigned int sensorNum, const char *type); + TemperatureSensor(unsigned int sensorNum, const char *type) noexcept; // Virtual destructor - virtual ~TemperatureSensor(); + virtual ~TemperatureSensor() noexcept; // Try to get a temperature reading - virtual TemperatureError GetLatestTemperature(float& t, uint8_t outputNumber = 0); + virtual TemperatureError GetLatestTemperature(float& t, uint8_t outputNumber = 0) noexcept; // How many additional outputs does this sensor have - virtual const uint8_t GetNumAdditionalOutputs() const { return 0; } + virtual const uint8_t GetNumAdditionalOutputs() const noexcept { return 0; } // Get the most recent reading without checking for timeout - float GetStoredReading() const { return lastTemperature; } + float GetStoredReading() const noexcept { return lastTemperature; } // Configure the sensor from M308 parameters. // If we find any parameters, process them, if successful then initialise the sensor and return GCodeResult::ok. @@ -33,57 +33,57 @@ public: virtual GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply); // Return the sensor type - const char *GetSensorType() const { return sensorType; } + const char *GetSensorType() const noexcept { return sensorType; } // Return the sensor number - unsigned int GetSensorNumber() const { return sensorNumber; } + unsigned int GetSensorNumber() const noexcept { return sensorNumber; } // Return the code for the most recent error - TemperatureError GetLastError() const { return lastRealError; } + TemperatureError GetLastError() const noexcept { return lastRealError; } // Configure the sensor name, if it is provided void TryConfigureSensorName(GCodeBuffer& gb, bool& seen); // Set the name - normally called only once - void SetSensorName(const char *newName); + void SetSensorName(const char *newName) noexcept; // Get the name. Returns nullptr if no name has been assigned. - const char *GetSensorName() const { return sensorName; } + const char *GetSensorName() const noexcept { return sensorName; } // Copy the basic details to the reply buffer - void CopyBasicDetails(const StringRef& reply) const; + void CopyBasicDetails(const StringRef& reply) const noexcept; // Get/set the next sensor in the linked list - TemperatureSensor *GetNext() const { return next; } - void SetNext(TemperatureSensor *n) { next = n; } + TemperatureSensor *GetNext() const noexcept { return next; } + void SetNext(TemperatureSensor *n) noexcept { next = n; } // Get the smart drivers channel that this sensor monitors, or -1 if it doesn't - virtual int GetSmartDriversChannel() const { return -1; } + virtual int GetSmartDriversChannel() const noexcept { return -1; } #if SUPPORT_CAN_EXPANSION // Get the expansion board address. Overridden for remote sensors. - virtual CanAddress GetBoardAddress() const; + virtual CanAddress GetBoardAddress() const noexcept; // Update the temperature, if it is a remote sensor. Overridden in class RemoteSensor. - virtual void UpdateRemoteTemperature(CanAddress src, const CanSensorReport& report); + virtual void UpdateRemoteTemperature(CanAddress src, const CanSensorReport& report) noexcept; #endif // Factory method #if SUPPORT_CAN_EXPANSION - static TemperatureSensor *Create(unsigned int sensorNum, CanAddress boardAddress, const char *typeName, const StringRef& reply); + static TemperatureSensor *Create(unsigned int sensorNum, CanAddress boardAddress, const char *typeName, const StringRef& reply) noexcept; #else - static TemperatureSensor *Create(unsigned int sensorNum, const char *typeName, const StringRef& reply); + static TemperatureSensor *Create(unsigned int sensorNum, const char *typeName, const StringRef& reply) noexcept; #endif // Try to get a temperature reading - virtual void Poll() = 0; - virtual bool PollInTask() { return false; }; // Classes implementing this method need to also call Heat::EnsureSensorsTask() after succesful configuration + virtual void Poll() noexcept = 0; + virtual bool PollInTask() noexcept { return false; }; // Classes implementing this method need to also call Heat::EnsureSensorsTask() after succesful configuration protected: - void SetResult(float t, TemperatureError rslt); - void SetResult(TemperatureError rslt); + void SetResult(float t, TemperatureError rslt) noexcept; + void SetResult(TemperatureError rslt) noexcept; - static TemperatureError GetPT100Temperature(float& t, uint16_t ohmsx100); // shared function used by two derived classes + static TemperatureError GetPT100Temperature(float& t, uint16_t ohmsx100) noexcept; // shared function used by two derived classes private: static constexpr uint32_t TemperatureReadingTimeout = 2000; // any reading older than this number of milliseconds is considered unreliable |