ESPHome 2026.6.0-dev
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::ufire_ise {
10
11static const float PROBE_MV_TO_PH = 59.2;
12static const float PROBE_TMP_CORRECTION = 0.03;
13
14static const uint8_t CONFIG_TEMP_COMPENSATION = 0x02;
15
16static const uint8_t REGISTER_VERSION = 0;
17static const uint8_t REGISTER_MV = 1;
18static const uint8_t REGISTER_TEMP = 5;
19static const uint8_t REGISTER_REFHIGH = 13;
20static const uint8_t REGISTER_REFLOW = 17;
21static const uint8_t REGISTER_READHIGH = 21;
22static const uint8_t REGISTER_READLOW = 25;
23static const uint8_t REGISTER_SOLUTION = 29;
24static const uint8_t REGISTER_CONFIG = 38;
25static const uint8_t REGISTER_TASK = 39;
26
27static const uint8_t COMMAND_CALIBRATE_HIGH = 8;
28static const uint8_t COMMAND_CALIBRATE_LOW = 10;
29static const uint8_t COMMAND_MEASURE_TEMP = 40;
30static const uint8_t COMMAND_MEASURE_MV = 80;
31
33 public:
34 void setup() override;
35 void update() override;
36 void dump_config() override;
37
38 void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
40 this->temperature_sensor_external_ = temperature_sensor;
41 }
42 void set_ph_sensor(sensor::Sensor *ph_sensor) { this->ph_sensor_ = ph_sensor; }
43 void calibrate_probe_low(float solution);
44 void calibrate_probe_high(float solution);
45 void reset_board();
46
47 protected:
49 float measure_mv_();
50 float measure_ph_(float temperature);
51 void set_solution_(float solution);
52 float read_data_(uint8_t reg);
53 void write_data_(uint8_t reg, float data);
54 void update_internal_();
55
59};
60
61template<typename... Ts> class UFireISECalibrateProbeLowAction : public Action<Ts...> {
62 public:
64 TEMPLATABLE_VALUE(float, solution)
65
66 void play(const Ts &...x) override { this->parent_->calibrate_probe_low(this->solution_.value(x...)); }
67
68 protected:
70};
71
72template<typename... Ts> class UFireISECalibrateProbeHighAction : public Action<Ts...> {
73 public:
75 TEMPLATABLE_VALUE(float, solution)
76
77 void play(const Ts &...x) override { this->parent_->calibrate_probe_high(this->solution_.value(x...)); }
78
79 protected:
81};
82
83template<typename... Ts> class UFireISEResetAction : public Action<Ts...> {
84 public:
86
87 void play(const Ts &...x) override { this->parent_->reset_board(); }
88
89 protected:
91};
92
93} // namespace esphome::ufire_ise
virtual void play(const Ts &...x)=0
This class simplifies creating components that periodically check a state.
Definition component.h:585
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
Definition i2c.h:152
Base-class for all sensors.
Definition sensor.h:47
UFireISECalibrateProbeHighAction(UFireISEComponent *parent)
Definition ufire_ise.h:74
TEMPLATABLE_VALUE(float, solution) void play(const Ts &...x) override
Definition ufire_ise.h:75
UFireISECalibrateProbeLowAction(UFireISEComponent *parent)
Definition ufire_ise.h:63
TEMPLATABLE_VALUE(float, solution) void play(const Ts &...x) override
Definition ufire_ise.h:64
void set_temperature_sensor_external(sensor::Sensor *temperature_sensor)
Definition ufire_ise.h:39
void write_data_(uint8_t reg, float data)
sensor::Sensor * temperature_sensor_external_
Definition ufire_ise.h:57
void set_ph_sensor(sensor::Sensor *ph_sensor)
Definition ufire_ise.h:42
void calibrate_probe_low(float solution)
float measure_ph_(float temperature)
Definition ufire_ise.cpp:66
void calibrate_probe_high(float solution)
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition ufire_ise.h:38
void play(const Ts &...x) override
Definition ufire_ise.h:87
UFireISEResetAction(UFireISEComponent *parent)
Definition ufire_ise.h:85
uint16_t temperature
Definition sun_gtil2.cpp:12
uint16_t x
Definition tt21100.cpp:5