diff --git a/include/ILC/ILCBusList.h b/include/ILC/ILCBusList.h index 0d0986b..30883e3 100644 --- a/include/ILC/ILCBusList.h +++ b/include/ILC/ILCBusList.h @@ -137,10 +137,13 @@ class ILCBusList : public Modbus::BusList { * in unicast function to verify the broadcast was received and processed * @param data function parameters. Usually device's bus ID indexed array */ - void broadcastFunction(uint8_t address, uint8_t func, uint32_t delay); + void broadcastFunction(uint8_t address, uint8_t func, uint32_t delay, uint8_t counter); + template void broadcastFunction(uint8_t address, uint8_t func, uint32_t delay, uint8_t counter, - std::vector data); + std::vector data) { + callFunction(address, func, delay, counter, data); + } /** * Return next bus broadcast counter. diff --git a/include/Modbus/Buffer.h b/include/Modbus/Buffer.h index 4ab12ed..5b62c6e 100644 --- a/include/Modbus/Buffer.h +++ b/include/Modbus/Buffer.h @@ -264,6 +264,11 @@ inline void Buffer::write(std::vector data) { writeVector(data); } +template <> +inline void Buffer::write(std::vector data) { + writeVector(data); +} + template <> inline void Buffer::write(std::vector data) { writeVector(data); diff --git a/include/cRIO/ElectromechanicalPneumaticILC.h b/include/cRIO/ElectromechanicalPneumaticILC.h index 778f14a..a7d1e9f 100644 --- a/include/cRIO/ElectromechanicalPneumaticILC.h +++ b/include/cRIO/ElectromechanicalPneumaticILC.h @@ -72,6 +72,9 @@ class ElectromechanicalPneumaticILC : public virtual ILC::ILCBusList { REPORT_HARDPOINT_LVDT = 122 }; + + static constexpr uint8_t EA_BROADCAST = 248; + /** * Unicast command to command stepper motor moves. * @@ -87,6 +90,10 @@ class ElectromechanicalPneumaticILC : public virtual ILC::ILCBusList { callFunction(address, ILC_EM_CMD::SET_STEPPER_STEPS, 1800, steps); } + void broadcastStepperSteps(uint8_t counter, std::vector steps) { + broadcastFunction(EA_BROADCAST, ILC_EM_CMD::SET_STEPPER_STEPS, 1800, counter, steps); + } + /** * Unicast Stepper motor @glos{ILC} Force [N] and Status Request. @glos{ILC} command * code 67 (0x43). Applies for M2 tangent and axials controllers, as well @@ -170,7 +177,7 @@ class ElectromechanicalPneumaticILC : public virtual ILC::ILCBusList { callFunction(address, ILC_EM_CMD::REPORT_FA_FORCE_STATUS, 1800); } - void freezeSensor() {broadcastFunction(248, ILC_EM_CMD::FREEZE_SENSOR, 180); } + void freezeSensor(uint8_t counter) {broadcastFunction(EA_BROADCAST, ILC_EM_CMD::FREEZE_SENSOR, 180, counter); } /** * Unicast ADC Channel Offset and Sensitivity. @glos{ILC} command code 81 (0x51). diff --git a/src/ILC/ILCBusList.cpp b/src/ILC/ILCBusList.cpp index cc87f0a..3d510f4 100644 --- a/src/ILC/ILCBusList.cpp +++ b/src/ILC/ILCBusList.cpp @@ -93,13 +93,8 @@ ILCBusList::ILCBusList(uint8_t bus) : _bus(bus) { ILCBusList::~ILCBusList() {} -void ILCBusList::broadcastFunction(uint8_t address, uint8_t func, uint32_t delay) { - callFunction(address, func, delay); -} - -void ILCBusList::broadcastFunction(uint8_t address, uint8_t func, uint32_t delay, uint8_t counter, - std::vector data) { - callFunction(address, func, delay, counter, data); +void ILCBusList::broadcastFunction(uint8_t address, uint8_t func, uint32_t delay, uint8_t counter) { + callFunction(address, func, delay, counter); } uint8_t ILCBusList::nextBroadcastCounter() {