File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ <h2> 2.5.8 - DShot Logging and Minor Bug Fixes</h2>
5757 < li > Add OSD and ESC features options to header dialog.</ li >
5858 < li > Add new BF3.1.0 parameters to header dialog.</ li >
5959 < li > Add user setting to show raw values on legend.</ li >
60+ < li > Correct VBAT scaling for BF3.1.0.</ li >
6061 </ ul >
6162
6263 < h2 > 2.5.7 - Minor Bug Fixes and Feature Improvements</ h2 >
Original file line number Diff line number Diff line change @@ -252,9 +252,15 @@ function FlightLog(logData) {
252252 i ,
253253 fieldNames = that . getMainFieldNames ( ) ,
254254 sysConfig = that . getSysConfig ( ) ,
255- refVoltage = that . vbatADCToMillivolts ( sysConfig . vbatref ) / 100 ,
256255 found = false ;
257256
257+ var refVoltage ;
258+ if ( sysConfig . firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver . gte ( sysConfig . firmwareVersion , '3.1.0' ) ) {
259+ refVoltage = sysConfig . vbatref ;
260+ } else {
261+ refVoltage = that . vbatADCToMillivolts ( sysConfig . vbatref ) / 100 ;
262+ }
263+
258264 //Are we even logging VBAT?
259265 if ( ! fieldNameToIndex . vbatLatest ) {
260266 numCells = false ;
@@ -1092,7 +1098,12 @@ FlightLog.prototype.getPIDPercentage = function(value) {
10921098
10931099
10941100FlightLog . prototype . getReferenceVoltageMillivolts = function ( ) {
1095- return this . vbatADCToMillivolts ( this . getSysConfig ( ) . vbatref ) ;
1101+ if ( this . getSysConfig ( ) . firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver . gte ( this . getSysConfig ( ) . firmwareVersion , '3.1.0' ) ) {
1102+ return this . getSysConfig ( ) . vbatref * 100 ;
1103+ } else {
1104+ return this . vbatADCToMillivolts ( this . getSysConfig ( ) . vbatref ) ;
1105+ }
1106+
10961107} ;
10971108
10981109FlightLog . prototype . vbatADCToMillivolts = function ( vbatADC ) {
Original file line number Diff line number Diff line change @@ -314,11 +314,19 @@ function FlightLogFieldPresenter() {
314314 return flightLog . accRawToGs ( value ) . toFixed ( 2 ) + "g" ;
315315
316316 case 'vbatLatest' :
317- return ( flightLog . vbatADCToMillivolts ( value ) / 1000 ) . toFixed ( 2 ) + "V" + ", " + ( flightLog . vbatADCToMillivolts ( value ) / 1000 / flightLog . getNumCellsEstimate ( ) ) . toFixed ( 2 ) + "V/cell" ;
318-
317+ if ( flightLog . getSysConfig ( ) . firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver . gte ( flightLog . getSysConfig ( ) . firmwareVersion , '3.1.0' ) ) {
318+ return ( value / 10 ) . toFixed ( 2 ) + "V" + ", " + ( value / 10 / flightLog . getNumCellsEstimate ( ) ) . toFixed ( 2 ) + "V/cell" ;
319+ } else {
320+ return ( flightLog . vbatADCToMillivolts ( value ) / 1000 ) . toFixed ( 2 ) + "V" + ", " + ( flightLog . vbatADCToMillivolts ( value ) / 1000 / flightLog . getNumCellsEstimate ( ) ) . toFixed ( 2 ) + "V/cell" ;
321+ }
322+
319323 case 'amperageLatest' :
320- return ( flightLog . amperageADCToMillivolts ( value ) / 1000 ) . toFixed ( 2 ) + "A" + ", " + ( flightLog . amperageADCToMillivolts ( value ) / 1000 / flightLog . getNumMotors ( ) ) . toFixed ( 2 ) + "A/motor" ;
321-
324+ if ( flightLog . getSysConfig ( ) . firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver . gte ( flightLog . getSysConfig ( ) . firmwareVersion , '3.1.0' ) ) {
325+ return ( value / 10 ) . toFixed ( 2 ) + "A" + ", " + ( value / 10 / flightLog . getNumMotors ( ) ) . toFixed ( 2 ) + "A/motor" ;
326+ } else {
327+ return ( flightLog . amperageADCToMillivolts ( value ) / 1000 ) . toFixed ( 2 ) + "A" + ", " + ( flightLog . amperageADCToMillivolts ( value ) / 1000 / flightLog . getNumMotors ( ) ) . toFixed ( 2 ) + "A/motor" ;
328+ }
329+
322330 case 'heading[0]' :
323331 case 'heading[1]' :
324332 case 'heading[2]' :
You can’t perform that action at this time.
0 commit comments