Skip to content

Commit f143fb9

Browse files
committed
Blackbox increase resolution on setpoint, gyro and rounding
1 parent 1836aec commit f143fb9

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

js/flightlog_fielddefs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ var
213213
"SRXL",
214214
"CUSTOM",
215215
"FPORT",
216+
"SRXL2",
217+
"GHST"
216218
]),
217219

218220
ANTI_GRAVITY_MODE = makeReadOnly([

js/flightlog_fields_presenter.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,17 @@ function FlightLogFieldPresenter() {
755755
return "";
756756
}
757757

758+
const highResolutionScale = (flightLog && flightLog.getSysConfig().blackbox_high_resolution > 0) ? 10 : 1;
759+
const highResolutionAddPrecision = (flightLog && flightLog.getSysConfig().blackbox_high_resolution > 0) ? 1 : 0;
760+
758761
switch (fieldName) {
759762
case 'time':
760763
return formatTime(value / 1000, true);
761764

762765
case 'gyroADC[0]':
763766
case 'gyroADC[1]':
764767
case 'gyroADC[2]':
765-
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + " deg/s";
768+
return flightLog.gyroRawToDegreesPerSecond(value / highResolutionScale).toFixed(highResolutionAddPrecision) + " deg/s";
766769

767770
case 'gyroADCs[0]':
768771
case 'gyroADCs[1]':
@@ -772,14 +775,14 @@ function FlightLogFieldPresenter() {
772775
case 'axisError[0]':
773776
case 'axisError[1]':
774777
case 'axisError[2]':
775-
return Math.round(value) + " deg/s";
778+
return (value / highResolutionScale).toFixed(highResolutionAddPrecision) + " deg/s";
776779

777780
case 'rcCommand[0]':
778781
case 'rcCommand[1]':
779782
case 'rcCommand[2]':
780-
return (value + 1500).toFixed(0) + " us";
783+
return (value / highResolutionScale + 1500).toFixed(highResolutionAddPrecision) + " us";
781784
case 'rcCommand[3]':
782-
return value.toFixed(0) + " us";
785+
return (value / highResolutionScale).toFixed(highResolutionAddPrecision) + " us";
783786

784787
case 'motor[0]':
785788
case 'motor[1]':
@@ -804,7 +807,7 @@ function FlightLogFieldPresenter() {
804807
case 'rcCommands[0]':
805808
case 'rcCommands[1]':
806809
case 'rcCommands[2]':
807-
return value.toFixed(0) + " deg/s";
810+
return (value / highResolutionScale).toFixed(highResolutionAddPrecision) + " deg/s";
808811
case 'rcCommands[3]':
809812
return value.toFixed(1) + "%";
810813

@@ -828,7 +831,7 @@ function FlightLogFieldPresenter() {
828831
case 'accSmooth[0]':
829832
case 'accSmooth[1]':
830833
case 'accSmooth[2]':
831-
return flightLog.accRawToGs(value).toFixed(2) + "g";
834+
return flightLog.accRawToGs(value).toFixed(2 + highResolutionAddPrecision) + "g";
832835

833836
case 'vbatLatest':
834837
if(flightLog.getSysConfig().firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver.gte(flightLog.getSysConfig().firmwareVersion, '4.0.0')) {
@@ -905,7 +908,7 @@ function FlightLogFieldPresenter() {
905908
case 'debug[0]':
906909
return value.toFixed(0);
907910
default:
908-
return (value/10).toFixed(1) + "V";
911+
return (value / 10).toFixed(1) + "V";
909912
}
910913
case 'ACCELEROMETER':
911914
return flightLog.accRawToGs(value).toFixed(2) + "g";

js/flightlog_parser.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ var FlightLogParser = function(logData) {
204204
anti_gravity_gain:null, // Anti gravity gain
205205
anti_gravity_mode:null, // Anti gravity mode
206206
anti_gravity_threshold:null, // Anti gravity threshold for step mode
207+
blackbox_high_resolution:null, // Blackbox high resolution mode
207208
thrMid:null, // Throttle Mid Position
208209
thrExpo:null, // Throttle Expo
209210
tpa_breakpoint:null, // TPA Breakpoint
@@ -737,6 +738,8 @@ var FlightLogParser = function(logData) {
737738
case "throttle_boost_cutoff":
738739

739740
case "motor_poles":
741+
742+
case "blackbox_high_resolution":
740743
that.sysConfig[fieldName] = parseInt(fieldValue, 10);
741744
break;
742745
case "rc_expo":

js/graph_config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ GraphConfig.load = function(config) {
257257
}
258258

259259
const gyroScaleMargin = 1.20; // Give a 20% margin for gyro graphs
260+
const highResolutionScale = sysConfig.blackbox_high_resolution > 0 ? 10 : 1;
260261

261262
try {
262263
if (fieldName.match(/^motor\[/)) {
@@ -302,7 +303,7 @@ GraphConfig.load = function(config) {
302303
return {
303304
offset: 0,
304305
power: 0.25, /* Make this 1.0 to scale linearly */
305-
inputRange: maxDegreesSecond(gyroScaleMargin), // Maximum grad/s + 20%
306+
inputRange: maxDegreesSecond(gyroScaleMargin * highResolutionScale), // Maximum grad/s + 20%
306307
outputRange: 1.0
307308
};
308309
} else if (fieldName.match(/^axis.+\[/)) {
@@ -314,16 +315,16 @@ GraphConfig.load = function(config) {
314315
};
315316
} else if (fieldName == "rcCommand[3]") { // Throttle
316317
return {
317-
offset: -1500,
318+
offset: -1500 * highResolutionScale,
318319
power: 1.0,
319-
inputRange: 500,
320+
inputRange: 500 * highResolutionScale,
320321
outputRange: 1.0
321322
};
322323
} else if (fieldName.match(/^rcCommand\[/)) {
323324
return {
324325
offset: 0,
325326
power: 0.25,
326-
inputRange: 500 * gyroScaleMargin, // +20% to let compare in the same scale with the rccommands
327+
inputRange: 500 * highResolutionScale * gyroScaleMargin, // +20% to let compare in the same scale with the rccommands
327328
outputRange: 1.0
328329
};
329330
} else if (fieldName == "heading[2]") {
@@ -771,7 +772,7 @@ GraphConfig.load = function(config) {
771772
EXAMPLE_GRAPHS.push({label: "Gyros",fields: ["gyroADC[all]"]});
772773
}
773774
if (!flightLog.isFieldDisabled().SETPOINT) {
774-
EXAMPLE_GRAPHS.push({label: "RC Rates",fields: ["rcCommands[all]"]});
775+
EXAMPLE_GRAPHS.push({label: "Setpoint",fields: ["rcCommands[all]"]});
775776
}
776777
if (!flightLog.isFieldDisabled().RC_COMMANDS) {
777778
EXAMPLE_GRAPHS.push({label: "RC Command",fields: ["rcCommand[all]"]});

js/sticks.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,14 @@ function FlightLogSticks(flightLog, rcCommandFields, canvas) {
195195
stickIndex,
196196
rcCommand = [], rcCommandLabels = [];
197197

198+
const highResolutionScale = flightLog.getSysConfig().blackbox_high_resolution > 0 ? 10 : 1;
199+
198200
for (stickIndex = 0; stickIndex < 4; stickIndex++) {
199201
//Check that stick data is present to be drawn:
200202
if (rcCommandFields[stickIndex] === undefined)
201203
return;
202204

203-
rcCommand[stickIndex] = frame[rcCommandFields[stickIndex]];
205+
rcCommand[stickIndex] = frame[rcCommandFields[stickIndex]] / highResolutionScale;
204206
if (stickLabel != null) {
205207
rcCommandLabels[stickIndex] = (rcCommand[stickIndex] * ((stickIndex == 2) ? -1 : 1)) + ""; // correct the value for Yaw being inverted
206208
if (userSettings.stickUnits != null) {

0 commit comments

Comments
 (0)