mirror of
https://git.aixiao.me/aixiao/Danger-alarm.git
synced 2025-07-29 19:13:39 +08:00
Gradually migrate to FreeRTOS
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "MHZ14B.hpp"
|
||||
#include "common.hpp"
|
||||
|
||||
|
||||
void MH_Z14B_INIT()
|
||||
{
|
||||
// 初始化UART
|
||||
@@ -16,7 +15,6 @@ void MH_Z14B_INIT()
|
||||
static uint16_t MH_Z14B(int *MH_Z14B_DATA_IS_OK)
|
||||
{
|
||||
|
||||
|
||||
// 0x86 读气体浓度值
|
||||
uint8_t CMD[9] = { 0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79 };
|
||||
uart_write_blocking(UART1, CMD, 9);
|
||||
@@ -60,15 +58,13 @@ void CO2(void *pvParameters)
|
||||
int MH_Z14B_DATA_IS_OK = 0;
|
||||
MH_Z14B_INIT();
|
||||
_printTaskStackHighWaterMark("MH_Z14B");
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
while (1) {
|
||||
CO2_DATA = MH_Z14B(&MH_Z14B_DATA_IS_OK);
|
||||
if (CO2_DATA != -1 && MH_Z14B_DATA_IS_OK == 1) {
|
||||
printf("CO2 Concentration: %d ppm\n", CO2_DATA);
|
||||
}
|
||||
|
||||
_printTaskStackHighWaterMark("MH_Z14B");
|
||||
//_printTaskStackHighWaterMark("MH_Z14B");
|
||||
vTaskDelay(pdMS_TO_TICKS(3000)); // 非阻塞延时
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user