✨ feat(gps): 新增GPS海拔数据支持并优化系统配置
- 在数据包结构中新增gps_altitude字段以支持海拔数据存储 - 更新PackData和PackCorrectedData系列函数,增加altitude参数 - 移除timestamp字段以精简数据包结构,提高传输效率 - 优化GPS数据处理逻辑,取消GPS有效性检查,直接使用原始GPS数据 - 将调试输出和监控保存间隔统一调整为30秒,降低系统负载 - 将数据存储文件最大大小从20MB提升至100MB,支持更长时间数据采集 - 将GPS数据超时时间从2秒延长至10秒,提高在弱信号环境下的稳定性 🔧 chore(spi): 调整SPI配置以优化通信稳定性 - 将所有SPI接口的时钟相位从SPI_PHASE_1EDGE调整为SPI_PHASE_2EDGE - 将SPI1的波特率预分频器从4调整为8,降低通信速率以提高稳定性 - 更新STM32CubeMX配置文件(.ioc)以反映SPI配置变更 📝 docs(script): 新增高性能数据分析工具脚本 - 创建atem_parse.py脚本,提供数据解析和可视化功能 - 支持V1/V2数据格式解析,V2版本包含GPS经纬度和海拔数据 - 实现串口实时数据接收和GPS动态模拟输出功能 - 提供波形图、轨迹图和海拔曲线等多标签可视化界面 - 包含数据表格展示和CSV导出功能,支持高性能大数据处理
This commit is contained in:
+9
-6
@@ -19,7 +19,7 @@ uint16_t Calculate_CRC16(const uint8_t *data, uint16_t len) {
|
||||
}
|
||||
|
||||
void PackData(DataPacket_t *packet, int32_t adc1, int32_t adc2, int32_t adc3,
|
||||
uint32_t gps_time, float latitude, float longitude)
|
||||
uint32_t gps_time, float latitude, float longitude, float altitude)
|
||||
{
|
||||
if (packet == NULL) return;
|
||||
|
||||
@@ -27,7 +27,7 @@ void PackData(DataPacket_t *packet, int32_t adc1, int32_t adc2, int32_t adc3,
|
||||
packet->start_byte = PACKET_START_BYTE;
|
||||
|
||||
// 设置时间戳
|
||||
packet->timestamp = HAL_GetTick();
|
||||
// packet->timestamp = HAL_GetTick();
|
||||
|
||||
// 设置ADC数据
|
||||
packet->adc_data1 = adc1;
|
||||
@@ -38,6 +38,7 @@ void PackData(DataPacket_t *packet, int32_t adc1, int32_t adc2, int32_t adc3,
|
||||
packet->gps_time = gps_time;
|
||||
packet->gps_latitude = latitude;
|
||||
packet->gps_longitude = longitude;
|
||||
packet->gps_altitude = altitude;
|
||||
}
|
||||
|
||||
uint8_t ValidatePacket(const DataPacket_t *packet)
|
||||
@@ -63,7 +64,7 @@ uint8_t ValidateCorrectedPacket(const CorrectedDataPacket_t *packet)
|
||||
}
|
||||
|
||||
void PackCorrectedData(CorrectedDataPacket_t *packet, float x, float y, float z,
|
||||
uint32_t gps_time, float latitude, float longitude)
|
||||
uint32_t gps_time, float latitude, float longitude, float altitude)
|
||||
{
|
||||
if (packet == NULL) return;
|
||||
|
||||
@@ -71,7 +72,7 @@ void PackCorrectedData(CorrectedDataPacket_t *packet, float x, float y, float z,
|
||||
packet->start_byte = PACKET_START_BYTE;
|
||||
|
||||
// 设置时间戳
|
||||
packet->timestamp = HAL_GetTick();
|
||||
// packet->timestamp = HAL_GetTick();
|
||||
|
||||
// 设置校正后数据
|
||||
packet->corrected_x = x;
|
||||
@@ -82,10 +83,11 @@ void PackCorrectedData(CorrectedDataPacket_t *packet, float x, float y, float z,
|
||||
packet->gps_time = gps_time;
|
||||
packet->gps_latitude = latitude;
|
||||
packet->gps_longitude = longitude;
|
||||
packet->gps_altitude = altitude;
|
||||
}
|
||||
|
||||
void PackCorrectedDataWithGPS(CorrectedDataPacketWithGPS_t *packet, float x, float y, float z,
|
||||
uint32_t gps_time, float latitude, float longitude)
|
||||
uint32_t gps_time, float latitude, float longitude, float altitude)
|
||||
{
|
||||
if (packet == NULL) return;
|
||||
|
||||
@@ -93,7 +95,7 @@ void PackCorrectedDataWithGPS(CorrectedDataPacketWithGPS_t *packet, float x, flo
|
||||
packet->start_byte = PACKET_START_BYTE;
|
||||
|
||||
// 设置时间戳
|
||||
packet->timestamp = HAL_GetTick();
|
||||
// packet->timestamp = HAL_GetTick();
|
||||
|
||||
// 设置校正后数据
|
||||
packet->corrected_x = x;
|
||||
@@ -104,6 +106,7 @@ void PackCorrectedDataWithGPS(CorrectedDataPacketWithGPS_t *packet, float x, flo
|
||||
packet->gps_time = gps_time;
|
||||
packet->gps_latitude = latitude;
|
||||
packet->gps_longitude = longitude;
|
||||
packet->gps_altitude = altitude;
|
||||
}
|
||||
|
||||
uint8_t ValidateCorrectedPacketWithGPS(const CorrectedDataPacketWithGPS_t *packet)
|
||||
|
||||
+9
-6
@@ -9,47 +9,50 @@
|
||||
// 数据包结构(精简版 - 有包头无校验和,含GPS)
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t start_byte; // 包头 (4字节) = 0xFFFFFFFF
|
||||
uint32_t timestamp; // 系统时间戳 (4字节)
|
||||
// uint32_t timestamp; // 系统时间戳 (4字节)
|
||||
int32_t adc_data1; // ADC1 数据 (4字节)
|
||||
int32_t adc_data2; // ADC2 数据 (4字节)
|
||||
int32_t adc_data3; // ADC3 数据 (4字节)
|
||||
uint32_t gps_time; // GPS时间戳 (4字节) HHMMSS格式
|
||||
float gps_latitude; // GPS纬度 (4字节)
|
||||
float gps_longitude; // GPS经度 (4字节)
|
||||
float gps_altitude; // GPS海拔 (4字节)
|
||||
} DataPacket_t;
|
||||
|
||||
// 校正后数据包结构(精简版 - 有包头无校验和,含GPS)
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t start_byte; // 包头 (4字节) = 0xFFFFFFFF
|
||||
uint32_t timestamp; // 系统时间戳 (4字节)
|
||||
// uint32_t timestamp; // 系统时间戳 (4字节)
|
||||
float corrected_x; // 校正后X轴数据 (4字节)
|
||||
float corrected_y; // 校正后Y轴数据 (4字节)
|
||||
float corrected_z; // 校正后Z轴数据 (4字节)
|
||||
uint32_t gps_time; // GPS时间戳 (4字节) HHMMSS格式
|
||||
float gps_latitude; // GPS纬度 (4字节)
|
||||
float gps_longitude; // GPS经度 (4字节)
|
||||
float gps_altitude; // GPS海拔 (4字节)
|
||||
} CorrectedDataPacket_t;
|
||||
|
||||
// 带GPS信息的校正数据包结构(精简版 - 有包头无校验和)
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t start_byte; // 包头 (4字节) = 0xFFFFFFFF
|
||||
uint32_t timestamp; // 系统时间戳 (4字节)
|
||||
// uint32_t timestamp; // 系统时间戳 (4字节)
|
||||
float corrected_x; // 校正后X轴数据 (4字节)
|
||||
float corrected_y; // 校正后Y轴数据 (4字节)
|
||||
float corrected_z; // 校正后Z轴数据 (4字节)
|
||||
uint32_t gps_time; // GPS时间戳 (4字节) HHMMSS格式
|
||||
float gps_latitude; // GPS纬度 (4字节)
|
||||
float gps_longitude; // GPS经度 (4字节)
|
||||
float gps_altitude; // GPS海拔 (4字节)
|
||||
} CorrectedDataPacketWithGPS_t;
|
||||
|
||||
// 函数声明
|
||||
uint16_t Calculate_CRC16(const uint8_t *data, uint16_t len);
|
||||
void PackData(DataPacket_t *packet, int32_t adc1, int32_t adc2, int32_t adc3,
|
||||
uint32_t gps_time, float latitude, float longitude);
|
||||
uint32_t gps_time, float latitude, float longitude, float altitude);
|
||||
void PackCorrectedData(CorrectedDataPacket_t *packet, float x, float y, float z,
|
||||
uint32_t gps_time, float latitude, float longitude);
|
||||
uint32_t gps_time, float latitude, float longitude, float altitude);
|
||||
void PackCorrectedDataWithGPS(CorrectedDataPacketWithGPS_t *packet, float x, float y, float z,
|
||||
uint32_t gps_time, float latitude, float longitude);
|
||||
uint32_t gps_time, float latitude, float , float altitude);
|
||||
uint8_t ValidatePacket(const DataPacket_t *packet);
|
||||
uint8_t ValidateCorrectedPacket(const CorrectedDataPacket_t *packet);
|
||||
uint8_t ValidateCorrectedPacketWithGPS(const CorrectedDataPacketWithGPS_t *packet);
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
// 数据存储配置
|
||||
#define DATA_STORAGE_BUFFER_SIZE 32768 // 缓冲区大小(字节)
|
||||
#define DATA_STORAGE_FILE_MAX_SIZE (20*1024*1024) // 单个文件最大20MB
|
||||
#define DATA_STORAGE_FILE_MAX_SIZE (100*1024*1024) // 单个文件最大100MB
|
||||
#define DATA_STORAGE_BASE_PATH "0:/DATA" // 数据存储基础路径
|
||||
#define DATA_STORAGE_FILE_PREFIX "/ADC_DATA_" // 文件名前缀
|
||||
#define DATA_STORAGE_FOLDER_PREFIX "SESSION_" // 文件夹名前缀
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ typedef struct {
|
||||
#define GPS_UART_HANDLE huart3 // GPS使用的UART句柄
|
||||
#define GPS_RX_BUFFER_SIZE 512 // 接收缓冲区大小
|
||||
#define GPS_NMEA_MAX_LENGTH 128 // NMEA语句最大长度
|
||||
#define GPS_DATA_TIMEOUT_MS 2000 // 数据超时时间(ms)
|
||||
#define GPS_DATA_TIMEOUT_MS 10000 // 数据超时时间(ms)
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user