初始版本
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
#include "bsp.h"
|
||||
#include "UartDebug.h"
|
||||
#include "Imu.h"
|
||||
|
||||
#define X 0
|
||||
#define Y 1
|
||||
#define Z 2
|
||||
#define XYZ 3
|
||||
|
||||
#define SYSTEM_TIMING_LOGIN (86400 / 30) //系统定时注册时间(一天86400秒)
|
||||
#define ERR_TIMING_LOGIN (1800 / 30) //注册错误重新注册时间(半个小时1800秒)
|
||||
|
||||
#define TEST_TIME (60*60*1000)
|
||||
|
||||
#define ERINTERVAL_VPT 10 //紧急上报阈值,单位0.1°
|
||||
#define ERINTERVAL_VPT 10 //紧急上报阈值,单位0.1°
|
||||
|
||||
typedef struct {//传感器原始数据
|
||||
float acce[XYZ];
|
||||
float gy[XYZ];
|
||||
float mag[XYZ];
|
||||
}__attribute__ ((packed))SensorData_T,*SensorDp;//传感器数据
|
||||
|
||||
typedef struct {//转换的数据
|
||||
int16_t Pitch; //俯仰角偏斜 (范围±900)单位0.1°
|
||||
int16_t Roll; //横滚角偏斜 (范围±900)单位0.1°
|
||||
int16_t Yaw; //偏航角偏斜 (范围0~3600)单位0.1°
|
||||
// int16_t Temp; //温度值
|
||||
// int32_t AD; //AD值
|
||||
}__attribute__ ((packed))ConvertedData_T, *ConvertedDp;
|
||||
|
||||
typedef struct {// 姿态角数据
|
||||
Rad_T Rad;
|
||||
Deg_T Deg;
|
||||
}__attribute__ ((packed))AHRSData_T,*AHRSDp;
|
||||
|
||||
/*主程序状态机*/
|
||||
typedef enum {
|
||||
APP_STATUS_IDLE,
|
||||
APP_STATUS_SLEEP,
|
||||
APP_STATUS_ON,
|
||||
APP_STATUS_OFF,
|
||||
APP_STATUS_ACTION,
|
||||
APP_STATUS_WAIT_LOGIN,
|
||||
APP_STATUS_WAIT_UPLOAD,
|
||||
}AppStatus_m;
|
||||
|
||||
/*数据读取状态机*/
|
||||
typedef enum {
|
||||
READDATA_STATUS_IDLE,
|
||||
READDATA_STATUS_UPDAING,
|
||||
READDATA_STATUS_WAIT_UPDAING,
|
||||
READDATA_STATUS_DATA_HANDLE,
|
||||
}ReadDataStatus_m;
|
||||
|
||||
typedef struct {
|
||||
AppStatus_m Status;//状态
|
||||
ReadDataStatus_m RDStatus;//读取数据状态
|
||||
|
||||
uint32_t TD1mSDelayCnt;
|
||||
uint8_t FeedDogDlyCnt;
|
||||
uint32_t ReadData1mSDelayCnt;
|
||||
uint32_t SysResetTimeCnt;
|
||||
|
||||
SensorData_T Sensor;
|
||||
AppPara_T Para;
|
||||
AHRSData_T AHRSData;
|
||||
ConvertedData_T ConvertedData;
|
||||
|
||||
uint32_t RepeLoginCount; //24h重复注册计数
|
||||
uint8_t Login30MinCount; //注册30分定时计数
|
||||
uint8_t Login2Min30SCount; //注册100ms~2分+30s定时计数
|
||||
bool Login_RTC; //注册30分定时器启动标志位
|
||||
bool Login_LPTimer0; //注册100ms~2分+30s定时器启动标志位
|
||||
bool LoginFlag; //注册标志位
|
||||
|
||||
uint16_t Coll_N; //数据采集时间计数
|
||||
uint16_t Repor_N; //上报时间计数
|
||||
uint16_t ERInterval_N; //紧急上报时间间隔计数
|
||||
uint8_t ERTime_N; //紧急上报时间计数
|
||||
bool ERFlag; //紧急上报标志位
|
||||
|
||||
bool UploadFlag; //上传数据标志位
|
||||
uint8_t Upload45S10SCount; //上传数据超时计数
|
||||
bool Upload_LPTimer0; //上传100~10000ms+45秒定时器启动标志位
|
||||
|
||||
bool MagRead_EndFlag;
|
||||
bool AccRead_EndFlag;
|
||||
bool UpdateOk; //数据更新标志位
|
||||
|
||||
bool CaliFlag; //标校标志位
|
||||
|
||||
int16_t Nonce; //随机数
|
||||
|
||||
uint32_t TestTimeCnt;
|
||||
uint8_t Tcnt;
|
||||
bool LaserFlag;
|
||||
}AppDetect_t;
|
||||
|
||||
extern AppDetect_t App;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user