From a3198e56a9a733a514af1c05a5606a2499aefada Mon Sep 17 00:00:00 2001 From: YuanHongbin <975559679@qq.com> Date: Tue, 28 Apr 2026 15:11:44 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81public.h=E6=96=87=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=BD=93=E5=A2=9E=E5=8A=A0=E5=AD=97=E8=8A=82?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=202=E3=80=81GATEMEY=5FPARA=5FSAV=5FADDR?= =?UTF-8?q?=E6=89=87=E5=8C=BA=E5=86=85=E5=AD=98=E5=A2=9E=E5=8A=A0=E5=88=B0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=89=87=E5=8C=BA=EF=BC=8C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=87=E5=8C=BA=E8=B5=B7=E5=A7=8B=E5=9C=B0=E5=9D=80=E5=90=8E?= =?UTF-8?q?=E7=A7=BB=203=E3=80=81spiflash=E5=86=99=E5=85=A5=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=B8=AD=EF=BC=8C=E8=B7=A8=E6=89=87=E5=8C=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=87=BD=E6=95=B0=E9=87=8A=E6=94=BE=EF=BC=8C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E4=BF=AE=E5=A4=8D=E7=BD=91=E5=85=B3=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E6=89=A9=E5=AE=B9=E5=90=8E=E7=9A=84=E8=B7=A8?= =?UTF-8?q?=E6=89=87=E5=8C=BA=E8=AF=BB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/GateWay/source/User/Inc/Public.h | 8 ++++---- Project/GateWay/source/User/Inc/spiflash.h | 4 ++-- Project/GateWay/source/User/Src/spiflash.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project/GateWay/source/User/Inc/Public.h b/Project/GateWay/source/User/Inc/Public.h index 0d2e06a..22ad5e0 100644 --- a/Project/GateWay/source/User/Inc/Public.h +++ b/Project/GateWay/source/User/Inc/Public.h @@ -180,15 +180,15 @@ typedef struct { uint16_t ReportInterval; //上报时间间隔 uint8_t ERInterval; //紧急上报时间间隔 uint8_t ERTime; //紧急上报时长 -}CommUnitPara_t, *CommUnitPara; +}__attribute__((packed))CommUnitPara_t, *CommUnitPara; typedef struct { uint8_t Data[SENSOR_NUM_MAX][SENSOR_DATA_LEN_MAX]; -}CommUnitData_t, *CommUnitData; +}__attribute__((packed))CommUnitData_t, *CommUnitData; typedef struct { CommUnitPara_t Para; -}CommUnit_t, *CommUnit; +}__attribute__((packed))CommUnit_t, *CommUnit; typedef struct { bool Enable; //串口使能 @@ -199,7 +199,7 @@ typedef struct { uint32_t BaudRate; SendData RS485Send; CommUnit_t CUData; -}RS485Para_t, *RS485Para; +}__attribute__((packed))RS485Para_t, *RS485Para; typedef struct { uint8_t Header; diff --git a/Project/GateWay/source/User/Inc/spiflash.h b/Project/GateWay/source/User/Inc/spiflash.h index 48cd15b..cbfcd1c 100644 --- a/Project/GateWay/source/User/Inc/spiflash.h +++ b/Project/GateWay/source/User/Inc/spiflash.h @@ -37,8 +37,8 @@ uint32_t SpiFlashReadId(void); #define GATEWEY_PARA_SAV_ADDR 0x00 #define GATEWEY_PARA_SAV_SECTOR 0x00 -#define LOG_INFO_START_SECTOR 0x01 -#define LOG_SAV_START_SECTOR 0x02 +#define LOG_INFO_START_SECTOR 0x02 +#define LOG_SAV_START_SECTOR 0x03 //#if (LORA_MODULE == WH_LR36_L) //#define LOG_SAV_SIZE 78 diff --git a/Project/GateWay/source/User/Src/spiflash.c b/Project/GateWay/source/User/Src/spiflash.c index c22f2fe..217efc5 100644 --- a/Project/GateWay/source/User/Src/spiflash.c +++ b/Project/GateWay/source/User/Src/spiflash.c @@ -106,7 +106,7 @@ void SpiFlashWriteAnyLengthData(uint8_t* wData, uint32_t wAddr, uint16_t wLen) uint16_t FirstPageRemainSpace = SPIFLASH_PAGESIZE - (WriteAddr % SPIFLASH_PAGESIZE); // //判断是否跨扇区,跨扇区需要先擦除下一扇区 -// CheckDelSecter(wAddr, wLen); + CheckDelSecter(wAddr, wLen); if(wLen < FirstPageRemainSpace) { FirstPageWriteSize = wLen; //计算首页写入长度