1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

add support for MSP_PIDNAMES

This commit is contained in:
cTn 2014-05-03 22:42:11 +02:00
parent 63aa7c8092
commit 7e82e96114
3 changed files with 20 additions and 4 deletions

View file

@ -315,7 +315,7 @@ MSP.process_data = function(code, message_buffer, message_length) {
case MSP_codes.MSP_BOXNAMES:
AUX_CONFIG = []; // empty the array as new data is coming in
var buff = new Array();
var buff = [];
for (var i = 0; i < data.byteLength; i++) {
if (data.getUint8(i) == 0x3B) { // ; (delimeter char)
AUX_CONFIG.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings
@ -325,11 +325,22 @@ MSP.process_data = function(code, message_buffer, message_length) {
} else {
buff.push(data.getUint8(i));
}
}
break;
case MSP_codes.MSP_PIDNAMES:
console.log(data);
PID_names = []; // empty the array as new data is coming in
var buff = [];
for (var i = 0; i < data.byteLength; i++) {
if (data.getUint8(i) == 0x3B) { // ; (delimeter char)
PID_names.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings
// empty buffer
buff = [];
} else {
buff.push(data.getUint8(i));
}
}
break;
case MSP_codes.MSP_WP:
console.log(data);