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; //计算首页写入长度