Skip to content

Commit e7540b0

Browse files
committed
Fixed Issue #1 - Moved Storage initialsation to setup()
1 parent 268cba2 commit e7540b0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/LithiumPowered.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@
142142
void setup(double defaultCapacity) {
143143
_wasInitialised = true;
144144

145+
_pStorage->setup();
146+
145147
// Input Pins
146148
pinMode(_pGpio->getPinInterrupt(), INPUT);
147149
pinMode(_pGpio->getPinPolarity(), INPUT);

src/LithiumStorage.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
class LithiumStorageBase {
2626
public:
27+
void setup() {};
28+
2729
inline virtual double getLastBatteryCapacity(double& defaultValue) = 0; // Abstract
2830
inline virtual void setLastBatteryCapacity(double& mAh) = 0; // Abstract
2931

@@ -40,7 +42,9 @@
4042
private:
4143
Preferences _prefs;
4244
public:
43-
LithiumStorageESP32() : _prefs() {
45+
LithiumStorageESP32() : _prefs() {}
46+
47+
void setup() {
4448
_prefs.begin(BATTERY, false);
4549
}
4650

0 commit comments

Comments
 (0)