@@ -151,6 +151,32 @@ class SpaInterface : public SpaProperties {
151151 bool setL_2SNZ_BGN (int mode);
152152 bool setL_2SNZ_END (int mode);
153153
154+ // / @brief Internal writer used by `RB_TP_Pump1` RWProperty.
155+ // / @details Sends `S22:<mode>` to the controller and only updates
156+ // / the cached property value when the command succeeds.
157+ // / Throws std::out_of_range for invalid values (0..4).
158+ bool setRB_TP_Pump1 (int mode);
159+ // / @brief Internal writer used by `RB_TP_Pump2` RWProperty.
160+ // / @details Sends `S23:<mode>` to the controller and only updates
161+ // / the cached property value when the command succeeds.
162+ // / Throws std::out_of_range for invalid values (0..4).
163+ bool setRB_TP_Pump2 (int mode);
164+ // / @brief Internal writer used by `RB_TP_Pump3` RWProperty.
165+ // / @details Sends `S24:<mode>` to the controller and only updates
166+ // / the cached property value when the command succeeds.
167+ // / Throws std::out_of_range for invalid values (0..4).
168+ bool setRB_TP_Pump3 (int mode);
169+ // / @brief Internal writer used by `RB_TP_Pump4` RWProperty.
170+ // / @details Sends `S25:<mode>` to the controller and only updates
171+ // / the cached property value when the command succeeds.
172+ // / Throws std::out_of_range for invalid values (0..4).
173+ bool setRB_TP_Pump4 (int mode);
174+ // / @brief Internal writer used by `RB_TP_Pump5` RWProperty.
175+ // / @details Sends `S26:<mode>` to the controller and only updates
176+ // / the cached property value when the command succeeds.
177+ // / Throws std::out_of_range for invalid values (0..4).
178+ bool setRB_TP_Pump5 (int mode);
179+
154180 public:
155181 // / @brief Init SpaInterface.
156182 SpaInterface ();
@@ -404,6 +430,22 @@ class SpaInterface : public SpaProperties {
404430 // / @details Read/write. Valid range 0..5947 encoded as h*256+m (24-hour clock).
405431 RWProperty<int > L_2SNZ_END{this , &SpaInterface::setL_2SNZ_END};
406432
433+ // / @brief Pump 1 operating state.
434+ // / @details Read/write. 0=Off, 1=On, 4=Auto (if supported).
435+ RWProperty<int > RB_TP_Pump1{this , &SpaInterface::setRB_TP_Pump1};
436+ // / @brief Pump 2 operating state.
437+ // / @details Read/write. 0=Off, 1=On, 4=Auto (if supported).
438+ RWProperty<int > RB_TP_Pump2{this , &SpaInterface::setRB_TP_Pump2};
439+ // / @brief Pump 3 operating state.
440+ // / @details Read/write. 0=Off, 1=On, 4=Auto (if supported).
441+ RWProperty<int > RB_TP_Pump3{this , &SpaInterface::setRB_TP_Pump3};
442+ // / @brief Pump 4 operating state.
443+ // / @details Read/write. 0=Off, 1=On, 4=Auto (if supported).
444+ RWProperty<int > RB_TP_Pump4{this , &SpaInterface::setRB_TP_Pump4};
445+ // / @brief Pump 5 operating state.
446+ // / @details Read/write. 0=Off, 1=On, 4=Auto (if supported).
447+ RWProperty<int > RB_TP_Pump5{this , &SpaInterface::setRB_TP_Pump5};
448+
407449 // / @brief To be called by loop function of main sketch. Does regular updates, etc.
408450 void loop ();
409451
@@ -422,31 +464,6 @@ class SpaInterface : public SpaProperties {
422464 // / @brief Clear the call back function.
423465 void clearUpdateCallback ();
424466
425- // / @brief Set the operating mode for pump 1
426- // / @param mode 0 = off, 1 = on, 4 = auto (if supported)
427- // / @return True if successful
428- bool setRB_TP_Pump1 (int mode);
429-
430- // / @brief Set the operating mode for pump 2
431- // / @param mode 0 = off, 1 = on, 4 = auto (if supported)
432- // / @return True if successful
433- bool setRB_TP_Pump2 (int mode);
434-
435- // / @brief Set the operating mode for pump 3
436- // / @param mode 0 = off, 1 = on, 4 = auto (if supported)
437- // / @return True if successful
438- bool setRB_TP_Pump3 (int mode);
439-
440- // / @brief Set the operating mode for pump 4
441- // / @param mode 0 = off, 1 = on, 4 = auto (if supported)
442- // / @return True if successful
443- bool setRB_TP_Pump4 (int mode);
444-
445- // / @brief Set the operating mode for pump 5
446- // / @param mode 0 = off, 1 = on, 4 = auto (if supported)
447- // / @return True if successful
448- bool setRB_TP_Pump5 (int mode);
449-
450467 bool setRB_TP_Light (int mode);
451468
452469 // / @brief Set aux element operating mode
@@ -490,6 +507,12 @@ class SpaInterface : public SpaProperties {
490507 bool setFiltHrs (String duration);
491508
492509 bool setLockMode (int mode);
510+
511+ // / @brief Unified array of RWProperty pointers for each migrated pump, used for
512+ // / both reading state and sending commands. Grows as pumps are migrated.
513+ using PumpStatus = RWProperty<int > SpaInterface::*;
514+ static PumpStatus pumpStatuses[];
515+ static const int pumpStatusesCount = 5 ;
493516};
494517
495518
@@ -505,28 +528,5 @@ static GetPumpStateInstallFunction pumpInstallStateFunctions[] = {
505528 &SpaInterface::getPump5InstallState
506529};
507530
508- // Define the function pointer type for getPumpState functions
509- typedef int (SpaInterface::*GetPumpStateFunction)();
510-
511- // Declare the array of function pointers for each pump's state as static
512- static GetPumpStateFunction pumpStateFunctions[] = {
513- &SpaInterface::getRB_TP_Pump1,
514- &SpaInterface::getRB_TP_Pump2,
515- &SpaInterface::getRB_TP_Pump3,
516- &SpaInterface::getRB_TP_Pump4,
517- &SpaInterface::getRB_TP_Pump5
518- };
519-
520- // Define the function pointer type for getPumpState functions
521- typedef bool (SpaInterface::*SetPumpFunction)(int );
522-
523- // Declare the array of function pointers for each pump's state as static
524- static SetPumpFunction setPumpFunctions[] = {
525- &SpaInterface::setRB_TP_Pump1,
526- &SpaInterface::setRB_TP_Pump2,
527- &SpaInterface::setRB_TP_Pump3,
528- &SpaInterface::setRB_TP_Pump4,
529- &SpaInterface::setRB_TP_Pump5
530- };
531531
532532#endif
0 commit comments