Skip to content

Commit

Permalink
Show the limit in motors graph
Browse files Browse the repository at this point in the history
  • Loading branch information
McGiverGim committed Sep 23, 2020
1 parent a063ae5 commit 25662fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/flightlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ FlightLog.prototype.rcCommandRawToThrottle = function(value) {

FlightLog.prototype.rcMotorRawToPct = function(value) {
// Motor displayed as percentage
return Math.min(Math.max(((value - this.getSysConfig().motorOutput[0]) / (this.getSysConfig().motorOutput[1] - this.getSysConfig().motorOutput[0])) * 100.0, 0.0),100.0);
return (value / MAX_DSHOT_VALUE) * 100;
};

FlightLog.prototype.getPIDPercentage = function(value) {
Expand Down
4 changes: 4 additions & 0 deletions js/flightlog_fielddefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function makeReadOnly(x) {
return x;
}

// Some constants used at different places
const MAX_DSHOT_VALUE = 2047;

// Fields definitions for lists
var
FlightLogEvent = makeReadOnly({
SYNC_BEEP: 0,
Expand Down
4 changes: 2 additions & 2 deletions js/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ GraphConfig.load = function(config) {
try {
if (fieldName.match(/^motor\[/)) {
return {
offset: -(sysConfig.motorOutput[1] + sysConfig.motorOutput[0]) / 2,
offset: -(MAX_DSHOT_VALUE) / 2,
power: 1.0,
inputRange: (sysConfig.motorOutput[1] - sysConfig.motorOutput[0]) / 2,
inputRange: MAX_DSHOT_VALUE / 2,
outputRange: 1.0
};
} else if (fieldName.match(/^servo\[/)) {
Expand Down

0 comments on commit 25662fd

Please sign in to comment.