【类 型】:feat 1完成校准加速度计功能 2.factor 更新校准磁罗盘功能

【原  因】:
【过  程】:1校加速度计弹出框 根据飞控的文本提示 做出提示 一步一步校准 2.磁罗盘校准 打开 关闭弹出框时对 校准进度 校准结果进行初始化
【影  响】:
This commit is contained in:
tk 2024-08-30 18:50:58 +08:00
parent 4e3acac032
commit 48e2a26ed7
2 changed files with 50 additions and 18 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="w-100 h-100 mainBox"> <div class="w-100 h-100 mainBox">
<!-- 弹出框 --> <!-- 弹出框 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="320px" top="30vh" @close="closeCallback"> <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="320px" top="30vh" @close="closeCallback" @open="openCallback">
<!-- 起飞设置弹出框 --> <!-- 起飞设置弹出框 -->
<template v-if="dialogItem == 'takeoffBox'"> <template v-if="dialogItem == 'takeoffBox'">
<el-slider class="w-100" v-model="takeoffValue" :show-tooltip="false" show-input :min="1" :max="100"> <el-slider class="w-100" v-model="takeoffValue" :show-tooltip="false" show-input :min="1" :max="100">
@ -52,16 +52,34 @@
</template> </template>
<!-- 校准加速度计 --> <!-- 校准加速度计 -->
<template v-if="dialogItem === 'acceBox'"> <template v-if="dialogItem === 'acceBox'">
<div> <div v-loading="acceState===null"></div>
<template v-if="reportCal === null"> <div v-if="acceState==='level'">
<el-progress :percentage="completionPct"></el-progress> 水平
</template> </div>
<template v-else> <div v-else-if="acceState==='left'">
{{ reportCal === 'successful' ? '校准成功,重启飞机即可生效!' : '校准失败!' }}
</template> </div>
<div v-else-if="acceState==='right'">
</div>
<div v-else-if="acceState==='down'">
</div>
<div v-else-if="acceState==='up'">
</div>
<div v-else-if="acceState==='back'">
</div>
<div v-else-if="acceState==='successful'">
校准成功重启飞机即可生效
</div>
<div v-else-if="acceState==='failed'">
校准失败
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="medium" @click="handlerCloseCompassBox">关闭</el-button> <el-button size="medium" @click="handlerCloseAcceBox">关闭</el-button>
<el-button size="medium" v-if="acceState !== 'successful' && acceState !== 'failed' && acceState !== null" @click="publishFun('{initAcce:2}')" type="primary">已摆好</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
@ -272,12 +290,12 @@
<div class="m-t-5">磁罗盘</div> <div class="m-t-5">磁罗盘</div>
</el-button> </el-button>
<el-button size="medium" type="primary" class="flex1 butIcon" <el-button size="medium" type="primary" class="flex1 butIcon"
@click="publishFun(); speakText('校准加速度计');dialogVisible = true; dialogTitle = '校准加速度计';dialogItem = 'acceBox';"> @click="publishFun('{initAcce:1}'); speakText('校准加速度计');dialogVisible = true; dialogTitle = '校准加速度计';dialogItem = 'acceBox';">
<i class="iconfont icon-zuobiaozhoupeizhixiang f-s-24"></i> <i class="iconfont icon-zuobiaozhoupeizhixiang f-s-24"></i>
<div class="m-t-5">{{ acceState }}</div> <div class="m-t-5">加速度计</div>
</el-button> </el-button>
<el-button size="medium" type="primary" class="flex1 butIcon" <el-button size="medium" type="primary" class="flex1 butIcon"
@click="publishFun('{initAcce:2}'); speakText('写入参数')"> @click="speakText('写入参数')">
<i class="iconfont icon-canshupeizhi f-s-24"></i> <i class="iconfont icon-canshupeizhi f-s-24"></i>
<div class="m-t-5">写入参数</div> <div class="m-t-5">写入参数</div>
</el-button> </el-button>
@ -398,16 +416,16 @@ export default {
* @description: 磁罗盘校准进度 * @description: 磁罗盘校准进度
*/ */
completionPct () { completionPct () {
if (this.plane && this.plane.planeState) { if (this.plane && this.plane.planeState && this.plane.planeState.completionPct) {
return Number(this.plane.planeState.completionPct) return Number(this.plane.planeState.completionPct)
} }
return null return 0
}, },
/** /**
* @description: 磁罗盘校准结果 * @description: 磁罗盘校准结果
*/ */
reportCal () { reportCal () {
if (this.plane && this.plane.planeState) { if (this.plane && this.plane.planeState && this.plane.planeState.reportCal) {
return this.plane.planeState.reportCal return this.plane.planeState.reportCal
} }
return null return null
@ -419,7 +437,7 @@ export default {
if (this.plane && this.plane.planeState && this.plane.planeState.acceState) { if (this.plane && this.plane.planeState && this.plane.planeState.acceState) {
return this.plane.planeState.acceState return this.plane.planeState.acceState
} }
return '加速度计' return null
} }
}, },
methods: { methods: {
@ -429,11 +447,25 @@ export default {
*/ */
handlerCloseCompassBox () { handlerCloseCompassBox () {
this.dialogVisible = false this.dialogVisible = false
//
this.plane.planeState.reportCal = null this.plane.planeState.reportCal = null
this.plane.planeState.completionPct = 0
},
/**
*关闭磁盘校准弹出窗口
*/
handlerCloseAcceBox () {
this.dialogVisible = false
//
this.plane.planeState.acceState = null
}, },
/** 弹出框 关闭事件回调 */ /** 弹出框 关闭事件回调 */
closeCallback () { closeCallback () {
if (this.dialogItem === 'compassBox') { this.handlerCloseCompassBox() } if (this.dialogItem === 'compassBox') { this.handlerCloseCompassBox() } else if (this.dialogItem === 'acceBox') { this.handlerCloseAcceBox() }
},
/** 弹出框 打开事件回调 */
openCallback () {
if (this.dialogItem === 'compassBox') { this.plane.planeState.reportCal = null }//
}, },
/** /**
* @description: 摄像头 滑动条松开 * @description: 摄像头 滑动条松开

View File

@ -278,7 +278,7 @@ const store = new Vuex.Store({
groundSpeed: null, // 对地速度 groundSpeed: null, // 对地速度
satCount: null, // 卫星数量 satCount: null, // 卫星数量
fixType: null, // 定位状态 fixType: null, // 定位状态
completionPct: null, // 磁罗盘校准进度 completionPct: 0, // 磁罗盘校准进度
reportCal: null, // 磁罗盘校准结果 reportCal: null, // 磁罗盘校准结果
state: 1, // 飞机状态 默认初始状态为1 state: 1, // 飞机状态 默认初始状态为1
acceState: null, // 加速度计校准状态 acceState: null, // 加速度计校准状态