esp8266_web_settings beta
ThermistorSensor.h
1/*
2 * Copyright (c) 2021, 2022 G. R. McDorman
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23#pragma once
24
25#include <Arduino.h>
26
27#include "grmcdorman/device/AbstractAnalog.h"
28#include "grmcdorman/Setting.h"
29
30namespace grmcdorman::device
31{
73 {
74 public:
81 ThermistorSensor(float thermalIndex, float t1Kelvin);
82
83 DynamicJsonDocument as_json() const override;
84
93 virtual String get_status() const;
94 protected:
104 virtual float transform_raw_reading(int reading) override;
107 NoteSetting title;
108 InfoSettingHtml device_status;
109 };
110}
Abstract analog device.
Definition: AbstractAnalog.h:46
A thermistor analog device.
Definition: ThermistorSensor.h:73
ThermistorSensor(float thermalIndex, float t1Kelvin)
Construct a new ThermistorSensor object.
Definition: ThermistorSensor.cpp:63
float inverse_thermal_index
The inverse of thermal index of the thermistor.
Definition: ThermistorSensor.h:105
DynamicJsonDocument as_json() const override
Get the values, as a JSON document.
Definition: ThermistorSensor.cpp:88
InfoSettingHtml device_status
Last update.
Definition: ThermistorSensor.h:108
virtual String get_status() const
Get a status report.
Definition: ThermistorSensor.cpp:102
virtual float transform_raw_reading(int reading) override
Transform the raw reading to a temperature.
Definition: ThermistorSensor.cpp:122
NoteSetting title
Device tab title.
Definition: ThermistorSensor.h:107
float inverse_t1
The inverse of the T1 temperature of the thermistor.
Definition: ThermistorSensor.h:106