1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 04:15:28 +03:00

Add support for viewing trace output via MSP from the sensors tab

Use an additional window to show the debug trace, so the configurator
can be used at the same time the user is viewing the output.
This commit is contained in:
Alberto García Hierro 2018-02-12 12:32:52 +00:00
parent 302c79aeb3
commit b98d7a8f3b
6 changed files with 70 additions and 1 deletions

View file

@ -47,6 +47,12 @@ var mspHelper = (function (gui) {
'IRC_TRAMP': 12
};
// Required for MSP_DEBUGMSG because console.log() doesn't allow omitting
// the newline at the end, so we keep the pending message here until we find a
// '\0', then print it. Messages sent by MSP_DEBUGMSG are guaranteed to
// always finish with a '\0'.
var debugMsgBuffer = '';
/**
*
* @param {MSP} dataHandler
@ -440,6 +446,19 @@ var mspHelper = (function (gui) {
console.log('Settings Saved in EEPROM');
break;
case MSPCodes.MSP_DEBUGMSG:
for (var ii = 0; ii < data.byteLength; ii++) {
var c = data.readU8();
if (c == 0) {
// End of message
if (debugMsgBuffer.length > 1) {
console.log('[DEBUG] ' + debugMsgBuffer);
DEBUG_TRACE = (DEBUG_TRACE || '') + debugMsgBuffer;
}
debugMsgBuffer = '';
continue;
}
debugMsgBuffer += String.fromCharCode(c);
}
break;
case MSPCodes.MSP_DEBUG:
for (i = 0; i < 4; i++)