mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Retrieve and display MSP API Version from new MSP_API_VERSION command.
Requires latest firmware.
This commit is contained in:
parent
f64b558d5c
commit
2733f4832e
4 changed files with 33 additions and 14 deletions
10
js/msp.js
10
js/msp.js
|
@ -2,6 +2,7 @@
|
|||
|
||||
// MSP_codes needs to be re-integrated inside MSP object
|
||||
var MSP_codes = {
|
||||
MSP_API_VERSION: 1,
|
||||
|
||||
// MSP commands for Cleanflight original features
|
||||
MSP_CHANNEL_FORWARDING: 32,
|
||||
|
@ -169,6 +170,15 @@ MSP.process_data = function(code, message_buffer, message_length) {
|
|||
var data = new DataView(message_buffer, 0); // DataView (allowing us to view arrayBuffer as struct/union)
|
||||
|
||||
switch (code) {
|
||||
case MSP_codes.MSP_API_VERSION:
|
||||
CONFIG.apiVersion = data.getUint8(1) + '.' + data.getUint8(2);
|
||||
var identifier = '';
|
||||
for (i = 0; i < 4; i++) {
|
||||
identifier += String.fromCharCode(data.getUint8(3 + i));
|
||||
}
|
||||
CONFIG.flightControllerIdentifier = identifier;
|
||||
CONFIG.flightControllerVersion = data.getUint8(7) + '.' + data.getUint8(8) + '.' + data.getUint8(9);
|
||||
break;
|
||||
case MSP_codes.MSP_IDENT:
|
||||
CONFIG.version = parseFloat((data.getUint8(0) / 100).toFixed(2));
|
||||
CONFIG.multiType = data.getUint8(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue