Improve debugging of MSP code (#3274)

Disables GA debugging
10.9-maintenance
Mark Haslinghuis 2023-01-25 16:17:11 +01:00 committed by GitHub
parent 7c6f90bea5
commit cc93eb5c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -40,7 +40,7 @@ function setupAnalytics(result) {
os: GUI.operating_system, os: GUI.operating_system,
checkForDebugVersions: checkForDebugVersions, checkForDebugVersions: checkForDebugVersions,
optOut: optOut, optOut: optOut,
debugMode: debugMode, // debugMode: debugMode, // enable when debugging GA
buildType: getBuildType(), buildType: getBuildType(),
}; };
createAnalytics(googleAnalytics, settings); createAnalytics(googleAnalytics, settings);

View File

@ -94,6 +94,9 @@ function MspHelper() {
}; };
} }
function getMSPCodeName(code) {
return Object.keys(MSPCodes).find(key => MSPCodes[key] === code);
}
MspHelper.readPidSliderSettings = function(data) { MspHelper.readPidSliderSettings = function(data) {
FC.TUNING_SLIDERS.slider_pids_mode = data.readU8(); FC.TUNING_SLIDERS.slider_pids_mode = data.readU8();
@ -1581,9 +1584,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
break; break;
default: default:
console.log(`Unknown code detected: ${code}`); console.log(`Unknown code detected: ${code} (${getMSPCodeName(code)})`);
} else { } else {
console.log(`FC reports unsupported message error: ${code}`); console.log(`FC reports unsupported message error: ${code} (${getMSPCodeName(code)})`);
if (code === MSPCodes.MSP_SET_REBOOT) { if (code === MSPCodes.MSP_SET_REBOOT) {
TABS.onboard_logging.mscRebootFailedCallback(); TABS.onboard_logging.mscRebootFailedCallback();
@ -1591,7 +1594,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
} }
} else { } else {
console.warn(`code: ${code} - crc failed`); console.warn(`code: ${code} (${getMSPCodeName(code)}) - crc failed`);
} }
// trigger callbacks, cleanup/remove callback after trigger // trigger callbacks, cleanup/remove callback after trigger
for (let i = dataHandler.callbacks.length - 1; i >= 0; i--) { // iterating in reverse because we use .splice which modifies array length for (let i = dataHandler.callbacks.length - 1; i >= 0; i--) { // iterating in reverse because we use .splice which modifies array length