ESPHome 2025.5.0
Loading...
Searching...
No Matches
ufire_ise.h
Go to the documentation of this file.
1#pragma once
2
5#include "esphome/core/hal.h"
8
9namespace esphome {
10namespace ufire_ise {
11
12static const float PROBE_MV_TO_PH = 59.2;
13static const float PROBE_TMP_CORRECTION = 0.03;
14
15static const uint8_t CONFIG_TEMP_COMPENSATION = 0x02;
16
17static const uint8_t REGISTER_VERSION = 0;
18static const uint8_t REGISTER_MV = 1;
19static const uint8_t REGISTER_TEMP = 5;
20static const uint8_t REGISTER_REFHIGH = 13;
21static const uint8_t REGISTER_REFLOW = 17;
22static const uint8_t REGISTER_READHIGH = 21;
23static const uint8_t REGISTER_READLOW = 25;
24static const uint8_t REGISTER_SOLUTION = 29;
25static const uint8_t REGISTER_CONFIG = 38;
26static const uint8_t REGISTER_TASK = 39;
27
28static const uint8_t COMMAND_CALIBRATE_HIGH = 8;
29static const uint8_t COMMAND_CALIBRATE_LOW = 10;
30static const uint8_t COMMAND_MEASURE_TEMP = 40;
31static const uint8_t COMMAND_MEASURE_MV = 80;
32
34 public:
35 void setup() override;
36 void update() override;
37 void dump_config() override;
38
39 void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
41 this->temperature_sensor_external_ = temperature_sensor;
42 }
43 void set_ph_sensor(sensor::Sensor *ph_sensor) { this->ph_sensor_ = ph_sensor; }
44 void calibrate_probe_low(float solution);
45 void calibrate_probe_high(float solution);
46 void reset_board();
47
48 protected:
50 float measure_mv_();
51 float measure_ph_(float temperature);
52 void set_solution_(float solution);
53 float read_data_(uint8_t reg);
54 void write_data_(uint8_t reg, float data);
55 void update_internal_();
56
60};
61
62template<typename... Ts> class UFireISECalibrateProbeLowAction : public Action<Ts...> {
63 public:
65 TEMPLATABLE_VALUE(float, solution)
66
67 void play(Ts... x) override { this->parent_->calibrate_probe_low(this->solution_.value(x...)); }
68
69 protected:
71};
72
73template<typename... Ts> class UFireISECalibrateProbeHighAction : public Action<Ts...> {
74 public:
76 TEMPLATABLE_VALUE(float, solution)
77
78 void play(Ts... x) override { this->parent_->calibrate_probe_high(this->solution_.value(x...)); }
79
80 protected:
82};
83
84template<typename... Ts> class UFireISEResetAction : public Action<Ts...> {
85 public:
87
88 void play(Ts... x) override { this->parent_->reset_board(); }
89
90 protected:
92};
93
94} // namespace ufire_ise
95} // namespace esphome
virtual void play(Ts... x)=0
This class simplifies creating components that periodically check a state.
Definition component.h:301
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
Definition i2c.h:153
Base-class for all sensors.
Definition sensor.h:57
UFireISECalibrateProbeHighAction(UFireISEComponent *parent)
Definition ufire_ise.h:75
TEMPLATABLE_VALUE(float, solution) void play(Ts... x) override
Definition ufire_ise.h:76
TEMPLATABLE_VALUE(float, solution) void play(Ts... x) override
Definition ufire_ise.h:65
UFireISECalibrateProbeLowAction(UFireISEComponent *parent)
Definition ufire_ise.h:64
void set_temperature_sensor_external(sensor::Sensor *temperature_sensor)
Definition ufire_ise.h:40
void write_data_(uint8_t reg, float data)
sensor::Sensor * temperature_sensor_external_
Definition ufire_ise.h:58
void set_ph_sensor(sensor::Sensor *ph_sensor)
Definition ufire_ise.h:43
void calibrate_probe_low(float solution)
float measure_ph_(float temperature)
Definition ufire_ise.cpp:69
void calibrate_probe_high(float solution)
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition ufire_ise.h:39
UFireISEResetAction(UFireISEComponent *parent)
Definition ufire_ise.h:86
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t temperature
Definition sun_gtil2.cpp:12
uint16_t x
Definition tt21100.cpp:5