[modbus] Share helper functions across modbus components - part B (#14172)

Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-03-31 10:48:16 -10:00
1 parent da6c4e20fe
commit 2cb987095d
9 files changed
+277 -222

No files matched your search

@@ -33,10 +33,10 @@ void ModbusSwitch::parse_and_publish(const std::vector<uint8_t> &data) {
case ModbusRegisterType::DISCRETE_INPUT:
case ModbusRegisterType::COIL:
// offset for coil is the actual number of the coil not the byte offset
value = coil_from_vector(this->offset, data);
value = modbus::helpers::coil_from_vector(this->offset, data);
break;
default:
value = get_data<uint16_t>(data, this->offset) & this->bitmask;
value = modbus::helpers::get_data<uint16_t>(data, this->offset) & this->bitmask;
break;
}