修改水位计算逻辑
This commit is contained in:
parent
50b6bc2ca2
commit
70224a1e4f
@ -45,7 +45,7 @@ void Msg_Handler(const mc::msg::CanFrame::SharedPtr msg)
|
|||||||
{
|
{
|
||||||
const uint16_t WaterValue = (uint16_t)(((msg->data[3] & 0x3F) << 4) | ((msg->data[2] & 0xF0) >> 4));
|
const uint16_t WaterValue = (uint16_t)(((msg->data[3] & 0x3F) << 4) | ((msg->data[2] & 0xF0) >> 4));
|
||||||
float WaterLevel = WaterValue * (-0.235) + 199.75;
|
float WaterLevel = WaterValue * (-0.235) + 199.75;
|
||||||
info_report.waterLevel = static_cast<int>(std::round(WaterLevel / 180.0f));
|
info_report.waterLevel = static_cast<int>(std::round(WaterLevel / 1.8f)); // 液位百分比
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user