MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4Power.h
Go to the documentation of this file.
1
6#ifndef MINIR4POWER_H
7#define MINIR4POWER_H
8
9#include "MMLower.h"
10
18{
19public:
21
28 bool setBattCell(uint8_t cell)
29 {
30 switch (cell) {
31 case 2: return (mmL.SetPowerParam(8.4, 6.8, 7.4) == MMLower::RESULT::OK); break;
32 case 3: return (mmL.SetPowerParam(12.6, 10.2, 11.1) == MMLower::RESULT::OK); break;
33 case 4: return (mmL.SetPowerParam(16.8, 13.6, 14.8) == MMLower::RESULT::OK); break;
34 case 5: return (mmL.SetPowerParam(21.0, 17.0, 18.5) == MMLower::RESULT::OK); break;
35 case 6: return (mmL.SetPowerParam(25.2, 20.4, 22.2) == MMLower::RESULT::OK); break;
36 default: return false; break;
37 }
38 }
39
45 float getBattVoltage(void)
46 {
47 float voltage = 0, perc = 0;
48 if (mmL.GetPowerInfo(voltage, perc) == MMLower::RESULT::OK)
49 return voltage;
50 else
51 return 0;
52 }
53
60 {
61 float voltage = 0, perc = 0;
62 if (mmL.GetPowerInfo(voltage, perc) == MMLower::RESULT::OK)
63 return perc;
64 else
65 return 0;
66 }
67
68private:
69};
70
71#endif // MINIR4POWER_H
MMLower mmL(8, 9, 57600)
Handling the Lower MCU (STM32) communication.
RESULT GetPowerInfo(float &curVolt, float &curVoltPerc)
Definition MMLower.cpp:883
RESULT SetPowerParam(float fullVolt, float cutOffVolt, float alarmVolt)
Definition MMLower.cpp:294
Class for managing battery power settings and retrieval.
Definition MiniR4Power.h:18
bool setBattCell(uint8_t cell)
Sets the battery parameters based on the number of cells.
Definition MiniR4Power.h:28
float getBattPercentage(void)
Retrieves the current battery percentage.
Definition MiniR4Power.h:59
float getBattVoltage(void)
Retrieves the current battery voltage.
Definition MiniR4Power.h:45