forked from iNavFlight/inav-configurator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmwnp.js
36 lines (30 loc) · 797 Bytes
/
mwnp.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
'use strict'
// MultiWii NAV Protocol
const MWNP = {};
MWNP.WPTYPE = {
WAYPOINT: 1,
POSHOLD_UNLIM: 2,
POSHOLD_TIME: 3,
RTH: 4,
SET_POI: 5,
JUMP: 6,
SET_HEAD: 7,
LAND: 8
};
MWNP.P3 = {
ALT_TYPE: 0, // Altitude (alt) : Relative (to home altitude) (0) or Absolute (AMSL) (1).
USER_ACTION_1: 1, // WP Action 1
USER_ACTION_2: 2, // WP Action 2
USER_ACTION_3: 3, // WP Action 3
USER_ACTION_4: 4, // WP Action 4
}
MWNP.WPTYPE.REV = swap(MWNP.WPTYPE);
// Reverse WayPoint type dictionary
function swap(dict) {
let rev_dict = {};
for (let key in dict) {
rev_dict[dict[key]] = key;
}
return rev_dict;
}
module.exports = MWNP;