diff --git a/.cproject b/.cproject
index 3ccd458..e4ee08c 100644
--- a/.cproject
+++ b/.cproject
@@ -25,8 +25,8 @@
-
-
+
+
diff --git a/Core/Inc/stm32f4xx_it.h b/Core/Inc/stm32f4xx_it.h
index e4a252b..cde7327 100644
--- a/Core/Inc/stm32f4xx_it.h
+++ b/Core/Inc/stm32f4xx_it.h
@@ -59,6 +59,8 @@ void CAN1_TX_IRQHandler(void);
void CAN1_RX0_IRQHandler(void);
void CAN1_RX1_IRQHandler(void);
void CAN1_SCE_IRQHandler(void);
+void USART1_IRQHandler(void);
+void USART2_IRQHandler(void);
void USART3_IRQHandler(void);
/* USER CODE BEGIN EFP */
diff --git a/Core/Src/stm32f4xx_it.c b/Core/Src/stm32f4xx_it.c
index e63d0ba..66bbaa0 100644
--- a/Core/Src/stm32f4xx_it.c
+++ b/Core/Src/stm32f4xx_it.c
@@ -56,6 +56,8 @@
/* External variables --------------------------------------------------------*/
extern CAN_HandleTypeDef hcan1;
+extern UART_HandleTypeDef huart1;
+extern UART_HandleTypeDef huart2;
extern UART_HandleTypeDef huart3;
/* USER CODE BEGIN EV */
@@ -256,6 +258,34 @@ void CAN1_SCE_IRQHandler(void)
}
/**
+ * @brief This function handles USART1 global interrupt.
+ */
+void USART1_IRQHandler(void)
+{
+ /* USER CODE BEGIN USART1_IRQn 0 */
+
+ /* USER CODE END USART1_IRQn 0 */
+ HAL_UART_IRQHandler(&huart1);
+ /* USER CODE BEGIN USART1_IRQn 1 */
+
+ /* USER CODE END USART1_IRQn 1 */
+}
+
+/**
+ * @brief This function handles USART2 global interrupt.
+ */
+void USART2_IRQHandler(void)
+{
+ /* USER CODE BEGIN USART2_IRQn 0 */
+
+ /* USER CODE END USART2_IRQn 0 */
+ HAL_UART_IRQHandler(&huart2);
+ /* USER CODE BEGIN USART2_IRQn 1 */
+
+ /* USER CODE END USART2_IRQn 1 */
+}
+
+/**
* @brief This function handles USART3 global interrupt.
*/
void USART3_IRQHandler(void)
diff --git a/Core/Src/usart.c b/Core/Src/usart.c
index 635107c..c1b9f3a 100644
--- a/Core/Src/usart.c
+++ b/Core/Src/usart.c
@@ -70,7 +70,7 @@ void MX_USART2_UART_Init(void)
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
- huart2.Init.BaudRate = 9600;
+ huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
@@ -140,6 +140,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ /* USART1 interrupt Init */
+ HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
+ HAL_NVIC_EnableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspInit 1 */
/* USER CODE END USART1_MspInit 1 */
@@ -164,6 +167,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ /* USART2 interrupt Init */
+ HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
+ HAL_NVIC_EnableIRQ(USART2_IRQn);
/* USER CODE BEGIN USART2_MspInit 1 */
/* USER CODE END USART2_MspInit 1 */
@@ -214,6 +220,8 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
+ /* USART1 interrupt Deinit */
+ HAL_NVIC_DisableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspDeInit 1 */
/* USER CODE END USART1_MspDeInit 1 */
@@ -232,6 +240,8 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
+ /* USART2 interrupt Deinit */
+ HAL_NVIC_DisableIRQ(USART2_IRQn);
/* USER CODE BEGIN USART2_MspDeInit 1 */
/* USER CODE END USART2_MspDeInit 1 */
diff --git a/README.md b/README.md
index b7440a2..2a11f85 100644
--- a/README.md
+++ b/README.md
@@ -15,4 +15,27 @@
5. 测试漏液检测
readio 1
readio 2
+
+---------------------------
+pressure_sensor_read 1
+pressure_sensor_read 2
+pressure_sensor_read 3
+pressure_sensor_read 4
+
+# 三色灯
+setlight 255 255 255 255
+setlight 0 0 0 0
+
+readio 1
+readio 2
+
+# 注液排液
+setmotor1 20 300 1 31
+setmotor1 20 0 1 31
+# 喷液
+setmotor2 20 300 1 31
+setmotor2 20 0 1 31
+
+
+
```
\ No newline at end of file
diff --git a/pipeline_disinfection_liquid_path_control Debug.launch b/pipeline_disinfection_liquid_path_control Debug.launch
new file mode 100644
index 0000000..0bee7b1
--- /dev/null
+++ b/pipeline_disinfection_liquid_path_control Debug.launch
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pipeline_disinfection_liquid_path_control.ioc b/pipeline_disinfection_liquid_path_control.ioc
index 7f52c7e..b1bd09a 100644
--- a/pipeline_disinfection_liquid_path_control.ioc
+++ b/pipeline_disinfection_liquid_path_control.ioc
@@ -82,6 +82,8 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
+NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
+NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
PA10.Mode=Asynchronous
diff --git a/pipeline_disinfection_liquid_path_control.launch b/pipeline_disinfection_liquid_path_control.launch
index 3252a88..5a3ef93 100644
--- a/pipeline_disinfection_liquid_path_control.launch
+++ b/pipeline_disinfection_liquid_path_control.launch
@@ -1,5 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -50,9 +64,9 @@
-
-
-
+
+
+
diff --git a/sdk b/sdk
index 34ff920..c261a13 160000
--- a/sdk
+++ b/sdk
@@ -1 +1 @@
-Subproject commit 34ff920d0192478c2470f21d15da6f5434181c8d
+Subproject commit c261a135309487a40c6c8c201a7ff979048e89aa
diff --git a/usrc/main.cpp b/usrc/main.cpp
index a467143..d6c49bf 100644
--- a/usrc/main.cpp
+++ b/usrc/main.cpp
@@ -145,9 +145,10 @@ void Main::run() {
// output2
m_basicOrderModule.regOutCtl([this](uint8_t id, bool val) { return false; });
ZHAL_CORE_REG(3000, {
- // ZLOGI(TAG, "IO1:%d IO2:%d", m_input1.getState(), m_input2.getState());
- ZLOGI(TAG, "IO1:%d IO2:%d IO3:%d IO4:%d IO5:%d", m_input1.getState(), m_input2.getState(), m_input3.getState(), m_input4.getState(), m_input5.getState());
- });
+ // ZLOGI(TAG, "IO1:%d IO2:%d", m_input1.getState(), m_input2.getState());
+ // ZLOGI(TAG, "IO1:%d IO2:%d IO3:%d IO4:%d IO5:%d", m_input1.getState(), m_input2.getState(), m_input3.getState(),
+ // m_input4.getState(), m_input5.getState());
+ });
/*******************************************************************************
* 蠕动泵驱动 *
@@ -291,6 +292,15 @@ void Main::run() {
triLight_BEEP.setState(beep != 0);
ack->setNoneAck(0);
});
+
+ cmdScheduler.regCMD("readio", "()", 0, //
+ [](int32_t paramN, const char **paraV, ICmdParserACK *ack) {
+ uint8_t sensorid = atoi(paraV[0]);
+ ZLOGI(TAG, "IO1:%d IO2:%d IO3:%d IO4:%d IO5:%d", //
+ m_input1.getState(), m_input2.getState(), m_input3.getState(), m_input4.getState(),
+ m_input5.getState());
+ ack->setNoneAck(0);
+ });
cmdScheduler.regCMD("pressure_sensor_read", "(uint8_t sensorid)", 1, //
[](int32_t paramN, const char **paraV, ICmdParserACK *ack) {
uint8_t sensorid = atoi(paraV[0]);
@@ -304,6 +314,7 @@ void Main::run() {
});
ZLOGI(TAG, "init done");
while (1) {
+ cmdScheduler.schedule();
ZHALCORE::getInstance()->loop();
}
}
diff --git a/usrc/project.hpp b/usrc/project.hpp
index e2dfad5..44880ff 100644
--- a/usrc/project.hpp
+++ b/usrc/project.hpp
@@ -1,6 +1,6 @@
#pragma once
-#define VERSION "v1.0"
+#define VERSION "v1.1"
// 设备ID
#define DEVICE_ID (2)
// 调试串口
@@ -21,4 +21,4 @@
#define MOTOR2_ENN PE11
// FYBJ_TJ_DRV
#define MOTOR1_CSN PC4 //
-#define MOTOR1_ENN PE12
\ No newline at end of file
+#define MOTOR1_ENN PE12