更新了一些代码

This commit is contained in:
2026-06-29 02:29:16 +08:00
parent 2d25f6bb06
commit ef3601f9e8
12 changed files with 354 additions and 110 deletions
+31 -6
View File
@@ -1,5 +1,4 @@
#include "STC8_SDCC.H"
#include <string.h>
/* ========================================================================
* 系统常量
@@ -30,10 +29,41 @@
#define CONNECTED 2 /* 常亮 - 已连接 */
#define NRF_ERROR 4 /* 双闪 - NRF硬件错误 */
/* UART运行模式 */
#define UART_UART 0
#define UART_SBUS 1
#define UART_CRFS 2
/* ========================================================================
* 全局变量
* ======================================================================== */
// 配置信息
struct CONFIG
{
// 运行模式
uint8 runModel;
// nrf24使用的通道
uint8 nrf_ch;
// nrf24使用的对频短语
uint8 nrf_bindphr[6];
// nrf24地址,40位
uint8 nrf_addr[5];
// 对频标志
uint8 tx_magic;
// 记录的发射机地址
uint8 tx_addr[5];
} config;
// nrf24l01接收的数据
struct RFDATA
{
// nrf24l01一次性接收32byte数据
uint8 RefreshRate;
uint16 CH[15];
uint8 end;
} RF_Data;
// 系统滴答定时器计数 (用于LED闪烁)
static uint8 sys_tick = 0;
@@ -68,11 +98,6 @@ static uint8_t telem_rate_hz = 2; /* 回传频率 1-10Hz, 默认2Hz */
static uint8_t __xdata crfs_forward_buf[24];
static uint8_t crfs_forward_len = 0;
/* UART 接收缓冲 (放在 xdata) */
static uint8_t __xdata uart_rx_buf[UART_BUF_SIZE];
static uint8_t uart_rx_idx = 0;
static volatile uint8_t uart_cmd_ready = 0;
/* 定时器计数 (用于LED闪烁) */
static volatile uint16_t sys_tick = 0;