Skip to content

Commit

Permalink
Simplify MSP current acquisition code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Nov 5, 2015
1 parent 1126dfc commit e7865a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
30 changes: 17 additions & 13 deletions MW_OSD/Def.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,41 @@
#define BOXNAMES // required to support legacy protocol
#endif

#if defined (BASEFLIGHT20150327)
#define AMPERAGE_10ma
// The unit of current varies across implementations. There are effectively three set:
// * 100mA, for which case the value is usable as it comes aross the wire.
// * 10mA, which sends a value 10x higher than we work wth
// * 1ma, which sends a value 100x higher than normal
#define AMPERAGE_DIV 100

#if defined (BASEFLIGHT20150327)
#define AMPERAGE_DIV 10
#endif

#if defined (BASEFLIGHT20150627)
#define AMPERAGE_10ma
#define AMPERAGE_DIV 10
#define SETCONFIG 25 //for BASEFLIGHT20150627 to use MSP_SET_CONFIG
#endif

#if defined (CLEANFLIGHT190)
#define AMPERAGE_10ma
#if defined (CLEANFLIGHT190)
#define AMPERAGE_DIV 10
#endif

#if defined (CLEANFLIGHT180)
#define AMPERAGE_10ma
#define AMPERAGE_DIV 10
#endif

#if defined (CLEANFLIGHT172)
#define AMPERAGE_10ma
#define AMPERAGE_DIV 10
#endif

#if defined (MULTIWII_V24)
#define AMPERAGE_100ma
#if defined (MULTIWII_V24)
#define AMPERAGE_DIV 1
#endif

#if defined (MULTIWII_V23)
#define AMPERAGE_1ma
#if defined (MULTIWII_V23)
#endif

#if defined (MULTIWII_V21)
#define AMPERAGE_1ma
#if defined (MULTIWII_V21)
#define BOXNAMES // required to support legacy protocol
#endif

Expand Down
11 changes: 1 addition & 10 deletions MW_OSD/MW_OSD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -933,16 +933,7 @@ void ProcessSensors(void) {
}
}
else{
#if defined AMPERAGE_100ma
amperage = MWAmperage ;
#elif defined AMPERAGE_10ma
amperage = MWAmperage / 10;
#elif defined AMPERAGE_1ma
amperage = MWAmperage / 100;
#else
amperage = MWAmperage / 100;
#endif

amperage = MWAmperage / AMPERAGE_DIV;
}

//-------------- RSSI
Expand Down

0 comments on commit e7865a3

Please sign in to comment.