emelianov / modbus-esp8266

Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.
Other
497 stars 182 forks source link

ModbusAPI::Hregs Does Not Compile #332

Closed seikosantana closed 1 month ago

seikosantana commented 4 months ago

I'm trying to put int32_t value into 2 registers with values from array for my ModbusRTU slave using ModbusRTU::Hregs

uint16_t weight_parts[2];
weight_parts[0] = static_cast<uint16_t>((weight >> 16) & 0xFFFF);
weight_parts[1] = static_cast<uint16_t>(weight & 0xFFFF);
_modbus.Hregs(HR_CURRENT_WEIGHT, weight_parts, 2);
return true;

but during compile it was unsuccessful: Undefined reference to `Modbus::Reg(TAddress, unsigned short*, unsigned short)'

Am I using it incorrectly or is this intended?

Thanks in advance

emelianov commented 2 months ago

_modbus.Hregs(HR_CURRENT_WEIGHT, (uint16_t*)weight_parts, 2);