-
-
Notifications
You must be signed in to change notification settings - Fork 858
/
SmartAudioDeviceStatus.js
53 lines (43 loc) · 1.39 KB
/
SmartAudioDeviceStatus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import VtxDeviceStatus, { VtxDeviceTypes } from "./VtxDeviceStatus";
import vtxDeviceStatusFactory from "./VtxDeviceStatusFactory";
import { i18n } from "../../localization";
class VtxDeviceStatusSmartAudio extends VtxDeviceStatus {
constructor(dataView)
{
super(dataView);
dataView.readU8(); // custom device status size
this._version = dataView.readU8();
this._mode = dataView.readU8();
this._orfreq = dataView.readU16();
this._willBootIntoPitMode = Boolean(dataView.readU8());
}
get smartAudioVersion()
{
const sa = this._version * 100 + this._mode;
let result = "";
switch (this._version) {
case 1:
result = "1.0";
break;
case 2:
result = "2.0";
break;
case 3:
result = "2.1";
break;
default:
// unknown SA version
result = i18n.getMessage("vtxType_255");
}
if (16 == this._mode) {
result = i18n.getMessage("vtxSmartAudioUnlocked", {"version": result});
}
return result;
}
static get staticDeviceStatusType()
{
return VtxDeviceTypes.VTXDEV_SMARTAUDIO;
}
}
vtxDeviceStatusFactory.registerVtxDeviceStatusClass(VtxDeviceStatusSmartAudio);
export default VtxDeviceStatusSmartAudio;