1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-12 19:10:21 +03:00
inav-configurator/js/mwnp.js
2024-04-18 15:39:19 -03:00

36 lines
No EOL
797 B
JavaScript

'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;