Skip to content

Commit

Permalink
pre-process command also with full register writes
Browse files Browse the repository at this point in the history
Signed-off-by: Sami Salonen <[email protected]>
  • Loading branch information
ssalonen committed Jan 29, 2023
1 parent ee25b62 commit eda1d8a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ private void processWriteToBitOfRegister(Command command) {
}

private void processWriteFullRegisters(Command command) {
ModbusRegisterArray registers = ModbusBitUtilities.commandToRegisters(command, valueType);
Optional<BigDecimal> decimalValue = preProcessCommand(command);
if (decimalValue.isEmpty()) {
return;
}
Command preprocessedCommand = new DecimalType(decimalValue.get());
ModbusRegisterArray registers = ModbusBitUtilities.commandToRegisters(preprocessedCommand, valueType);
writer.accept(new ModbusWriteRegisterRequestBlueprint(slaveId, address.channelStartElement, registers,
(registers.size() > 1) || config.writeMultiple, config.writeMaxTries));
}
Expand Down

0 comments on commit eda1d8a

Please sign in to comment.