14 return static_cast<uint8_t
>(
kT7LogicalBase + (slot - 1) * 16 + ain);
18 return static_cast<uint16_t
>(
board_id * 100 + ain);
22 const double uv = std::round(
volts * 1e6);
23 if (!std::isfinite(uv))
25 return static_cast<int32_t
>(
26 std::clamp(uv,
static_cast<double>(INT32_MIN),
static_cast<double>(INT32_MAX)));
38 if (!cfg.t7_errors.empty())
40 for (
const auto&
b : cfg.t7_boards) {
43 const std::string key =
44 b.section.rfind(
"boards.", 0) == 0 ?
b.section.substr(7) :
b.section;
45 for (
const auto& c :
b.channels) {
46 if (c.kind !=
"PT" && c.kind !=
"LC" && c.kind !=
"TC" && c.kind !=
"RTD")
50 t.board_id =
b.board_id;
53 t.uid =
t7_uid(
b.board_id, c.ain);
75 if (c.channel.kind ==
"TC")
77 return {s.begin(), s.end()};
81 std::vector<std::pair<uint8_t, uint8_t>> out;
83 const auto id =
table_id(c.slot,
static_cast<uint8_t
>(c.channel.ain));
84 out.emplace_back(
id[0],
id[1]);
88 out.emplace_back(
id[0],
id[1]);
std::map< uint16_t, size_t > by_uid_
const T7CalChannel * by_uid(uint16_t uid) const
std::vector< uint8_t > tc_slots() const
Slots with at least one TC (they publish a cold-junction table).
std::vector< T7CalChannel > channels_
std::map< std::pair< uint8_t, uint8_t >, size_t > by_table_
T7CalibrationMap()=default
std::vector< std::pair< uint8_t, uint8_t > > raw_tables() const
Raw tables calibration_service subscribes to: every input above, plus each TC slot's CJC.
const T7CalChannel * by_table(uint8_t slot, uint8_t ain) const
The input behind raw table {0x26, (slot-1)*0x20 + ain}, or nullptr.
*brief create JSON pointer *sa reference_tokens const string_t const string_t & b
*brief remove last reference token *sa JSON pointer has no nullptr
constexpr uint8_t kCjcTableOffset
Raw-table offset (within a slot's 32-entry block) of the cold-junction table: AIN15 does not exist on...
std::array< uint8_t, 2 > cjc_table_id(uint8_t slot)
Cold-junction table id for a slot.
constexpr uint8_t kTypeHi
Elodin table-id high byte for T7 analog inputs (0x20-0x25 are the ESP32 sensor types).
int32_t t7_counts(double volts)
The calibration "ADC code" for a T7 reading: microvolts, rounded and clamped to int32.
std::array< uint8_t, 2 > table_id(uint8_t slot, uint8_t ain)
Table id for one AIN: {0x26, (slot-1)*0x20 + ain}, the same layout as the ESP32 boards.
double t7_volts(double counts)
Volts from a calibration code.
constexpr uint8_t kT7LogicalBase
First logical calibration channel for T7 inputs.
uint16_t t7_uid(int board_id, int ain)
uid of a T7 input: board_id * 100 + ain, the ESP32 scheme with the AIN as connector.
uint8_t t7_logical_channel(uint8_t slot, uint8_t ain)
Logical calibration channel for a T7 input.
Motorized ball valve position: raw ADC counts -> % open.
The whole parsed config.toml, restricted to what C++ consumes.
One T7 input as calibration sees it.
static double volts(uint32_t code)
Shunt volts for a code, as calibration_main's convert_hp_pt_to_pressure computes it.