706eb1247e
- sx127x.h: CH0~CH45中心频率改为470100000~492600000, 步进500000; FREQ_CENT/USE_LORA_CH扩展至CH45 - sx127x.c: LoraSetChannel信道上限16->45; LoraSetFreqCent频率校验改为470.1~492.6MHz; 移除BOM - main.c: LoraFreq频率校验同步改为470.1~492.6MHz; 激光默认关闭时间10分钟->1分钟 - UartDebug.c: lora帮助文本信道范围更新为0~45 - main.h: 软件版本12->13 - docs: 更新软件版本号与LoRa频率范围说明 - MDK: 调试器配置更新
118 lines
3.2 KiB
C
118 lines
3.2 KiB
C
#ifndef __MAIN_H
|
|
#define __MAIN_H
|
|
#include "bsp.h"
|
|
#include "UartDebug.h"
|
|
#include "Update.h"
|
|
#include "Imu.h"
|
|
|
|
#define SOFTWARE_VERSION 13 //软件版本
|
|
#define HARDWARE_VERSION 11 //硬件版本
|
|
|
|
#define MAIN_DBG_LOG(...) { if(MainDispEn) DBG_LOG(__VA_ARGS__);}
|
|
#define DATA_DBG_LOG(...) { if(DataDispEn) DBG_LOG(__VA_ARGS__);}
|
|
|
|
|
|
#define X 0
|
|
#define Y 1
|
|
#define Z 2
|
|
#define XYZ 3
|
|
|
|
#define SYSTEM_TIMING_RESET (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;
|
|
|
|
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; //标校标志位
|
|
|
|
uint16_t Nonce; //随机数
|
|
bool AttTestMode; //姿态测试模式标志位
|
|
uint32_t AttTestCnt; //姿态测试打印计数(ms)
|
|
}AppDetect_t;
|
|
extern AppDetect_t App;
|
|
|
|
void MainDBGOnOff(bool OnOff);
|
|
void DataDBGOnOff(bool OnOff);
|
|
bool IsFullPowerTime(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|