Skip to content

Commit

Permalink
IO_Modbus: board support limits
Browse files Browse the repository at this point in the history
  • Loading branch information
travis-farmer committed Dec 1, 2024
1 parent f47e417 commit 8137423
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion IO_Modbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/

#if defined(MBEXPERIMENTAL) || defined(ARDUINO_ARCH_STM32)
#include "IO_Modbus.h"
#include "defines.h"
void ModbusADU::setTransactionId(uint16_t transactionId) {
Expand Down Expand Up @@ -504,6 +504,8 @@ Modbus::Modbus(uint8_t busNo, HardwareSerial &serial, unsigned long baud, uint16
_cycleTime = cycleTimeMS * 1000UL; // convert from milliseconds to microseconds.
_waitA = waitA;
_waitB = waitB;
if (_waitA < 3) _waitA = 3;
if (_waitB < 2) _waitB = 2;
// Add device to HAL device chain
IODevice::addDevice(this);

Expand Down Expand Up @@ -643,3 +645,4 @@ Modbusnode::Modbusnode(VPIN firstVpin, int nPins, uint8_t busNo, uint8_t nodeID,
}

}
#endif
6 changes: 4 additions & 2 deletions IO_Modbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#ifndef IO_MODBUS_H
#define IO_MODBUS_H

#if defined(MBEXPERIMENTAL) || defined(ARDUINO_ARCH_STM32)
#include "IODevice.h"
class ModbusADU {
public:
Expand Down Expand Up @@ -406,5 +406,7 @@ class Modbus : public IODevice {
return NULL;
}
};

#else
#error "You have included IO_Modbus on an unsupported board!"
#endif
#endif // IO_MODBUS_H

0 comments on commit 8137423

Please sign in to comment.