From 706eb1247e7f756d0bf8b215b3f93208c396ae7b Mon Sep 17 00:00:00 2001 From: YuanHongbin <975559679@qq.com> Date: Tue, 1 Sep 2026 19:14:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20LoRa=E4=B8=AD=E5=BF=83=E9=A2=91?= =?UTF-8?q?=E7=8E=87=E6=94=B9=E4=B8=BA470.1~492.6MHz(46=E4=BF=A1=E9=81=93)?= =?UTF-8?q?,=20=E6=BF=80=E5=85=89=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=BA1=E5=88=86=E9=92=9F,=20?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E7=89=88=E6=9C=AC=E5=8D=87=E8=87=B313?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sx127x.h: CH0~CH45中心频率改为470100000~492600000, 步进500000; FREQ_CENT/USE_LORA_CH扩展至CH45 - sx127x.c: LoraSetChannel信道上限16->45; LoraSetFreqCent频率校验改为470.1~492.6MHz; 移除BOM - main.c: LoraFreq频率校验同步改为470.1~492.6MHz; 激光默认关闭时间10分钟->1分钟 - UartDebug.c: lora帮助文本信道范围更新为0~45 - main.h: 软件版本12->13 - docs: 更新软件版本号与LoRa频率范围说明 - MDK: 调试器配置更新 --- MDK/hc32l17x.uvoptx | 19 +++- Module/LORA/sx127x.c | 6 +- Module/LORA/sx127x.h | 131 +++++++++++++++++++++++--- Module/LaserTracing_Debug/UartDebug.c | 2 +- docs/项目架构与工作流程分析.md | 4 +- source/inc/main.h | 2 +- source/src/main.c | 6 +- 7 files changed, 146 insertions(+), 24 deletions(-) diff --git a/MDK/hc32l17x.uvoptx b/MDK/hc32l17x.uvoptx index d3a81b7..2bf64fc 100644 --- a/MDK/hc32l17x.uvoptx +++ b/MDK/hc32l17x.uvoptx @@ -461,7 +461,24 @@ - + + + 0 + 0 + 255 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\source\inc\bsp.h + + +
+
0 diff --git a/Module/LORA/sx127x.c b/Module/LORA/sx127x.c index c865bc6..d022b92 100644 --- a/Module/LORA/sx127x.c +++ b/Module/LORA/sx127x.c @@ -1,4 +1,4 @@ -#include "sx127x.h" +#include "sx127x.h" #include "ddl.h" #include "UartDebug.h" @@ -622,7 +622,7 @@ void Sx1276RxRetValue(void) bool LoraSetChannel(uint8_t Channel) { - if(Channel > 16) + if(Channel > 45) return false; LoRaPara.ucChannel = Channel; return true; @@ -667,7 +667,7 @@ bool LoraSetRegPreamble(uint8_t RegPreamble) } bool LoraSetFreqCent(uint32_t FreqCent) { - if(FreqCent < 410000000 || FreqCent > 525000000) + if(FreqCent < 470100000ul || FreqCent > 492600000ul) return false; LoRaPara.dwFreqHz = FreqCent; return true; diff --git a/Module/LORA/sx127x.h b/Module/LORA/sx127x.h index 9099cfd..e1e8f94 100644 --- a/Module/LORA/sx127x.h +++ b/Module/LORA/sx127x.h @@ -756,19 +756,54 @@ typedef struct { #endif /* -中心频率配置:433100000ul + 200000*N +中心频率配置:470100000ul ~ 492600000ul,步进500000 */ -#define CH0 (433100000ul + 0) //测试频率 -#define CH1 (433100000ul + 200000) -#define CH2 (433100000ul + 400000) -#define CH3 (433100000ul + 600000) -#define CH4 (433100000ul + 800000) -#define CH5 (433100000ul + 1000000) -#define CH6 (433100000ul + 1200000) -#define CH7 (433100000ul + 1400000) -#define CH8 (433100000ul + 1600000) -#define CH9 (433100000ul + 1800000) -#define CH10 (433100000ul + 2000000) +#define CH0 (470100000ul) //出厂默认频率 +#define CH1 (470600000ul) +#define CH2 (471100000ul) +#define CH3 (471600000ul) +#define CH4 (472100000ul) +#define CH5 (472600000ul) +#define CH6 (473100000ul) +#define CH7 (473600000ul) +#define CH8 (474100000ul) +#define CH9 (474600000ul) +#define CH10 (475100000ul) +#define CH11 (475600000ul) +#define CH12 (476100000ul) +#define CH13 (476600000ul) +#define CH14 (477100000ul) +#define CH15 (477600000ul) +#define CH16 (478100000ul) +#define CH17 (478600000ul) +#define CH18 (479100000ul) +#define CH19 (479600000ul) +#define CH20 (480100000ul) +#define CH21 (480600000ul) +#define CH22 (481100000ul) +#define CH23 (481600000ul) +#define CH24 (482100000ul) +#define CH25 (482600000ul) +#define CH26 (483100000ul) +#define CH27 (483600000ul) +#define CH28 (484100000ul) +#define CH29 (484600000ul) +#define CH30 (485100000ul) +#define CH31 (485600000ul) +#define CH32 (486100000ul) +#define CH33 (486600000ul) +#define CH34 (487100000ul) +#define CH35 (487600000ul) +#define CH36 (488100000ul) +#define CH37 (488600000ul) +#define CH38 (489100000ul) +#define CH39 (489600000ul) +#define CH40 (490100000ul) +#define CH41 (490600000ul) +#define CH42 (491100000ul) +#define CH43 (491600000ul) +#define CH44 (492100000ul) +#define CH45 (492600000ul) #if (USE_LORA_CH == 0) #define FREQ_CENT CH0 @@ -792,10 +827,80 @@ typedef struct { #define FREQ_CENT CH9 #elif (USE_LORA_CH == 10) #define FREQ_CENT CH10 +#elif (USE_LORA_CH == 11) +#define FREQ_CENT CH11 +#elif (USE_LORA_CH == 12) +#define FREQ_CENT CH12 +#elif (USE_LORA_CH == 13) +#define FREQ_CENT CH13 +#elif (USE_LORA_CH == 14) +#define FREQ_CENT CH14 +#elif (USE_LORA_CH == 15) +#define FREQ_CENT CH15 +#elif (USE_LORA_CH == 16) +#define FREQ_CENT CH16 +#elif (USE_LORA_CH == 17) +#define FREQ_CENT CH17 +#elif (USE_LORA_CH == 18) +#define FREQ_CENT CH18 +#elif (USE_LORA_CH == 19) +#define FREQ_CENT CH19 +#elif (USE_LORA_CH == 20) +#define FREQ_CENT CH20 +#elif (USE_LORA_CH == 21) +#define FREQ_CENT CH21 +#elif (USE_LORA_CH == 22) +#define FREQ_CENT CH22 +#elif (USE_LORA_CH == 23) +#define FREQ_CENT CH23 +#elif (USE_LORA_CH == 24) +#define FREQ_CENT CH24 +#elif (USE_LORA_CH == 25) +#define FREQ_CENT CH25 +#elif (USE_LORA_CH == 26) +#define FREQ_CENT CH26 +#elif (USE_LORA_CH == 27) +#define FREQ_CENT CH27 +#elif (USE_LORA_CH == 28) +#define FREQ_CENT CH28 +#elif (USE_LORA_CH == 29) +#define FREQ_CENT CH29 +#elif (USE_LORA_CH == 30) +#define FREQ_CENT CH30 +#elif (USE_LORA_CH == 31) +#define FREQ_CENT CH31 +#elif (USE_LORA_CH == 32) +#define FREQ_CENT CH32 +#elif (USE_LORA_CH == 33) +#define FREQ_CENT CH33 +#elif (USE_LORA_CH == 34) +#define FREQ_CENT CH34 +#elif (USE_LORA_CH == 35) +#define FREQ_CENT CH35 +#elif (USE_LORA_CH == 36) +#define FREQ_CENT CH36 +#elif (USE_LORA_CH == 37) +#define FREQ_CENT CH37 +#elif (USE_LORA_CH == 38) +#define FREQ_CENT CH38 +#elif (USE_LORA_CH == 39) +#define FREQ_CENT CH39 +#elif (USE_LORA_CH == 40) +#define FREQ_CENT CH40 +#elif (USE_LORA_CH == 41) +#define FREQ_CENT CH41 +#elif (USE_LORA_CH == 42) +#define FREQ_CENT CH42 +#elif (USE_LORA_CH == 43) +#define FREQ_CENT CH43 +#elif (USE_LORA_CH == 44) +#define FREQ_CENT CH44 +#elif (USE_LORA_CH == 45) +#define FREQ_CENT CH45 #endif #if !defined FREQ_CENT -#define FREQ_CENT (433100000ul + 0)//200000 +#define FREQ_CENT (470100000ul)//500000 #endif #if !defined FREQ_DEV #define FREQ_DEV 1000000ul diff --git a/Module/LaserTracing_Debug/UartDebug.c b/Module/LaserTracing_Debug/UartDebug.c index 080d1e1..9b68dc0 100644 --- a/Module/LaserTracing_Debug/UartDebug.c +++ b/Module/LaserTracing_Debug/UartDebug.c @@ -562,7 +562,7 @@ static void DebugLoraConfig(int argc, char *argv[]) if(strcmp(argv[1], "?") == 0) { DBG_LOG("Debug Cmd: lora arg1 arg2\r\n"); DBG_LOG(" brief --> Configure Lora parameters.\r\n"); - DBG_LOG(" arg1 --> ch: Channel--para=(0~16)\r\n"); + DBG_LOG(" arg1 --> ch: Channel--para=(0~45)\r\n"); DBG_LOG(" pw: Power--para=(0~20)\r\n"); DBG_LOG(" bw: SignalBw--para=(0~9)\r\n"); DBG_LOG(" sf: SpreadFactor--para=(6~12)\r\n"); diff --git a/docs/项目架构与工作流程分析.md b/docs/项目架构与工作流程分析.md index dd8ad83..fcb4b19 100644 --- a/docs/项目架构与工作流程分析.md +++ b/docs/项目架构与工作流程分析.md @@ -18,7 +18,7 @@ LaserTracing(激光示踪)是基于华大 HC32L170(ARM Cortex-M0+)超低 ### 1.2 软件版本 -- 软件版本: `SOFTWARE_VERSION = 12` +- 软件版本: `SOFTWARE_VERSION = 13` - 硬件版本: `HARDWARE_VERSION = 11` ## 2. 目录结构 @@ -221,7 +221,7 @@ GW_STATUS_IDLE - CH0 = 470100000,CH1 = 470600000,...,CH45 = 492600000。 - 默认 `FREQ_CENT = CH0`;信道切换上限 `LoraSetChannel` 允许 0~45。 -- 频率范围校验(`LoraSetFreqCent` / AppInit):410000000 ~ 525000000,覆盖全部信道。 +- 频率范围校验(`LoraSetFreqCent` / AppInit):470100000 ~ 492600000,覆盖全部信道。 - 可通过调试命令 `lora ch <0~45>` 配置信道。 ## 7. 调试命令 (UartDebug) diff --git a/source/inc/main.h b/source/inc/main.h index fe63a71..36a216c 100644 --- a/source/inc/main.h +++ b/source/inc/main.h @@ -5,7 +5,7 @@ #include "Update.h" #include "Imu.h" -#define SOFTWARE_VERSION 12 //软件版本 +#define SOFTWARE_VERSION 13 //软件版本 #define HARDWARE_VERSION 11 //硬件版本 #define MAIN_DBG_LOG(...) { if(MainDispEn) DBG_LOG(__VA_ARGS__);} diff --git a/source/src/main.c b/source/src/main.c index 641a3ff..ce36362 100644 --- a/source/src/main.c +++ b/source/src/main.c @@ -137,10 +137,10 @@ static void AppInit(void) App.Para.Layout.FPOTimeStart = 0; } - if(App.Para.BLPara.LoraFreq < 410000000 || App.Para.BLPara.LoraFreq > 525000000) + if(App.Para.BLPara.LoraFreq < 470100000ul || App.Para.BLPara.LoraFreq > 492600000ul) App.Para.BLPara.LoraFreq = CH0; App.Para.Lora.FreqCent = App.Para.BLPara.LoraFreq; - SX1276LoRaWriteFreq(App.Para.Lora.FreqCent); //Lora频率:433100000ul + 200000*N + SX1276LoRaWriteFreq(App.Para.Lora.FreqCent); //Lora频率:470100000ul + 500000*N if(App.Para.Rs485Ch1.Addr > 16 || App.Para.Rs485Ch1.Addr < 1){ App.Para.Rs485Ch1.Addr = 1; @@ -167,7 +167,7 @@ static void AppInit(void) App.Para.Layout.FPOTime = 0; } if(App.Para.LaserTimerMinutes < 0 || App.Para.LaserTimerMinutes > 240) - App.Para.LaserTimerMinutes = 10; + App.Para.LaserTimerMinutes = 1; SGCP.LaserTimerMinutes = App.Para.LaserTimerMinutes; SAVE_APP_PARA((uint32_t *)&App.Para);