Skip to content

Commit 511026e

Browse files
Gary KeebleGary Keeble
authored andcommitted
Additional Value Conversions
Also, re-range PID parameter graph components; these can vary between +-1000 not +-400
1 parent cdc4cbf commit 511026e

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

js/flightlog.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,15 @@ FlightLog.prototype.rcCommandRawToDegreesPerSecond = function(value, axis, curre
946946

947947
FlightLog.prototype.rcCommandRawToThrottle = function(value) {
948948
// Throttle displayed as percentage
949-
return ((value - this.getSysConfig().minthrottle) / (this.getSysConfig().maxthrottle - this.getSysConfig().minthrottle)) * 100.0;
949+
return Math.min(Math.max(((value - this.getSysConfig().minthrottle) / (this.getSysConfig().maxthrottle - this.getSysConfig().minthrottle)) * 100.0, 0.0),100.0);
950950
};
951951

952+
FlightLog.prototype.getPIDPercentage = function(value) {
953+
// PID components and outputs are displayed as percentage (raw value is 0-1000)
954+
return (value / 10.0);
955+
};
956+
957+
952958
FlightLog.prototype.getReferenceVoltageMillivolts = function() {
953959
return this.vbatADCToMillivolts(this.getSysConfig().vbatref);
954960
};

js/flightlog_fields_presenter.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,35 @@ function FlightLogFieldPresenter() {
170170
return Math.round(flightLog.rcCommandRawToDegreesPerSecond(value,2), currentFlightMode) + " deg/s";
171171

172172
case 'rcCommand[3]':
173+
case 'motor[0]':
174+
case 'motor[1]':
175+
case 'motor[2]':
176+
case 'motor[3]':
177+
case 'motor[4]':
178+
case 'motor[5]':
179+
case 'motor[6]':
180+
case 'motor[7]':
173181
return Math.round(flightLog.rcCommandRawToThrottle(value)) + " %";
174182

175183
case 'rcCommands[0]':
176184
case 'rcCommands[1]':
177185
case 'rcCommands[2]':
178186
return value.toFixed(0) + " deg/s";
179-
187+
188+
case 'axisSum[0]':
189+
case 'axisSum[1]':
190+
case 'axisSum[2]':
191+
case 'axisP[0]':
192+
case 'axisP[1]':
193+
case 'axisP[2]':
194+
case 'axisI[0]':
195+
case 'axisI[1]':
196+
case 'axisI[2]':
197+
case 'axisD[0]':
198+
case 'axisD[1]':
199+
case 'axisD[2]':
200+
return flightLog.getPIDPercentage(value).toFixed(1) + "%";
201+
180202
case 'accSmooth[0]':
181203
case 'accSmooth[1]':
182204
case 'accSmooth[2]':

js/graph_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ GraphConfig.load = function(config) {
259259
return {
260260
offset: 0,
261261
power: 0.3,
262-
inputRange: 400,
262+
inputRange: 1000, // Was 400 ?
263263
outputRange: 1.0
264264
};
265265
} else if (fieldName == "rcCommand[3]") { // Throttle

0 commit comments

Comments
 (0)