diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 089a477..0c64d05 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/README.md b/README.md
index 583c218..b7440a2 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,18 @@
```
-1. CAN测试通过 OK
-2. 测试驱动器 OK
-3. 三色报警灯
-4. 测试IO输入
-5. 测试ADC读值 (电流)
-
-
-
+测试
+1. 测试蠕动泵1
+ pumpctrl_c1004 1 300 1000
+2. 测试蠕动泵2
+ pumpctrl_c1004 2 300 1000
+3. 测试压力传感器1,2,3,4
+ huacheng_pressure_sensor_read_c1005 1
+ huacheng_pressure_sensor_read_c1005 2
+ huacheng_pressure_sensor_read_c1005 3
+ huacheng_pressure_sensor_read_c1005 4
+4. 测试报警指示灯
+ 1002:1
+ warning_light_ctrl_c1002 1 255 255 255 255
+5. 测试漏液检测
+ readio 1
+ readio 2
```
\ No newline at end of file
diff --git a/sdk b/sdk
index a7de98e..11b2ea8 160000
--- a/sdk
+++ b/sdk
@@ -1 +1 @@
-Subproject commit a7de98e58158f59c3b3d78e37b2ef4c2ebe5c992
+Subproject commit 11b2ea877c103523e857108c1a521f2755700dac
diff --git a/usrc/main.cpp b/usrc/main.cpp
index 18cbfa1..10d21d0 100644
--- a/usrc/main.cpp
+++ b/usrc/main.cpp
@@ -57,6 +57,26 @@ ZCanPumpCtrlModule m_pumpCtrlModule;
ZCanTrigleWarningLightCtlModule m_warningLightCtlModule;
HuachengPressureSensor m_huachengPressureSensor;
+void setmotor(TMC5130 *motor, int16_t acc_rpm2, int16_t rpm, int16_t idlepower, int16_t power) {
+ int32_t ppm = rpm / 60.0 * 51200;
+ int32_t acc = acc_rpm2 / 60.0 * 51200;
+
+ int16_t _idlepower = 1;
+ int16_t _power = 31;
+
+ if (idlepower > 0 && idlepower < 31) {
+ _idlepower = idlepower;
+ }
+ if (power > 0 && power < 31) {
+ _power = power;
+ }
+
+ motor->setIHOLD_IRUN(_idlepower, _power, 10); // 5W
+ motor->setAcceleration(acc);
+ motor->setDeceleration(acc);
+ motor->rotate(ppm);
+}
+
void Main::onRceivePacket(CanPacketRxBuffer *rxbuf, uint8_t *packet, size_t len) {
ZLOGI(TAG, "onRceivePacket from %d %d", rxbuf->id, len);
for (size_t i = 0; i < len; i++) {
@@ -134,7 +154,7 @@ void Main::run() {
m_motor1.initialize(&cfg);
int32_t chipv = m_motor1.readChipVERSION();
ZLOGI(TAG, "m_motor1:%lx", chipv);
- m_motor1.setIHOLD_IRUN(1, 31, 0);
+ m_motor1.setIHOLD_IRUN(1, 20, 0);
m_motor1.setMotorShaft(true);
m_motor1.setAcceleration(300000);
@@ -148,7 +168,7 @@ void Main::run() {
m_motor2.initialize(&cfg);
int32_t chipv = m_motor2.readChipVERSION();
ZLOGI(TAG, "m_motor2:%lx", chipv);
- m_motor2.setIHOLD_IRUN(1, 31, 0);
+ m_motor2.setIHOLD_IRUN(1, 20, 0); // 5W
m_motor2.setMotorShaft(true);
m_motor2.setAcceleration(300000);
@@ -157,21 +177,13 @@ void Main::run() {
}
m_pumpCtrlModule.initialize(&m_canReceiver);
- m_pumpCtrlModule.regSubmodule(1, [&](int16_t acc_rpm2, int16_t rpm) {
+ m_pumpCtrlModule.regSubmodule(1, [&](int16_t acc_rpm2, int16_t rpm, int16_t idlepower, int16_t power) {
ZLOGI(TAG, "pump1 acc_rpm2:%d rpm:%d", acc_rpm2, rpm);
- int32_t ppm = rpm / 60.0 * 51200;
- int32_t acc = acc_rpm2 / 60.0 * 51200;
- m_motor1.setAcceleration(acc);
- m_motor1.setDeceleration(acc);
- m_motor1.rotate(ppm);
+ setmotor(&m_motor1, acc_rpm2, rpm, idlepower, power);
});
- m_pumpCtrlModule.regSubmodule(2, [&](int16_t acc_rpm2, int16_t rpm) {
+ m_pumpCtrlModule.regSubmodule(2, [&](int16_t acc_rpm2, int16_t rpm, int16_t idlepower, int16_t power) {
ZLOGI(TAG, "pump2 acc:%d rpm:%d", acc_rpm2, rpm);
- int32_t ppm = rpm / 60.0 * 51200;
- int32_t acc = acc_rpm2 / 60.0 * 51200;
- m_motor2.setAcceleration(acc);
- m_motor2.setDeceleration(acc);
- m_motor2.rotate(ppm);
+ setmotor(&m_motor2, acc_rpm2, rpm, idlepower, power);
});
/*******************************************************************************