Skip to content

Commit

Permalink
Change 130K battery shield divider constant to be used with nodemcu a…
Browse files Browse the repository at this point in the history
…nd wroom32 boards too
  • Loading branch information
Eirenliel committed Oct 23, 2021
1 parent f097c90 commit b974ecb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
#define PIN_IMU_INT_2 D6
#define BNO_ADDR_1 0x4A
#define BNO_ADDR_2 0x4B
#define BATTERY_SHIELD_130K true
#elif BOARD == BOARD_CUSTOM
// Define pins by the examples above
#elif BOARD == BOARD_WROOM32
Expand All @@ -104,18 +105,19 @@
#define PIN_BATTERY_LEVEL 36
#define BNO_ADDR_1 0x4A
#define BNO_ADDR_2 0x4B
#define BATTERY_SHIELD_130K true
#elif BOARD == BOARD_WEMOSD1MINI
#define PIN_IMU_SDA D2
#define PIN_IMU_SCL D1
#define PIN_BATTERY_LEVEL A0
#define WEMOS_BATTERY_SHIELD_130K true
#define BATTERY_SHIELD_130K true
#endif

#define LOADING_LED LED_BUILTIN
#define CALIBRATING_LED LED_BUILTIN
#define STATUS_LED LED_BUILTIN

#if BOARD == BOARD_WEMOSD1MINI && WEMOS_BATTERY_SHIELD_130K == true
#if BATTERY_SHIELD_130K == true
// Wemos D1 Mini has an internal Voltage Divider with R1=220K and R2=100K > this means, 3.3V analogRead input voltage results in 1023.0
// Wemos D1 Mini with Wemos BatteryShiled v1.2.0 or higher: BatteryShield with J2 closed, has an addtional 130K resistor. So the resulting Voltage Divider is R1=220K+100K=320K and R2=100K > this means, 4.5V analogRead input voltage results in 1023.0
#define batteryADCMultiplier 1.0 / 1023.0 * 4.5
Expand Down

0 comments on commit b974ecb

Please sign in to comment.