1、实现了向惯导设置参数;

2、简化代码:抽象出构造和发送命令函数(constructAndSendInstruction)
This commit is contained in:
tangchao0503
2022-06-05 21:03:12 +08:00
parent 5a040caf18
commit 7d71a40b15
3 changed files with 180 additions and 417 deletions

View File

@ -4,18 +4,27 @@
#include "witmotiondll_global.h"
#include <iostream>
#include <string.h>
#include <string>
#include <thread>
#include "serialportbase.h"
#include "register.h"
typedef void (*delay)(uint32_t millisecond);
typedef void (*witPrintf)(const char* text);
class WITMOTIONDLLSHARED_EXPORT WitmotionDll
{
public:
WitmotionDll(SerialPortBase * serialPort);
int delayMsRegister(delay delayFunction);
int printfRegister(witPrintf printfFunction);
void setDelayTimeMs(uint32_t millisecond);
int constructAndSendInstruction(int registerAddress, int registerContent);
int unlockInstruction();
int saveInstruction();
@ -24,7 +33,7 @@ public:
//系统
int algorithm(ALGROITHM_ENUM algorithm);
int installationOrientation(ORIENT_ENUM orient);
int instructStart(POWONSEND_ENUM command);//是否上电输出数据
int instructStart(POWONSEND_ENUM command);//是否上电输出数据,可以防止鼠标乱跳
//校准:完成后,需要退出校准模式( 调用exitCalibration
@ -33,17 +42,15 @@ public:
int magneticCalibration();
int setHeightToZero();//需要JY901B带有高度数据输出的模块才能进行高度校准此为相对高度短时间内有效
int setZAxisAngleToZero();//Z轴角度归零只在切换成 6 轴算法下才能成功置零;
int setAngleReference();//问技术支持,文档没有,不建议使用,设置后只能在静态下运动,即原点旋转单轴,其他方式旋转出来会有比较大的误差
int setAngleReference();//问技术支持,文档没有,不建议使用,设置后只能在静态下运动,即原点旋转单轴,其他方式旋转出来会有比较大的误差
//范围
int setTimeZone(TIMEZONE_ENUM timeZone);
//设置回传内容:操作位??????????????????????
int latitudeLongitude();
int eulerAngle();
int setContent(RETURN_CONTENT_ENUM content);
int clearContent(RETURN_CONTENT_ENUM content);
//设置回传内容
int setContent(RETURN_CONTENT_STRUCT content);
int clearContent(RETURN_CONTENT_STRUCT content);
//通讯
int SetBaudrate(BAUD_ENUM baudrate);
@ -66,10 +73,13 @@ public:
int setD2Period(int period);
int setD3Period(int period);
private:
SerialPortBase * m_SerialPort;
int TIME_TO_SLEEP = 500;//毫秒
uint32_t TIME_TO_SLEEP = 500;//毫秒
delay m_delayFunction;
witPrintf m_witPrintf;
};