ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
SensorDS18B20.h
Go to the documentation of this file.
1#pragma once
2/*
3* c_SensorDS18B20.h
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2018, 2024 Shelby Merrick
7* http://www.forkineye.com
8*
9* This program is provided free for you to use in any way that you wish,
10* subject to the laws and regulations where you are using it. Due diligence
11* is strongly suggested before using this code. Please give credit where due.
12*
13* The Author makes no warranty of any kind, express or implied, with regard
14* to this program or the documentation contained in this document. The
15* Author shall not be liable in any event for incidental or consequential
16* damages in connection with, or arising out of, the furnishing, performance
17* or use of these programs.
18*
19*/
20
21#include "ESPixelStick.h"
22
23#ifdef SUPPORT_SENSOR_DS18B20
24
25#ifdef ESP32
26# include <WiFi.h>
27# include <AsyncUDP.h>
28#else
29# error Platform not supported
30#endif
31
32class c_SensorDS18B20
33{
34private:
35 enum TempUnit_t
36 {
37 TempUnitCentegrade = 0,
38 TempUnitFahrenheit,
39 };
40 TempUnit_t TempUnit = TempUnit_t::TempUnitCentegrade;
41 uint8_t SensorPresent = 0;
42 time_t LastReadingTime = 0;
43 float LastReading = 0.0;
44
45public:
46 c_SensorDS18B20 () {};
47 virtual ~c_SensorDS18B20() {}
48
49 void Begin ();
50 void Poll ();
51 void GetConfig (JsonObject& json);
52 bool SetConfig (JsonObject& json);
53 void GetStatus (JsonObject& json);
54
55 void GetDriverName (String & name) {name = "TempSensor";}
56};
57
58extern c_SensorDS18B20 SensorDS18B20;
59#endif // def SUPPORT_SENSOR_DS18B20
void GetDriverName(String &Name)
Definition main.cpp:115
void GetConfig(JsonObject &json)
Definition main.cpp:440
void SetConfig(const char *DataString)
Definition main.cpp:286