修复编译错误
This commit is contained in:
parent
bc65530c00
commit
e280004ddd
13
README.md
13
README.md
@ -11,10 +11,14 @@
|
|||||||
## 源码构建
|
## 源码构建
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 使用WSL Debian GNU/Linux 12 (bookworm) 构建
|
# 使用WSL Debian GNU/Linux 12 (bookworm) 构建,或者 Operating System: Ubuntu 23.10
|
||||||
# 确保Pico-SDK环境变量
|
# 确保Pico-SDK环境变量
|
||||||
export PICO_SDK_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry-pico/SDK/pico-sdk
|
# 使用官方工具 https://github.com/raspberrypi/pico-setup 下载并设置 SDK 环境变量
|
||||||
export PICO_EXTRAS_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry-pico/SDK/pico-extras
|
export PICO_SDK_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-sdk
|
||||||
|
export PICO_EXAMPLES_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-examples
|
||||||
|
export PICO_EXTRAS_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-extras
|
||||||
|
export PICO_PLAYGROUND_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/pico-playground
|
||||||
|
export PICOTOOL_FETCH_FROM_GIT_PATH=/mnt/c/Users/niuyuling/Desktop/raspberry/pico-setup/pico/picotool
|
||||||
|
|
||||||
apt install cmake gcc-arm-none-eabi gcc g++
|
apt install cmake gcc-arm-none-eabi gcc g++
|
||||||
apt install gdb-multiarch automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev
|
apt install gdb-multiarch automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev
|
||||||
@ -34,10 +38,11 @@
|
|||||||
# FreeRTOS 版本构建
|
# FreeRTOS 版本构建
|
||||||
cd ~/Danger-alarm/SOFTWARE-FreeRTOS
|
cd ~/Danger-alarm/SOFTWARE-FreeRTOS
|
||||||
mkdir build
|
mkdir build
|
||||||
|
cd build
|
||||||
cmake -DPICO_BOARD=pico_w .. && make -j4
|
cmake -DPICO_BOARD=pico_w .. && make -j4
|
||||||
|
|
||||||
|
|
||||||
# 树莓派Zero W 433MHZ HC-12接收服务端构建(需要自己设置Raspberry Pi 串口)
|
# 树莓派Zero W 433MHZ HC-12接收服务端构建(需要自己开启 Raspberry Pi 串口, 并连接好硬件 HC-12)
|
||||||
apt install libmysqlclient-dev
|
apt install libmysqlclient-dev
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://github.com/WiringPi/WiringPi.git
|
git clone https://github.com/WiringPi/WiringPi.git
|
||||||
|
@ -38,7 +38,9 @@ static uint16_t MH_Z14B(int *MH_Z14B_DATA_IS_OK)
|
|||||||
//printf("CHECKSUM: %X = %X\n", CO2_DATA[8], CHECKSUM);
|
//printf("CHECKSUM: %X = %X\n", CO2_DATA[8], CHECKSUM);
|
||||||
//printf("CO2 Concentration: %d ppm\n", CO2_CONC);
|
//printf("CO2 Concentration: %d ppm\n", CO2_CONC);
|
||||||
*MH_Z14B_DATA_IS_OK = 1;
|
*MH_Z14B_DATA_IS_OK = 1;
|
||||||
} else {
|
}
|
||||||
|
/*
|
||||||
|
else {
|
||||||
// 校准传感器 零点 (ZERO)
|
// 校准传感器 零点 (ZERO)
|
||||||
uint8_t ZERO[] = { 0XFF, 0X01, 0X87, 0X00, 0X00, 0X00, 0X00, 0X00, 0X78 };
|
uint8_t ZERO[] = { 0XFF, 0X01, 0X87, 0X00, 0X00, 0X00, 0X00, 0X00, 0X78 };
|
||||||
uart_write_blocking(UART1, ZERO, 9);
|
uart_write_blocking(UART1, ZERO, 9);
|
||||||
@ -54,6 +56,7 @@ static uint16_t MH_Z14B(int *MH_Z14B_DATA_IS_OK)
|
|||||||
*MH_Z14B_DATA_IS_OK = 0;
|
*MH_Z14B_DATA_IS_OK = 0;
|
||||||
printf("CO2 concentration reading failed!\n");
|
printf("CO2 concentration reading failed!\n");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
return CO2_CONC;
|
return CO2_CONC;
|
||||||
@ -75,6 +78,9 @@ void CO2(void *pvParameters)
|
|||||||
snprintf(CO2_DATA_TEMP, BUFER, "CO2 Concentration: %d ppm\n", CO2_DATA);
|
snprintf(CO2_DATA_TEMP, BUFER, "CO2 Concentration: %d ppm\n", CO2_DATA);
|
||||||
_HC_12(CO2_DATA_TEMP);
|
_HC_12(CO2_DATA_TEMP);
|
||||||
memset(CO2_DATA_TEMP, 0, BUFER);
|
memset(CO2_DATA_TEMP, 0, BUFER);
|
||||||
|
} else {
|
||||||
|
printf("CO2 reading failed!!!");
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(3000)); // 非阻塞延时
|
||||||
}
|
}
|
||||||
|
|
||||||
//_printTaskStackHighWaterMark("CO2");
|
//_printTaskStackHighWaterMark("CO2");
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include "lwipopts.h"
|
#include "lwipopts.h"
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "ds18b20.hpp"
|
#include "DS18B20.hpp"
|
||||||
#include "ZC13.hpp"
|
#include "ZC13.hpp"
|
||||||
#include "ZE07CO.hpp"
|
#include "ZE07CO.hpp"
|
||||||
#include "MHZ14B.hpp"
|
#include "MHZ14B.hpp"
|
||||||
@ -82,7 +82,7 @@ void CPU(void *pvParameters)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
stdio_init_all();
|
stdio_init_all();
|
||||||
sleep_ms(3000);
|
sleep_ms(3000);
|
||||||
|
@ -17,7 +17,7 @@ pico_generate_pio_header(Danger-alarm ${CMAKE_CURRENT_LIST_DIR}/Source/uart_tx.p
|
|||||||
pico_generate_pio_header(Danger-alarm ${CMAKE_CURRENT_LIST_DIR}/Source/uart_rx.pio)
|
pico_generate_pio_header(Danger-alarm ${CMAKE_CURRENT_LIST_DIR}/Source/uart_rx.pio)
|
||||||
|
|
||||||
target_sources(Danger-alarm PRIVATE
|
target_sources(Danger-alarm PRIVATE
|
||||||
lib/radio-switch.cc
|
Lib/radio-switch.cc
|
||||||
${CMAKE_CURRENT_LIST_DIR}/Source/common.c
|
${CMAKE_CURRENT_LIST_DIR}/Source/common.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/Source/MAIN.cpp
|
${CMAKE_CURRENT_LIST_DIR}/Source/MAIN.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/Source/DTH11.cpp
|
${CMAKE_CURRENT_LIST_DIR}/Source/DTH11.cpp
|
||||||
|
@ -150,7 +150,9 @@ static uint16_t MH_Z14B(int *MH_Z14B_DATA_IS_OK)
|
|||||||
//printf("CHECKSUM: %X = %X\n", CO2_DATA[8], CHECKSUM);
|
//printf("CHECKSUM: %X = %X\n", CO2_DATA[8], CHECKSUM);
|
||||||
//printf("CO2 Concentration: %d ppm\n", CO2_CONC);
|
//printf("CO2 Concentration: %d ppm\n", CO2_CONC);
|
||||||
*MH_Z14B_DATA_IS_OK = 1;
|
*MH_Z14B_DATA_IS_OK = 1;
|
||||||
} else {
|
}
|
||||||
|
/*
|
||||||
|
else {
|
||||||
// 校准传感器 零点 (ZERO)
|
// 校准传感器 零点 (ZERO)
|
||||||
uint8_t ZERO[] = { 0XFF, 0X01, 0X87, 0X00, 0X00, 0X00, 0X00, 0X00, 0X78 };
|
uint8_t ZERO[] = { 0XFF, 0X01, 0X87, 0X00, 0X00, 0X00, 0X00, 0X00, 0X78 };
|
||||||
uart_write_blocking(UART1, ZERO, 9);
|
uart_write_blocking(UART1, ZERO, 9);
|
||||||
@ -164,6 +166,7 @@ static uint16_t MH_Z14B(int *MH_Z14B_DATA_IS_OK)
|
|||||||
*MH_Z14B_DATA_IS_OK = 0;
|
*MH_Z14B_DATA_IS_OK = 0;
|
||||||
printf("CO2 concentration reading failed!\n");
|
printf("CO2 concentration reading failed!\n");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return CO2_CONC;
|
return CO2_CONC;
|
||||||
}
|
}
|
||||||
@ -251,7 +254,7 @@ static void core1_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
stdio_init_all();
|
stdio_init_all();
|
||||||
sleep_ms(1000);
|
sleep_ms(1000);
|
||||||
@ -370,7 +373,7 @@ int main()
|
|||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
|
||||||
watchdog_update(); // 喂狗
|
watchdog_update(); // 喂狗
|
||||||
sleep_ms(3000);
|
sleep_ms(5000);
|
||||||
watchdog_update(); // 喂狗
|
watchdog_update(); // 喂狗
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "hardware/gpio.h"
|
#include "hardware/gpio.h"
|
||||||
#include "lib/pico-onewire/api/one_wire.h"
|
#include "Lib/pico-onewire/api/one_wire.h"
|
||||||
#include "lib/radio-switch.h"
|
#include "Lib/radio-switch.h"
|
||||||
|
|
||||||
#include "hardware/clocks.h"
|
#include "hardware/clocks.h"
|
||||||
#include "hardware/watchdog.h"
|
#include "hardware/watchdog.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user