Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
martinzink committed Jan 25, 2024
1 parent a9d4669 commit bb2f22e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion extensions/standard-processors/modbus/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ struct ModbusErrorCategory final : std::error_category {
}

[[nodiscard]] std::string message(int ev) const override {
return std::string{magic_enum::enum_name<ModbusExceptionCode>(ModbusExceptionCode{ev})};
const auto modbus_exception_code = static_cast<ModbusExceptionCode>(ev);
return std::string{magic_enum::enum_name<ModbusExceptionCode>(modbus_exception_code)};
}
};

Expand Down
4 changes: 2 additions & 2 deletions extensions/standard-processors/modbus/ReadModbusFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ReadModbusFunction {
return nonstd::make_unexpected(ModbusExceptionCode::InvalidResponse);
}

return ranges::subrange(resp_pdu.begin() + 2, resp_pdu.end());
return ranges::subrange<std::vector<std::byte>::const_iterator>(resp_pdu.begin() + 2, resp_pdu.end());
}

[[nodiscard]] virtual std::byte getFunctionCode() const = 0;
Expand Down Expand Up @@ -92,7 +92,7 @@ class ReadCoilStatus final : public ReadModbusFunction {
if (coils.size() == number_of_points_) {
break;
}
const bool bit_value = static_cast<bool>((resp_byte & std::byte{unsigned{1} << i}) >> i);
const bool bit_value = static_cast<bool>((resp_byte & (std::byte{1} << i)) >> i);
coils.push_back(bit_value);
}
}
Expand Down

0 comments on commit bb2f22e

Please sign in to comment.