summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/system.h b/src/system.h
index 10a2f73..12c5e0c 100644
--- a/src/system.h
+++ b/src/system.h
@@ -14,6 +14,10 @@ class System {
uint8_t blue;
uint8_t mode_changed;
+ // 1 Ah @ 3.7V = 13 kJ
+ int16_t const energy_full = 13000;
+ int16_t energy_j;
+
public:
uint8_t anim_step_fine;
@@ -21,23 +25,25 @@ class System {
void initialize(void);
void loop(void);
-
uint8_t is_charging;
+ uint8_t tick_18s;
+ // Battery: 1000 mAh @ 3.7V -> ~13 kJ / 13000 J
+ // 15 mA * 3.7 V * 18s -> 1 J
enum BCMode : uint8_t {
- OFF = 0,
- WARMWHITE,
- SLOWRGB,
- SUN,
- RED,
- GREEN,
- BLUE,
- YELLOW,
- MAGENTA,
- CYAN,
- FASTRGB,
- SLOWRGB2,
- FASTRGB2,
+ OFF = 0, // 0 mA
+ WARMWHITE, // 32 mA @ 4 V : 2 J per 18 s
+ SLOWRGB, // ~45 mA @ 4 V : 3
+ SUN, // 134 mA @ 4 V : 9
+ RED, // 45 mA @ 4 V : 3
+ GREEN, // 29 mA @ 4 V : 2
+ BLUE, // 30 mA @ 4 V : 2
+ YELLOW, // 74 mA @ 4 V : 5
+ MAGENTA, // 76 mA @ 4 V : 5
+ CYAN, // 59 mA @ 4 V : 4
+ FASTRGB, // ~45 mA @ 4 V : 3
+ SLOWRGB2, // ~17 mA @ 4 V : 1
+ FASTRGB2, // ~17 mA @ 4 V : 1
MODE_ENUM_MAX,
};
@@ -49,7 +55,9 @@ class System {
void debounce_start(void);
- System() { btn_debounce = 0; mode = OFF; is_charging = 0; mode_changed = 0; };
+ inline void setEnergyFull(void) { energy_j = energy_full; }
+
+ System() : btn_debounce(0), mode_changed(0), energy_j(energy_full), is_charging(0), tick_18s(0), mode(OFF) {}
};
extern System blinkencat;