Skip to content

Commit d67ea88

Browse files
committed
Build with COMPILE_MP2762A_CHARGER commented out
1 parent b9892b9 commit d67ea88

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,24 +1481,8 @@ void beginCharger()
14811481
{
14821482
// Set pre-charge defaults for the MP2762A
14831483
// See issue: https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/issues/240
1484-
if (mp2762Begin(i2c_0) == true)
1485-
{
1486-
// Resetting registers to defaults
1487-
mp2762registerReset();
1488-
1489-
// Setting FastCharge to 6.6V
1490-
mp2762setFastChargeVoltageMv(6600);
1491-
1492-
// Setting precharge current to 880mA
1493-
mp2762setPrechargeCurrentMa(880);
1494-
1495-
systemPrintln("Charger configuration complete");
1496-
online.batteryCharger_mp2762a = true;
1497-
}
1498-
else
1499-
{
1484+
if (mp2762Begin(i2c_0, 6600, 880) == false)
15001485
systemPrintln("MP2762A charger failed to initialize");
1501-
}
15021486
}
15031487
}
15041488

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,17 @@ void tiltRequestStop() {}
248248

249249
#endif // COMPILE_IM19_IMU
250250

251+
//----------------------------------------
252+
// MP2762A Charger
253+
//----------------------------------------
254+
255+
#ifndef COMPILE_MP2762A_CHARGER
256+
bool mp2762Begin(TwoWire *i2cBus, uint16_t volts, uint16_t milliamps) {return false;}
257+
uint16_t mp2762getBatteryVoltageMv() {return 0;}
258+
uint8_t mp2762getChargeStatus() {return 0;}
259+
void mp2762resetSafetyTimer() {}
260+
#endif // COMPILE_MP2762A_CHARGER
261+
251262
//----------------------------------------
252263
// UM980
253264
//----------------------------------------

Firmware/RTK_Everywhere/MP2762A_Charger.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Helper functions for the MP2762A Charger controller
33
*/
44

5+
#ifdef COMPILE_MP2762A_CHARGER
6+
57
const uint8_t mp2762deviceAddress = 0x5C;
68

79
#define MP2762A_PRECHARGE_CURRENT 0x03
@@ -19,11 +21,23 @@ const uint8_t mp2762deviceAddress = 0x5C;
1921
TwoWire *mp2762I2c = nullptr;
2022

2123
// Returns true if device acknowledges its address
22-
bool mp2762Begin(TwoWire *i2cBus)
24+
bool mp2762Begin(TwoWire *i2cBus, uint16_t volts, uint16_t milliamps)
2325
{
2426
if (i2cIsDevicePresent(i2cBus, mp2762deviceAddress) == false)
2527
return (false);
2628
mp2762I2c = i2cBus;
29+
30+
// Resetting registers to defaults
31+
mp2762registerReset();
32+
33+
// Setting FastCharge voltage
34+
mp2762setFastChargeVoltageMv(volts);
35+
36+
// Setting precharge current
37+
mp2762setPrechargeCurrentMa(milliamps);
38+
39+
systemPrintln("Charger configuration complete");
40+
online.batteryCharger_mp2762a = true;
2741
return (true);
2842
}
2943

@@ -225,3 +239,5 @@ bool mp2762writeRegister(uint8_t address, uint8_t value)
225239
}
226240
return (true);
227241
}
242+
243+
#endif // COMPILE_MP2762A_CHARGER

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
#define COMPILE_IM19_IMU // Comment out to remove IM19_IMU functionality
111111
#define COMPILE_POINTPERFECT_LIBRARY // Comment out to remove PPL support
112112
#define COMPILE_BQ40Z50 // Comment out to remove BQ40Z50 functionality
113+
#define COMPILE_MP2762A_CHARGER // Comment out to remove MP2762A charger functionality
113114

114115
#if defined(COMPILE_WIFI) || defined(COMPILE_ETHERNET) || defined(COMPILE_CELLULAR)
115116
#define COMPILE_NETWORK

Firmware/RTK_Everywhere/check.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ sed -i 's|#define COMPILE_IM19_IMU|//#define COMPILE_IM19_IMU|' RTK_Everywhere.i
9595
make
9696
git reset --hard --quiet HEAD
9797

98+
# MP2762A Charger
99+
sed -i 's|#define COMPILE_MP2762A_CHARGER|//#define COMPILE_MP2762A_CHARGER|' RTK_Everywhere.ino
100+
make
101+
git reset --hard --quiet HEAD
102+
98103
# PointPerfect Library
99104
sed -i 's|#define COMPILE_POINTPERFECT_LIBRARY|//#define COMPILE_POINTPERFECT_LIBRARY|' RTK_Everywhere.ino
100105
make

0 commit comments

Comments
 (0)