1、public.h文件的结构体增加字节对齐

2、GATEMEY_PARA_SAV_ADDR扇区内存增加到两个扇区,日志扇区起始地址后移
3、spiflash写入函数中,跨扇区判断函数释放,用于修复网关参数存储扩容后的跨扇区读写
This commit is contained in:
2026-04-28 15:11:44 +08:00
parent 23ab9ca0f9
commit a3198e56a9
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -180,15 +180,15 @@ typedef struct {
uint16_t ReportInterval; //上报时间间隔 uint16_t ReportInterval; //上报时间间隔
uint8_t ERInterval; //紧急上报时间间隔 uint8_t ERInterval; //紧急上报时间间隔
uint8_t ERTime; //紧急上报时长 uint8_t ERTime; //紧急上报时长
}CommUnitPara_t, *CommUnitPara; }__attribute__((packed))CommUnitPara_t, *CommUnitPara;
typedef struct { typedef struct {
uint8_t Data[SENSOR_NUM_MAX][SENSOR_DATA_LEN_MAX]; uint8_t Data[SENSOR_NUM_MAX][SENSOR_DATA_LEN_MAX];
}CommUnitData_t, *CommUnitData; }__attribute__((packed))CommUnitData_t, *CommUnitData;
typedef struct { typedef struct {
CommUnitPara_t Para; CommUnitPara_t Para;
}CommUnit_t, *CommUnit; }__attribute__((packed))CommUnit_t, *CommUnit;
typedef struct { typedef struct {
bool Enable; //串口使能 bool Enable; //串口使能
@@ -199,7 +199,7 @@ typedef struct {
uint32_t BaudRate; uint32_t BaudRate;
SendData RS485Send; SendData RS485Send;
CommUnit_t CUData; CommUnit_t CUData;
}RS485Para_t, *RS485Para; }__attribute__((packed))RS485Para_t, *RS485Para;
typedef struct { typedef struct {
uint8_t Header; uint8_t Header;
+2 -2
View File
@@ -37,8 +37,8 @@ uint32_t SpiFlashReadId(void);
#define GATEWEY_PARA_SAV_ADDR 0x00 #define GATEWEY_PARA_SAV_ADDR 0x00
#define GATEWEY_PARA_SAV_SECTOR 0x00 #define GATEWEY_PARA_SAV_SECTOR 0x00
#define LOG_INFO_START_SECTOR 0x01 #define LOG_INFO_START_SECTOR 0x02
#define LOG_SAV_START_SECTOR 0x02 #define LOG_SAV_START_SECTOR 0x03
//#if (LORA_MODULE == WH_LR36_L) //#if (LORA_MODULE == WH_LR36_L)
//#define LOG_SAV_SIZE 78 //#define LOG_SAV_SIZE 78
+1 -1
View File
@@ -106,7 +106,7 @@ void SpiFlashWriteAnyLengthData(uint8_t* wData, uint32_t wAddr, uint16_t wLen)
uint16_t FirstPageRemainSpace = SPIFLASH_PAGESIZE - (WriteAddr % SPIFLASH_PAGESIZE); uint16_t FirstPageRemainSpace = SPIFLASH_PAGESIZE - (WriteAddr % SPIFLASH_PAGESIZE);
// //判断是否跨扇区,跨扇区需要先擦除下一扇区 // //判断是否跨扇区,跨扇区需要先擦除下一扇区
// CheckDelSecter(wAddr, wLen); CheckDelSecter(wAddr, wLen);
if(wLen < FirstPageRemainSpace) { if(wLen < FirstPageRemainSpace) {
FirstPageWriteSize = wLen; //计算首页写入长度 FirstPageWriteSize = wLen; //计算首页写入长度