Skip to content

Commit 2acb40c

Browse files
committed
files taken from OMOTE.CoretechR
1 parent ad350e1 commit 2acb40c

File tree

76 files changed

+4314
-3295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4314
-3295
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
.vscode/launch.json
66
.vscode/ipch
77
src/secrets_override.h
8-
**/.DS_Store

LICENSE

Lines changed: 0 additions & 674 deletions
This file was deleted.

hardware/ESP32/battery_hal_esp32.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
#include <Arduino.h>
2-
3-
#if (OMOTE_HARDWARE_REV <= 3)
4-
const uint8_t ADC_BAT_GPIO = 36; // Battery voltage sense input (1/2 divider), GPIO36, ADC1_CH0, RTC_GPIO0
5-
// const uint8_t CRG_STAT_GPIO = 21; // battery charger feedback, GPIO21, VSPIHD, EMAC_TX_EN
6-
#elif (OMOTE_HARDWARE_REV == 4)
2+
#if (OMOTE_HARDWARE_REV >= 4)
73
#include <SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.h>
84
// Initialize MAX17048 battery fuel gauge
95
SFE_MAX1704X fuelGauge(MAX1704X_MAX17048);
10-
const uint8_t CRG_STAT_GPIO = 21; // battery charger feedback, GPIO21, VSPIHD, EMAC_TX_EN
11-
#elif (OMOTE_HARDWARE_REV >= 5)
12-
#include <SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.h>
13-
// Initialize MAX17048 battery fuel gauge
14-
SFE_MAX1704X fuelGauge(MAX1704X_MAX17048);
15-
const uint8_t CRG_STAT_GPIO = 1; // battery charger feedback
166
#endif
177

8+
uint8_t CRG_STAT_GPIO = 21; // battery charger feedback, GPIO21, VSPIHD, EMAC_TX_EN
9+
uint8_t ADC_BAT_GPIO = 36; // Battery voltage sense input (1/2 divider), GPIO36, ADC1_CH0, RTC_GPIO0
10+
1811
void init_battery_HAL(void) {
1912
#if (OMOTE_HARDWARE_REV >= 4)
2013
// Initialize battery charger indicator input
@@ -34,9 +27,7 @@ void get_battery_status_HAL(int *battery_voltage, int *battery_percentage, bool
3427
#if (OMOTE_HARDWARE_REV >= 4)
3528
// With hardware rev 4, battery state of charge is monitored by a MAX17048 fuel gauge
3629
*battery_voltage = (int)(fuelGauge.getVoltage()*1000);
37-
float soc = fuelGauge.getSOC();
38-
if (soc > 100.0) soc = 100.0;
39-
*battery_percentage = (int)soc;
30+
*battery_percentage = (int)fuelGauge.getSOC();
4031
*battery_ischarging = !digitalRead(CRG_STAT_GPIO);
4132

4233
//Serial.print(" LiIon Voltage: ");

0 commit comments

Comments
 (0)