From 4c19b4a92f89983048975b3467f09c4b8a44aec5 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 17 Aug 2024 18:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AF=94=E4=BE=8B=E9=98=80?= =?UTF-8?q?=E9=97=A8=E5=8F=82=E6=95=B0=E6=95=B0=E5=80=BC=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E4=B8=BA0->100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appsrc/service/hardware/device_ctrl_service.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/appsrc/service/hardware/device_ctrl_service.cpp b/appsrc/service/hardware/device_ctrl_service.cpp index b280f65..7c6b78d 100644 --- a/appsrc/service/hardware/device_ctrl_service.cpp +++ b/appsrc/service/hardware/device_ctrl_service.cpp @@ -198,12 +198,14 @@ void DeviceIoControlService::WarningLight_setState(int r, int g, int b, int warn #define COMPONENT HardwareComponent::PositivePressureProportional void DeviceIoControlService::PosiPressureProp_setValve(int valveValue) { // if (isInPc()) return; - + valveValue = valveValue / 100.0 * 255; CAN_MASTER->proportionalSetValve(GET_BOARDID(), GET_SUBID(), valveValue); } int DeviceIoControlService::PosiPressureProp_readPos() { if (isInPc()) return 0; - return CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); + int pos = CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); + pos = pos / 255.0 * 100; + return pos; } bool DeviceIoControlService::PosiPressureProp_isBusy() { if (isInPc()) return false; @@ -214,11 +216,15 @@ bool DeviceIoControlService::PosiPressureProp_isBusy() { #define COMPONENT HardwareComponent::NegativePressureProportional void DeviceIoControlService::NegaPressureProp_setValve(int valveValue) { if (isInPc()) return; + valveValue = valveValue / 100.0 * 255; CAN_MASTER->proportionalSetValve(GET_BOARDID(), GET_SUBID(), valveValue); } int DeviceIoControlService::NegaPressureProp_readPos() { if (isInPc()) return 0; - return CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); + + int pos = CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); + pos = pos / 255.0 * 100; + return pos; } bool DeviceIoControlService::NegaPressureProp_isBusy() { if (isInPc()) return false;