HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
ValveManager.h
Go to the documentation of this file.
1
37#ifndef FLUX_VALVE_MANAGER_H_
38#define FLUX_VALVE_MANAGER_H_
39
40#include <array>
41#include <atomic>
42#include <cstdint>
43#include <optional>
44#include <string_view>
45
46#include "RtosMutex.h"
48#include "handlers/max22200/Max22200Handler.h"
49#include "handlers/tle92466ed/Tle92466edHandler.h"
50
51//==============================================================================
52// VALVE ERROR CODES
53//==============================================================================
54
62enum class hf_valve_err_t : uint8_t {
63 // Success
64 VALVE_SUCCESS = 0,
65
66 // General errors
73
74 // Communication errors (SPI layer)
80
81 // Driver-level errors
90
91 // Manager-level errors
94
95 // Catch-all
97};
98
104constexpr const char* HfValveErrToString(hf_valve_err_t err) noexcept {
105 switch (err) {
106 case hf_valve_err_t::VALVE_SUCCESS: return "Success";
107 case hf_valve_err_t::VALVE_ERR_NOT_INITIALIZED: return "Manager not initialized";
108 case hf_valve_err_t::VALVE_ERR_DRIVER_NOT_AVAILABLE: return "Driver IC not available";
109 case hf_valve_err_t::VALVE_ERR_INVALID_CHANNEL: return "Invalid channel for operation";
110 case hf_valve_err_t::VALVE_ERR_CHANNEL_TYPE_MISMATCH: return "Channel type mismatch (sol/prop)";
111 case hf_valve_err_t::VALVE_ERR_INVALID_PARAMETER: return "Invalid parameter value";
112 case hf_valve_err_t::VALVE_ERR_NULL_POINTER: return "Null handler/driver pointer";
113 case hf_valve_err_t::VALVE_ERR_SPI_BUS_ERROR: return "SPI bus communication error";
114 case hf_valve_err_t::VALVE_ERR_SPI_TIMEOUT: return "SPI transfer timeout";
115 case hf_valve_err_t::VALVE_ERR_SPI_TRANSFER_FAILED: return "SPI data transfer failed";
116 case hf_valve_err_t::VALVE_ERR_SPI_CRC_ERROR: return "SPI CRC mismatch";
117 case hf_valve_err_t::VALVE_ERR_SPI_FRAME_ERROR: return "SPI frame error from device";
118 case hf_valve_err_t::VALVE_ERR_HARDWARE_FAULT: return "Hardware fault detected";
119 case hf_valve_err_t::VALVE_ERR_DEVICE_NOT_RESPONDING: return "Device not responding";
120 case hf_valve_err_t::VALVE_ERR_WRONG_DEVICE_ID: return "Wrong device ID";
121 case hf_valve_err_t::VALVE_ERR_REGISTER_ERROR: return "Register read/write error";
122 case hf_valve_err_t::VALVE_ERR_CONFIGURATION_ERROR: return "Configuration failed";
123 case hf_valve_err_t::VALVE_ERR_WRONG_MODE: return "Operation not allowed in mode";
124 case hf_valve_err_t::VALVE_ERR_WRITE_TO_READ_ONLY: return "Write to read-only register";
125 case hf_valve_err_t::VALVE_ERR_TIMEOUT: return "Operation timeout";
126 case hf_valve_err_t::VALVE_ERR_MUTEX_TIMEOUT: return "Mutex acquisition timeout";
127 case hf_valve_err_t::VALVE_ERR_DEPENDENCY_NOT_READY: return "Required dependency not ready";
128 case hf_valve_err_t::VALVE_ERR_UNKNOWN: return "Unknown error";
129 default: return "Unknown valve error";
130 }
131}
132
138constexpr bool HfValveErrOk(hf_valve_err_t err) noexcept {
139 return err == hf_valve_err_t::VALVE_SUCCESS;
140}
141
142// ─── Driver Error Mappings ──────────────────────────────────────────────────
143
149constexpr hf_valve_err_t TleDriverErrorToValveError(tle92466ed::DriverError e) noexcept {
150 switch (e) {
151 case tle92466ed::DriverError::None: return hf_valve_err_t::VALVE_SUCCESS;
152 case tle92466ed::DriverError::NotInitialized: return hf_valve_err_t::VALVE_ERR_NOT_INITIALIZED;
153 case tle92466ed::DriverError::HardwareError: return hf_valve_err_t::VALVE_ERR_HARDWARE_FAULT;
154 case tle92466ed::DriverError::InvalidChannel: return hf_valve_err_t::VALVE_ERR_INVALID_CHANNEL;
155 case tle92466ed::DriverError::InvalidParameter: return hf_valve_err_t::VALVE_ERR_INVALID_PARAMETER;
156 case tle92466ed::DriverError::DeviceNotResponding: return hf_valve_err_t::VALVE_ERR_DEVICE_NOT_RESPONDING;
157 case tle92466ed::DriverError::WrongDeviceID: return hf_valve_err_t::VALVE_ERR_WRONG_DEVICE_ID;
158 case tle92466ed::DriverError::RegisterError: return hf_valve_err_t::VALVE_ERR_REGISTER_ERROR;
159 case tle92466ed::DriverError::CRCError: return hf_valve_err_t::VALVE_ERR_SPI_CRC_ERROR;
160 case tle92466ed::DriverError::FaultDetected: return hf_valve_err_t::VALVE_ERR_HARDWARE_FAULT;
161 case tle92466ed::DriverError::ConfigurationError: return hf_valve_err_t::VALVE_ERR_CONFIGURATION_ERROR;
162 case tle92466ed::DriverError::TimeoutError: return hf_valve_err_t::VALVE_ERR_TIMEOUT;
163 case tle92466ed::DriverError::WrongMode: return hf_valve_err_t::VALVE_ERR_WRONG_MODE;
164 case tle92466ed::DriverError::SPIFrameError: return hf_valve_err_t::VALVE_ERR_SPI_FRAME_ERROR;
165 case tle92466ed::DriverError::WriteToReadOnly: return hf_valve_err_t::VALVE_ERR_WRITE_TO_READ_ONLY;
166 default: return hf_valve_err_t::VALVE_ERR_UNKNOWN;
167 }
168}
169
175constexpr hf_valve_err_t MaxDriverStatusToValveError(max22200::DriverStatus s) noexcept {
176 switch (s) {
177 case max22200::DriverStatus::OK: return hf_valve_err_t::VALVE_SUCCESS;
178 case max22200::DriverStatus::INITIALIZATION_ERROR: return hf_valve_err_t::VALVE_ERR_NOT_INITIALIZED;
179 case max22200::DriverStatus::COMMUNICATION_ERROR: return hf_valve_err_t::VALVE_ERR_SPI_BUS_ERROR;
180 case max22200::DriverStatus::INVALID_PARAMETER: return hf_valve_err_t::VALVE_ERR_INVALID_PARAMETER;
181 case max22200::DriverStatus::HARDWARE_FAULT: return hf_valve_err_t::VALVE_ERR_HARDWARE_FAULT;
182 case max22200::DriverStatus::TIMEOUT: return hf_valve_err_t::VALVE_ERR_TIMEOUT;
183 default: return hf_valve_err_t::VALVE_ERR_UNKNOWN;
184 }
185}
186
187//==============================================================================
188// VALVE CHANNEL IDENTIFIERS
189//==============================================================================
190
194enum class ValveDriverType : uint8_t {
195 MAX22200 = 0,
196 TLE92466 = 1,
197 UNKNOWN = 0xFF
198};
199
206enum class ValveChannel : uint8_t {
207 // MAX22200 channels (0-7)
208 SOL_CH0 = 0, SOL_CH1 = 1, SOL_CH2 = 2, SOL_CH3 = 3,
209 SOL_CH4 = 4, SOL_CH5 = 5, SOL_CH6 = 6, SOL_CH7 = 7,
210
211 // TLE92466ED channels (8-13)
212 PROP_CH0 = 8, PROP_CH1 = 9, PROP_CH2 = 10,
213 PROP_CH3 = 11, PROP_CH4 = 12, PROP_CH5 = 13,
214
215 CHANNEL_COUNT = 14
216};
217
227
247
249static constexpr size_t kValveChannelCount = sizeof(kValveChannelMap) / sizeof(kValveChannelMap[0]);
250
251//==============================================================================
252// VALVE STATUS STRUCTURES
253//==============================================================================
254
259 bool enabled{false};
260 bool configured{false};
261 uint16_t current_ma{0};
262 float duty_percent{0.0f};
263 float pwm_frequency_hz{0.0f};
266 uint32_t activation_count{0};
267 uint32_t error_count{0};
268};
269
283
284//==============================================================================
285// VALVE MANAGER
286//==============================================================================
287
297public:
298 //==========================================================================
299 // SINGLETON
300 //==========================================================================
301
303 static ValveManager& GetInstance() noexcept;
304
305 ValveManager(const ValveManager&) = delete;
309
310 //==========================================================================
311 // INITIALIZATION
312 //==========================================================================
313
318 [[nodiscard]] bool EnsureInitialized() noexcept;
319
324 [[nodiscard]] bool IsInitialized() const noexcept { return initialized_.load(std::memory_order_acquire); }
325
332 [[nodiscard]] bool IsBankReady(ValveDriverType bank) const noexcept;
333
338 [[nodiscard]] flux::hal::ManagerError GetManagerError() const noexcept {
339 return manager_error_.load(std::memory_order_acquire);
340 }
341
348 bool Deinitialize() noexcept;
349
350 //==========================================================================
351 // HARDWARE ENABLE PATH (SafeHold) — no SPI, no mutex
352 //==========================================================================
353
375 bool DropEnablePins() noexcept;
376
385 bool RearmEnablePins() noexcept;
386
388 [[nodiscard]] bool IsOutputInhibited() const noexcept {
389 return outputs_inhibited_.load(std::memory_order_acquire);
390 }
391
397 void GetEnablePinStates(bool& max_enable, bool& tle_enable) const noexcept;
398
399 //==========================================================================
400 // CHANNEL ENABLE / DISABLE (unified for both drivers)
401 //==========================================================================
402
408 [[nodiscard]] hf_valve_err_t EnableChannel(ValveChannel channel) noexcept;
409
415 [[nodiscard]] hf_valve_err_t DisableChannel(ValveChannel channel) noexcept;
416
422 [[nodiscard]] hf_valve_err_t EnableChannelsMask(uint16_t mask) noexcept;
423
428 [[nodiscard]] hf_valve_err_t DisableAllChannels() noexcept;
429
435 [[nodiscard]] bool IsChannelEnabled(ValveChannel channel) const noexcept;
436
437 //==========================================================================
438 // SOLENOID CONFIGURATION (MAX22200-specific)
439 //==========================================================================
440
450 uint16_t hit_ma, uint16_t hold_ma,
451 float hit_time_ms) noexcept;
452
462 float hit_duty_pct, float hold_duty_pct,
463 float hit_time_ms) noexcept;
464
465 //==========================================================================
466 // PROPORTIONAL CONFIGURATION (TLE92466ED-specific)
467 //==========================================================================
468
475 [[nodiscard]] hf_valve_err_t SetProportionalCurrent(ValveChannel channel, uint16_t current_ma) noexcept;
476
492 float frequency_hz) noexcept;
493
506 float amplitude_ma,
507 float frequency_hz) noexcept;
508
509 //==========================================================================
510 // STATUS & FAULT MANAGEMENT
511 //==========================================================================
512
517 [[nodiscard]] bool HasFault() noexcept;
518
523 [[nodiscard]] hf_valve_err_t ClearAllFaults() noexcept;
524
529 [[nodiscard]] bool HasSolenoidFault() noexcept;
530
535 [[nodiscard]] bool HasProportionalFault() noexcept;
536
542 [[nodiscard]] hf_valve_err_t GetSolenoidFaults(max22200::FaultStatus& faults) noexcept;
543
549 [[nodiscard]] hf_valve_err_t GetProportionalFaults(tle92466ed::FaultReport& report) noexcept;
550
551 //==========================================================================
552 // CHANNEL INFORMATION
553 //==========================================================================
554
560 [[nodiscard]] const ValveChannelState* GetChannelState(ValveChannel channel) const noexcept;
561
567 [[nodiscard]] const ValveChannelInfo* GetChannelInfo(std::string_view name) const noexcept;
568
574 [[nodiscard]] ValveChannel FindChannel(std::string_view name) const noexcept;
575
576 //==========================================================================
577 // DIRECT DRIVER ACCESS (for advanced use)
578 //==========================================================================
579
584 [[nodiscard]] Max22200Handler* GetMax22200Handler() noexcept;
585
590 [[nodiscard]] Tle92466edHandler* GetTle92466Handler() noexcept;
591
592 //==========================================================================
593 // DIAGNOSTICS
594 //==========================================================================
595
603 [[nodiscard]] hf_valve_err_t GetLastError() const noexcept { return last_error_.load(std::memory_order_acquire); }
604
610 [[nodiscard]] hf_valve_err_t GetSystemDiagnostics(ValveSystemDiagnostics& diag) const noexcept;
611
613 void DumpStatistics() const noexcept;
614
615private:
616 ValveManager() noexcept;
617 ~ValveManager() = default;
618
619 hf_valve_err_t Initialize() noexcept;
620 flux::hal::ManagerError InitializeMax22200() noexcept;
621 flux::hal::ManagerError InitializeTle92466() noexcept;
622
625
627 void ReleaseDriversLocked() noexcept;
628
630 hf_valve_err_t Record(hf_valve_err_t result) const noexcept {
631 if (!HfValveErrOk(result)) {
632 last_error_.store(result, std::memory_order_release);
633 }
634 return result;
635 }
636
638 [[nodiscard]] static bool ResolveChannel(ValveChannel channel,
639 ValveDriverType& driver_type,
640 uint8_t& hw_channel) noexcept;
641
642
643 //==========================================================================
644 // HANDLER INSTANCES — members, constructed in place at bring-up (no heap)
645 //==========================================================================
646
647 std::optional<Max22200Handler> max22200_;
648 bool max22200_valid_{false};
649
650 std::optional<Tle92466edHandler> tle92466_;
651 bool tle92466_valid_{false};
652
653 //==========================================================================
654 // CHANNEL STATE — fixed-size, stack-allocated
655 //==========================================================================
656
657 std::array<ValveChannelState, static_cast<size_t>(ValveChannel::CHANNEL_COUNT)> channel_states_{};
658
659 std::atomic<bool> initialized_{false};
660 std::atomic<bool> outputs_inhibited_{false};
661 std::atomic<flux::hal::ManagerError> manager_error_{flux::hal::ManagerError::NotInitialized};
662 mutable std::atomic<hf_valve_err_t> last_error_{hf_valve_err_t::VALVE_SUCCESS};
663 mutable RtosMutex mutex_;
664};
665
666//==============================================================================
667// CONVENIENCE
668//==============================================================================
669
674[[nodiscard]] inline ValveManager& GetValveManager() noexcept {
676}
677
678#endif // FLUX_VALVE_MANAGER_H_
constexpr hf_valve_err_t TleDriverErrorToValveError(tle92466ed::DriverError e) noexcept
Map TLE92466ED DriverError to the unified hf_valve_err_t domain.
Definition ValveManager.h:149
constexpr hf_valve_err_t MaxDriverStatusToValveError(max22200::DriverStatus s) noexcept
Map MAX22200 DriverStatus to the unified hf_valve_err_t domain.
Definition ValveManager.h:175
constexpr const char * HfValveErrToString(hf_valve_err_t err) noexcept
Convert hf_valve_err_t to a human-readable description string.
Definition ValveManager.h:104
ValveManager & GetValveManager() noexcept
Convenience accessor — equivalent to ValveManager::GetInstance().
Definition ValveManager.h:674
static constexpr ValveChannelInfo kValveChannelMap[]
Compile-time mapping table for all valve channels.
Definition ValveManager.h:231
ValveChannel
Unified valve channel identifier — covers all 14 channels.
Definition ValveManager.h:206
ValveDriverType
Identifies which driver IC backend a valve channel belongs to.
Definition ValveManager.h:194
@ MAX22200
MAX22200 octal solenoid driver.
@ TLE92466
TLE92466ED six-channel proportional driver.
static constexpr size_t kValveChannelCount
Total number of valve channels defined in the mapping table.
Definition ValveManager.h:249
hf_valve_err_t
Unified valve error codes for the HardFOC Flux V1 platform.
Definition ValveManager.h:62
@ VALVE_ERR_WRITE_TO_READ_ONLY
@ VALVE_ERR_DRIVER_NOT_AVAILABLE
@ VALVE_ERR_SPI_TRANSFER_FAILED
@ VALVE_ERR_INVALID_PARAMETER
@ VALVE_ERR_CHANNEL_TYPE_MISMATCH
@ VALVE_ERR_DEVICE_NOT_RESPONDING
@ VALVE_ERR_CONFIGURATION_ERROR
@ VALVE_ERR_DEPENDENCY_NOT_READY
constexpr bool HfValveErrOk(hf_valve_err_t err) noexcept
Check if a valve error code indicates success.
Definition ValveManager.h:138
Unified singleton for controlling all valve channels on the Flux board.
Definition ValveManager.h:296
Max22200Handler * GetMax22200Handler() noexcept
Get the MAX22200 handler for advanced solenoid operations.
Definition ValveManager.cpp:734
hf_valve_err_t GetSolenoidFaults(max22200::FaultStatus &faults) noexcept
Retrieve the MAX22200 fault status.
Definition ValveManager.cpp:692
Tle92466edHandler * GetTle92466Handler() noexcept
Get the TLE92466ED handler for advanced proportional operations.
Definition ValveManager.cpp:738
hf_valve_err_t GetSystemDiagnostics(ValveSystemDiagnostics &diag) const noexcept
Populate a ValveSystemDiagnostics snapshot.
Definition ValveManager.cpp:746
hf_valve_err_t EnableChannelsMask(uint16_t mask) noexcept
Enable multiple channels by bitmask.
Definition ValveManager.cpp:418
bool HasProportionalFault() noexcept
Check for TLE92466ED-specific faults.
Definition ValveManager.cpp:687
bool IsBankReady(ValveDriverType bank) const noexcept
Whether one driver IC came up during the last bring-up attempt.
Definition ValveManager.cpp:98
ValveManager & operator=(const ValveManager &)=delete
bool IsOutputInhibited() const noexcept
The enable pins were dropped and not re-armed since.
Definition ValveManager.h:388
bool IsChannelEnabled(ValveChannel channel) const noexcept
Check if a channel is currently enabled.
Definition ValveManager.cpp:493
ValveManager(ValveManager &&)=delete
bool IsInitialized() const noexcept
Check whether the valve subsystem has been initialised.
Definition ValveManager.h:324
std::array< ValveChannelState, static_cast< size_t >(ValveChannel::CHANNEL_COUNT)> channel_states_
Definition ValveManager.h:657
static ValveManager & GetInstance() noexcept
Return the singleton ValveManager instance.
Definition ValveManager.cpp:25
bool max22200_valid_
Definition ValveManager.h:648
std::atomic< bool > initialized_
Definition ValveManager.h:659
hf_valve_err_t DisableChannel(ValveChannel channel) noexcept
Disable a valve channel output.
Definition ValveManager.cpp:384
std::atomic< bool > outputs_inhibited_
DropEnablePins() latched, until re-armed.
Definition ValveManager.h:660
ValveManager(const ValveManager &)=delete
void DumpStatistics() const noexcept
Log valve channel statistics and driver health to the console.
Definition ValveManager.cpp:768
std::optional< Tle92466edHandler > tle92466_
Definition ValveManager.h:650
flux::hal::ManagerError InitializeMax22200() noexcept
Definition ValveManager.cpp:159
bool tle92466_valid_
Definition ValveManager.h:651
bool Deinitialize() noexcept
Turn every channel off, release both driver handlers and reset to uninitialised.
Definition ValveManager.cpp:810
void ReleaseDriversLocked() noexcept
Destroy both handlers and clear the bank flags (mutex held by the caller).
Definition ValveManager.cpp:836
hf_valve_err_t GetLastError() const noexcept
Get the most recent failed valve operation's error code.
Definition ValveManager.h:603
bool EnsureInitialized() noexcept
Ensure the valve manager system is initialized.
Definition ValveManager.cpp:38
ValveChannel FindChannel(std::string_view name) const noexcept
Find a channel enum by name.
Definition ValveManager.cpp:723
hf_valve_err_t ConfigureSolenoidCdr(ValveChannel channel, uint16_t hit_ma, uint16_t hold_ma, float hit_time_ms) noexcept
Configure a solenoid channel with CDR (current drive regulation).
Definition ValveManager.cpp:503
static bool ResolveChannel(ValveChannel channel, ValveDriverType &driver_type, uint8_t &hw_channel) noexcept
Resolve channel enum to hw channel index and driver type.
Definition ValveManager.cpp:332
hf_valve_err_t Initialize() noexcept
Definition ValveManager.cpp:106
bool DropEnablePins() noexcept
Drive MAX22200 ENABLE and TLE92466ED EN low: both banks de-energised in hardware.
Definition ValveManager.cpp:62
hf_valve_err_t EnableChannel(ValveChannel channel) noexcept
Enable a valve channel output.
Definition ValveManager.cpp:346
hf_valve_err_t GetProportionalFaults(tle92466ed::FaultReport &report) noexcept
Retrieve the TLE92466ED fault report.
Definition ValveManager.cpp:698
const ValveChannelInfo * GetChannelInfo(std::string_view name) const noexcept
Get channel info (driver type, hw channel, name) by string name.
Definition ValveManager.cpp:716
hf_valve_err_t ClearAllFaults() noexcept
Clear faults on both drivers.
Definition ValveManager.cpp:661
bool RearmEnablePins() noexcept
Leave SafeHold: full re-bring-up of both banks, which raises the enable pins again.
Definition ValveManager.cpp:84
ValveManager & operator=(ValveManager &&)=delete
hf_valve_err_t SetProportionalCurrent(ValveChannel channel, uint16_t current_ma) noexcept
Set current setpoint for a proportional valve channel.
Definition ValveManager.cpp:552
void GetEnablePinStates(bool &max_enable, bool &tle_enable) const noexcept
Read back the two enable outputs.
Definition ValveManager.cpp:89
flux::hal::ManagerError InitializeTle92466() noexcept
Definition ValveManager.cpp:224
std::atomic< flux::hal::ManagerError > manager_error_
Definition ValveManager.h:661
RtosMutex mutex_
Definition ValveManager.h:663
hf_valve_err_t DisableAllLocked() noexcept
Disable every channel on every bank that is up (mutex held by the caller).
Definition ValveManager.cpp:472
bool HasFault() noexcept
Check if any driver reports a fault.
Definition ValveManager.cpp:657
const ValveChannelState * GetChannelState(ValveChannel channel) const noexcept
Get channel runtime state by enum.
Definition ValveManager.cpp:710
std::optional< Max22200Handler > max22200_
Definition ValveManager.h:647
flux::hal::ManagerError GetManagerError() const noexcept
Lifecycle / bind error of the last EnsureInitialized() (shared catalog).
Definition ValveManager.h:338
hf_valve_err_t Record(hf_valve_err_t result) const noexcept
Remember a failed operation result for GetLastError(); pass the result through.
Definition ValveManager.h:630
hf_valve_err_t ConfigureProportionalPwm(ValveChannel channel, float frequency_hz) noexcept
Configure PWM frequency for a proportional channel.
Definition ValveManager.cpp:573
hf_valve_err_t DisableAllChannels() noexcept
Disable all channels on both drivers.
Definition ValveManager.cpp:465
bool HasSolenoidFault() noexcept
Check for MAX22200-specific faults.
Definition ValveManager.cpp:682
hf_valve_err_t ConfigureSolenoidVdr(ValveChannel channel, float hit_duty_pct, float hold_duty_pct, float hit_time_ms) noexcept
Configure a solenoid channel with VDR (voltage drive regulation).
Definition ValveManager.cpp:525
hf_valve_err_t ConfigureProportionalDither(ValveChannel channel, float amplitude_ma, float frequency_hz) noexcept
Configure dither for a proportional channel.
Definition ValveManager.cpp:613
std::atomic< hf_valve_err_t > last_error_
Definition ValveManager.h:662
Shared HAL types for Flux V1: the manager error catalog and the facade result.
ManagerError
Lifecycle / bind failure catalog shared by every manager (GetManagerError()).
Definition flux_hal_types.hpp:37
@ NotInitialized
Manager not initialised (or shut down)
Definition flux_hal_types.hpp:29
Compile-time channel metadata for the mapping table.
Definition ValveManager.h:221
std::string_view name
Human-readable name.
Definition ValveManager.h:225
ValveChannel channel
Unified channel enum.
Definition ValveManager.h:222
ValveDriverType driver_type
Which driver IC.
Definition ValveManager.h:223
uint8_t hw_channel
Channel index within the driver (0-based)
Definition ValveManager.h:224
Per-channel runtime state tracked by the manager.
Definition ValveManager.h:258
bool enabled
Whether channel output is currently active.
Definition ValveManager.h:259
float duty_percent
Last-set duty cycle (for VDR solenoids)
Definition ValveManager.h:262
uint32_t activation_count
Total number of enable events.
Definition ValveManager.h:266
uint32_t error_count
Total errors on this channel.
Definition ValveManager.h:267
float dither_amplitude_ma
Last-set dither amplitude (for proportional)
Definition ValveManager.h:264
float pwm_frequency_hz
Last-set PWM frequency (for proportional)
Definition ValveManager.h:263
float dither_frequency_hz
Last-set dither frequency (for proportional)
Definition ValveManager.h:265
bool configured
Whether channel has been configured.
Definition ValveManager.h:260
uint16_t current_ma
Last-set current setpoint (for proportional)
Definition ValveManager.h:261
Diagnostics snapshot for the entire valve subsystem.
Definition ValveManager.h:273
uint8_t configured_channels
Number of channels that have been configured.
Definition ValveManager.h:278
bool tle92466_initialized
TLE92466ED handler initialised and ready.
Definition ValveManager.h:276
bool system_healthy
True when both driver ICs are operational.
Definition ValveManager.h:274
uint32_t total_activations
Cumulative enable-event count across all channels.
Definition ValveManager.h:280
uint8_t total_channels
Total channel slots in the mapping table.
Definition ValveManager.h:277
bool max22200_initialized
MAX22200 handler initialised and ready.
Definition ValveManager.h:275
uint8_t active_channels
Number of channels currently enabled.
Definition ValveManager.h:279
uint32_t total_errors
Cumulative error count across all channels.
Definition ValveManager.h:281