diff --git a/src/js/fc.js b/src/js/fc.js index 28e05bb61c..2dcc0f2cb3 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -280,7 +280,7 @@ const FC = { altitude: 0, sonar: 0, kinematics: [0.0, 0.0, 0.0], - debug: [0, 0, 0, 0], + debug: [0, 0, 0, 0, 0, 0, 0, 0], }; this.MOTOR_DATA = Array.from({length: 8}); diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index 80286a229d..9e369c3dd6 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -668,7 +668,7 @@ MspHelper.prototype.process_data = function(dataHandler) { console.log('Voltage config saved'); break; case MSPCodes.MSP_DEBUG: - for (let i = 0; i < 4; i++) { + for (let i = 0; i < 8; i++) { FC.SENSOR_DATA.debug[i] = data.read16(); } break; diff --git a/src/js/tabs/onboard_logging.js b/src/js/tabs/onboard_logging.js index 606266416f..0d80a03b00 100644 --- a/src/js/tabs/onboard_logging.js +++ b/src/js/tabs/onboard_logging.js @@ -320,6 +320,7 @@ onboard_logging.initialize = function (callback) { {text: "GPS_RESCUE_VELOCITY"}, {text: "GPS_RESCUE_HEADING"}, {text: "GPS_RESCUE_TRACKING"}, + {text: "GPS_UNIT_CONNECTION"}, {text: "ATTITUDE"}, {text: "VTX_MSP"}, {text: "GPS_DOP"}, @@ -329,6 +330,7 @@ onboard_logging.initialize = function (callback) { {text: "ANGLE_TARGET"}, {text: "CURRENT_ANGLE"}, {text: "DSHOT_TELEMETRY_COUNTS"}, + {text: "RPM_LIMIT"}, ]; for (let i = 0; i < FC.PID_ADVANCED_CONFIG.debugModeCount; i++) { diff --git a/src/js/tabs/sensors.js b/src/js/tabs/sensors.js index ae5c73f596..96652c7fdc 100644 --- a/src/js/tabs/sensors.js +++ b/src/js/tabs/sensors.js @@ -7,6 +7,8 @@ import MSP from "../msp"; import MSPCodes from "../msp/MSPCodes"; import serial from "../serial"; import * as d3 from 'd3'; +import semver from 'semver'; +import { API_VERSION_1_46 } from "../data_storage"; const sensors = {}; sensors.initialize = function (callback) { @@ -15,6 +17,8 @@ sensors.initialize = function (callback) { GUI.active_tab = 'sensors'; } + sensors.debugColumns = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46) ? 8 : 4; + function initSensorData(){ for (let i = 0; i < 3; i++) { FC.SENSOR_DATA.accelerometer[i] = 0; @@ -22,6 +26,9 @@ sensors.initialize = function (callback) { FC.SENSOR_DATA.magnetometer[i] = 0; FC.SENSOR_DATA.sonar = 0; FC.SENSOR_DATA.altitude = 0; + } + + for (let i = 0; i < sensors.debugColumns; i++) { FC.SENSOR_DATA.debug[i] = 0; } } @@ -178,6 +185,10 @@ sensors.initialize = function (callback) { function plot_debug(enable) { if (enable) { $('.wrapper.debug').show(); + for (let i = 0; i < 8; i++) { + $(`svg#debug${i}`).hide(); + $(`div.plot_control.debug${i}`).hide(); + } } else { $('.wrapper.debug').hide(); } @@ -261,24 +272,22 @@ sensors.initialize = function (callback) { mag_data = initDataArray(3), altitude_data = initDataArray(1), sonar_data = initDataArray(1), - debug_data = [ - initDataArray(1), - initDataArray(1), - initDataArray(1), - initDataArray(1), - ]; + debug_data = []; + + for (let i = 0; i < sensors.debugColumns; i++) { + debug_data.push(initDataArray(1)); + } let gyroHelpers = initGraphHelpers('#gyro', samples_gyro_i, [-2000, 2000]); let accelHelpers = initGraphHelpers('#accel', samples_accel_i, [-2, 2]); let magHelpers = initGraphHelpers('#mag', samples_mag_i, [-1, 1]); const altitudeHelpers = initGraphHelpers('#altitude', samples_altitude_i); const sonarHelpers = initGraphHelpers('#sonar', samples_sonar_i); - const debugHelpers = [ - initGraphHelpers('#debug1', samples_debug_i), - initGraphHelpers('#debug2', samples_debug_i), - initGraphHelpers('#debug3', samples_debug_i), - initGraphHelpers('#debug4', samples_debug_i), - ]; + const debugHelpers = []; + + for (let i = 0; i < sensors.debugColumns; i++) { + debugHelpers.push(initGraphHelpers(`#debug${i}`, samples_debug_i)); + } const raw_data_text_ements = { x: [], @@ -417,9 +426,15 @@ sensors.initialize = function (callback) { } function update_debug_graphs() { - for (let i = 0; i < 4; i++) { + for (let i = 0; i < sensors.debugColumns; i++) { updateGraphHelperSize(debugHelpers[i]); + // enable/disable graphs based on debug values + if (FC.SENSOR_DATA.debug[i]) { + $(`svg#debug${i}`).show(); + $(`div.plot_control.debug${i}`).show(); + } + addSampleToData(debug_data[i], samples_debug_i, [FC.SENSOR_DATA.debug[i]]); drawGraph(debugHelpers[i], debug_data[i], samples_debug_i); raw_data_text_ements.x[5 + i].text(FC.SENSOR_DATA.debug[i]); diff --git a/src/tabs/sensors.html b/src/tabs/sensors.html index 0efab46c40..0900564544 100644 --- a/src/tabs/sensors.html +++ b/src/tabs/sensors.html @@ -66,12 +66,12 @@ - - - - - - + + + + + +
@@ -111,12 +111,12 @@ - - - - - - + + + + + +
@@ -156,12 +156,12 @@ - - - - - - + + + + + +
@@ -193,12 +193,12 @@ - - - - - - + + + + + +
@@ -226,18 +226,19 @@ - - - - - - + + + + + +
+
-
+
0
@@ -258,58 +259,118 @@
0
- - - - - - - + + + + + + +
-
+
1
X:
blue
- - - - - - - + + + + + + +
-
+
2
X:
0
- - - - - - - + + + + + + +
-
+
3
X:
0
+ + + + + + + +
+
+
4
+
+
X:
+
0
+
+
- - - - - - + + + + + + +
+
+
5
+
+
X:
+
0
+
+
+ + + + + + + +
+
+
6
+
+
X:
+
0
+
+
+ + + + + + + +
+
+
7
+
+
X:
+
0
+
+
+ + + + + + +