Refactor vtx device status (#3208)

Refactor vtx device status to use modules
10.9-maintenance 10.9.0-RC4
Tomas Chmelevskij 2023-01-08 19:38:13 +01:00 committed by GitHub
parent 4582f4d39e
commit 05c6f8681a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import { i18n } from "../localization";
import GUI from "../gui"; import GUI from "../gui";
import FC from "../fc"; import FC from "../fc";
import semver from 'semver'; import semver from 'semver';
import vtxDeviceStatusFactory from "../utils/VtxDeviceStatus/VtxDeviceStatusFactory";
// Used for LED_STRIP // Used for LED_STRIP
const ledDirectionLetters = ['n', 'e', 's', 'w', 'u', 'd']; // in LSB bit order const ledDirectionLetters = ['n', 'e', 's', 'w', 'u', 'd']; // in LSB bit order

View File

@ -4,6 +4,7 @@ import GUI from '../gui';
import { tracking } from "../Analytics"; import { tracking } from "../Analytics";
import { mspHelper } from "../msp/MSPHelper"; import { mspHelper } from "../msp/MSPHelper";
import FC from '../fc'; import FC from '../fc';
import { VtxDeviceTypes } from '../utils/VtxDeviceStatus/VtxDeviceStatus';
const vtx = { const vtx = {
supported: false, supported: false,

View File

@ -1,4 +1,5 @@
'use strict'; import VtxDeviceStatus, { VtxDeviceTypes } from './VtxDeviceStatus';
import vtxDeviceStatusFactory from './VtxDeviceStatusFactory';
class VtxDeviceStatusRtc6705 extends VtxDeviceStatus { class VtxDeviceStatusRtc6705 extends VtxDeviceStatus {
constructor(dataView) constructor(dataView)
@ -17,3 +18,5 @@ class VtxDeviceStatusRtc6705 extends VtxDeviceStatus {
} }
vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusRtc6705); vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusRtc6705);
export default VtxDeviceStatusRtc6705;

View File

@ -1,4 +1,6 @@
'use strict'; import VtxDeviceStatus, { VtxDeviceTypes } from "./VtxDeviceStatus";
import vtxDeviceStatusFactory from "./VtxDeviceStatusFactory";
import { i18n } from "../../localization";
class VtxDeviceStatusSmartAudio extends VtxDeviceStatus { class VtxDeviceStatusSmartAudio extends VtxDeviceStatus {
constructor(dataView) constructor(dataView)
@ -47,3 +49,5 @@ class VtxDeviceStatusSmartAudio extends VtxDeviceStatus {
} }
vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusSmartAudio); vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusSmartAudio);
export default VtxDeviceStatusSmartAudio;

View File

@ -1,4 +1,5 @@
'use strict'; import VtxDeviceStatus, { VtxDeviceTypes } from './VtxDeviceStatus';
import vtxDeviceStatusFactory from './VtxDeviceStatusFactory';
class VtxDeviceStatusTramp extends VtxDeviceStatus { class VtxDeviceStatusTramp extends VtxDeviceStatus {
constructor(dataView) constructor(dataView)
@ -17,3 +18,5 @@ class VtxDeviceStatusTramp extends VtxDeviceStatus {
} }
vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusTramp); vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusTramp);
export default VtxDeviceStatusTramp;

View File

@ -1,6 +1,4 @@
'use strict'; export const VtxDeviceTypes = {
const VtxDeviceTypes = {
VTXDEV_UNSUPPORTED: 0, // reserved for MSP VTXDEV_UNSUPPORTED: 0, // reserved for MSP
VTXDEV_RTC6705: 1, VTXDEV_RTC6705: 1,
// 2 reserved // 2 reserved
@ -78,3 +76,5 @@ class VtxDeviceStatus
return this.constructor.staticDeviceStatusType; return this.constructor.staticDeviceStatusType;
} }
} }
export default VtxDeviceStatus;

View File

@ -1,5 +1,3 @@
'use strict';
const vtxDeviceStatusFactory = { const vtxDeviceStatusFactory = {
_vtxDeviceStatusClasses: [], _vtxDeviceStatusClasses: [],
@ -38,3 +36,5 @@ const vtxDeviceStatusFactory = {
return result; return result;
}, },
}; };
export default vtxDeviceStatusFactory;

View File

@ -1,4 +1,4 @@
'use strict'; import VtxDeviceStatus, { VtxDeviceTypes } from './VtxDeviceStatus';
class VtxDeviceStatusMsp extends VtxDeviceStatus { class VtxDeviceStatusMsp extends VtxDeviceStatus {
constructor(dataView) constructor(dataView)
@ -17,3 +17,5 @@ class VtxDeviceStatusMsp extends VtxDeviceStatus {
} }
vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusMsp); vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusMsp);
export default VtxDeviceStatusMsp;

View File

@ -80,11 +80,6 @@
<script type="text/javascript" src="./node_modules/inflection/lib/inflection.js"></script> <script type="text/javascript" src="./node_modules/inflection/lib/inflection.js"></script>
<script type="text/javascript" src="./js/libraries/analytics.js"></script> <script type="text/javascript" src="./js/libraries/analytics.js"></script>
<script type="text/javascript" src="./js/utils/window_watchers.js"></script> <script type="text/javascript" src="./js/utils/window_watchers.js"></script>
<script type="text/javascript" src="./js/utils/VtxDeviceStatus/VtxDeviceStatusFactory.js"></script>
<script type="text/javascript" src="./js/utils/VtxDeviceStatus/VtxDeviceStatus.js"></script>
<script type="text/javascript" src="./js/utils/VtxDeviceStatus/TrampDeviceStatus.js"></script>
<script type="text/javascript" src="./js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js"></script>
<script type="text/javascript" src="./js/utils/VtxDeviceStatus/Rtc6705DeviceStatus.js"></script>
<script type="text/javascript" src="./js/data_storage.js"></script> <script type="text/javascript" src="./js/data_storage.js"></script>
<script type="text/javascript" src="./js/port_handler.js"></script> <script type="text/javascript" src="./js/port_handler.js"></script>
<script type="text/javascript" src="./js/port_usage.js"></script> <script type="text/javascript" src="./js/port_usage.js"></script>