2 Commits

Author SHA1 Message Date
YuanHongbin 078e5731bb docs: sx127x.h补充编译期信道选择注释示例(USE_LORA_CH, 0~119) 2026-09-08 15:31:02 +08:00
YuanHongbin a8d81780e8 feat: LoRa频率设定范围改为433.1~492.6MHz, 步进500KHz
- sx127x.h: CH0~CH45宏表(470.1~492.6MHz, 46信道)替换为算术定义:
  LORA_FREQ_BASE=433100000, LORA_FREQ_STEP=500000, LORA_FREQ_MAX=492600000,
  LORA_CHANNEL_CNT=120(CH0~CH119); FREQ_CENT由编译期USE_LORA_CH(0~119)算术换算,
  未指定时出厂默认CH0=433.1MHz
- sx127x.c: LoraSetFreqCent范围校验放宽至433.1~492.6MHz; LoraSetChannel上限45->119
- main.c: Flash参数BLPara.LoraFreq范围校验同步放宽至433.1~492.6MHz
- 频率公式: Freq = 433100000 + 500000*N, N = 0~119
- 新旧信道号映射: 旧CHn = 新CH(74+n), 例: 旧CH0(470.1MHz) = 新CH74
- 注意: 网关侧需使用相同频率集合
- 所有编辑文件保持UTF-8编码(无BOM)
2026-09-08 09:53:48 +08:00
4 changed files with 27 additions and 180 deletions
+2 -2
View File
@@ -622,7 +622,7 @@ void Sx1276RxRetValue(void)
bool LoraSetChannel(uint8_t Channel) bool LoraSetChannel(uint8_t Channel)
{ {
if(Channel > 45) if(Channel >= LORA_CHANNEL_CNT) //宽带版: 0~119
return false; return false;
LoRaPara.ucChannel = Channel; LoRaPara.ucChannel = Channel;
return true; return true;
@@ -667,7 +667,7 @@ bool LoraSetRegPreamble(uint8_t RegPreamble)
} }
bool LoraSetFreqCent(uint32_t FreqCent) bool LoraSetFreqCent(uint32_t FreqCent)
{ {
if(FreqCent < 470100000ul || FreqCent > 492600000ul) if(FreqCent < LORA_FREQ_BASE || FreqCent > LORA_FREQ_MAX) //宽带: 433.1~492.6MHz
return false; return false;
LoRaPara.dwFreqHz = FreqCent; LoRaPara.dwFreqHz = FreqCent;
return true; return true;
+23 -145
View File
@@ -637,7 +637,7 @@ typedef enum{
SX1276_IH_ON= (1) SX1276_IH_ON= (1)
}Sx1276ImplicitHeaderOnType; }Sx1276ImplicitHeaderOnType;
// ɱ // ?
typedef struct _AutoSfType{ typedef struct _AutoSfType{
Sx1276SpreadFactorType Sf; Sx1276SpreadFactorType Sf;
uint8_t ucRssiMin, ucRssiMax; uint8_t ucRssiMin, ucRssiMax;
@@ -745,162 +745,40 @@ typedef struct {
//Down Link: //Down Link:
//CH0-47:500.3-509.7MHz //CH0-47:500.3-509.7MHz
#define USE_915MHZ 0//=1ʹ 915 =0ʹ 433 #define USE_915MHZ 0//=1? 915 =0? 433
#if (USE_915MHZ == 1) #if (USE_915MHZ == 1)
// Ƶ ʣ Ĭ Ϊ449000000Hz // ? ? ? ?449000000Hz
#define FREQ_CENT 915000000ul #define FREQ_CENT 915000000ul
//860MHz-1GHzʹ PA ţ Ĭ ϲ ʹ //860MHz-1GHz? PA ? ? ? ?
//SX127x 壬HOPERFģ Ҫ //SX127x 壬HOPERF? ?
#define USE_LORA_860_PA #define USE_LORA_860_PA
#endif #endif
/* /*
中心频率配置470100000ul ~ 492600000ul步进500000 中心频率配置(宽带版): 433100000ul ~ 492600000ul, 步进500000, 共120信道(CH0~CH119)
频率公式: Freq = 433100000 + 500000*N, N = 0~119
编译期可用 USE_LORA_CH(0~119) 指定频率; 未指定时出厂默认 CH0=433.1MHz
*/ */
#define CH0 (470100000ul) //出厂默认频率 #define LORA_FREQ_BASE (433100000ul)
#define CH1 (470600000ul) #define LORA_FREQ_STEP (500000ul)
#define CH2 (471100000ul) #define LORA_FREQ_MAX (492600000ul)
#define CH3 (471600000ul) #define LORA_CHANNEL_CNT (120)
#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 CH0 LORA_FREQ_BASE //出厂默认频率
#define FREQ_CENT CH0
#elif (USE_LORA_CH == 1) //#define USE_LORA_CH 1
#define FREQ_CENT CH1
#elif (USE_LORA_CH == 2) #if defined(USE_LORA_CH)
#define FREQ_CENT CH2 #if (USE_LORA_CH >= 0 && USE_LORA_CH < LORA_CHANNEL_CNT)
#elif (USE_LORA_CH == 3) #define FREQ_CENT (LORA_FREQ_BASE + (uint32_t)(USE_LORA_CH) * LORA_FREQ_STEP)
#define FREQ_CENT CH3 #else
#elif (USE_LORA_CH == 4) #error "USE_LORA_CH out of range, valid: 0 ~ 119"
#define FREQ_CENT CH4 #endif
#elif (USE_LORA_CH == 5)
#define FREQ_CENT CH5
#elif (USE_LORA_CH == 6)
#define FREQ_CENT CH6
#elif (USE_LORA_CH == 7)
#define FREQ_CENT CH7
#elif (USE_LORA_CH == 8)
#define FREQ_CENT CH8
#elif (USE_LORA_CH == 9)
#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 #endif
#if !defined FREQ_CENT #if !defined FREQ_CENT
#define FREQ_CENT (470100000ul)//500000 #define FREQ_CENT (CH0)//500000
#endif #endif
#if !defined FREQ_DEV #if !defined FREQ_DEV
#define FREQ_DEV 1000000ul #define FREQ_DEV 1000000ul
+2 -2
View File
@@ -137,10 +137,10 @@ static void AppInit(void)
App.Para.Layout.FPOTimeStart = 0; App.Para.Layout.FPOTimeStart = 0;
} }
if(App.Para.BLPara.LoraFreq < 470100000ul || App.Para.BLPara.LoraFreq > 492600000ul) if(App.Para.BLPara.LoraFreq < LORA_FREQ_BASE || App.Para.BLPara.LoraFreq > LORA_FREQ_MAX) //宽带: 433.1~492.6MHz
App.Para.BLPara.LoraFreq = CH0; App.Para.BLPara.LoraFreq = CH0;
App.Para.Lora.FreqCent = App.Para.BLPara.LoraFreq; App.Para.Lora.FreqCent = App.Para.BLPara.LoraFreq;
SX1276LoRaWriteFreq(App.Para.Lora.FreqCent); //Lora频率:470100000ul + 500000*N SX1276LoRaWriteFreq(App.Para.Lora.FreqCent); //Lora频率:433100000ul + 500000*N, 范围433.1~492.6MHz
if(App.Para.Rs485Ch1.Addr > 16 || App.Para.Rs485Ch1.Addr < 1){ if(App.Para.Rs485Ch1.Addr > 16 || App.Para.Rs485Ch1.Addr < 1){
App.Para.Rs485Ch1.Addr = 1; App.Para.Rs485Ch1.Addr = 1;
-31
View File
@@ -1,31 +0,0 @@
设备前述:建议长时间供电,送检样机不需要进入低功耗,避免设备重复性差的问题。
该版本为低功耗版本,采用12V供电,休眠电流380uA,工作电流18mA
硬件版本记录:HV4.x系列
==>>Crack_Left_HV4.0 and Crack_Right_HV4.0
1、H7233-1LDO,输出稳定的3.3V,最大输入15V
2、HC32L170JATA-LQ48:设备的MCU主控芯片
3、LSM6DSLTR:六轴加速度芯片
4、MMC5983MA:三轴地磁芯片
5、MAX3471EUA+:串口转485芯片
6、Ra-02LORA通信芯片
硬件版本变更记录:
Crack_Left_HV4.0 ==> Crack_Left_HV4.1 Release 2024-06-21
Crack_Right_HV4.0 ==> Crack_Right_HV4.1 Release 2024-06-21
1、调整了主副板FPC母座位置
==> Crack_Left_HV4.0 Release 2024-06-12
==> Crack_Right_HV4.0 Release 2024-06-12
1、板框改大
2、连接座子换成5P+4P的FPC座子
3、传感器中断脚修改
代码版本变更记录:
CrackUnit_Active_SV1.0 ==>> CrackUnit_Active_SV1.1 Release 2024-08-08
1、使用了MMC5983中断引脚,修复了驱动bug
2、修复了均值滤波函数bug
==>>CrackUnit_Active_SV1.0 Release 2024-08-01
该版本为低功耗版本