libpowermon 1.21
PowerMon Access Library
Loading...
Searching...
No Matches
powermon_config.h
1/* Copyright (C) 2020 - 2024, Thornwave Labs Inc
2 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5 * documentation files (the “Software”), to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user.
11 *
12 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
13 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
14 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16*/
17
18#ifndef _POWERMON_CONFIG_H
19#define _POWERMON_CONFIG_H
20
21
22#include <stdint.h>
23#include <stddef.h>
24
25
30{
31public:
32
33 enum MultiFunctionPinMode: uint32_t
34 {
35 MF_DATA = 0, //data stream
36 MF_TEMP = 1, //DS18B20 temperature sensor
37 MF_BUTTON = 2, //button input
38 MF_COMM = 3 //half duplex communication
39 };
40
41
42 enum FuelgaugeChemistry: uint32_t
43 {
44 FG_CHEM_LEAD_FLOODED = 0,
45 FG_CHEM_LEAD_AGM = 1,
46 FG_CHEM_LIFEPO = 2,
47 FG_CHEM_LIION = 3,
48 FG_CHEM_LIPOLY = 4,
49 };
50
51
52 enum LogMode: uint32_t
53 {
54 LOG_MODE_DISABLED = 0,
55 LOG_MODE_1_SEC = 1,
56 LOG_MODE_2_SEC = 2,
57 LOG_MODE_5_SEC = 3,
58 LOG_MODE_10_SEC = 4,
59 LOG_MODE_20_SEC = 5,
60 LOG_MODE_30_SEC = 6,
61 LOG_MODE_60_SEC = 7,
62 };
63
64
65 enum TimeZone: uint32_t
66 {
67 TZ_AMERICA_ATLANTIC = 0,
68 TZ_AMERICA_EASTERN = 1,
69 TZ_AMERICA_CENTRAL = 2,
70 TZ_AMERICA_MOUNTAIN = 3,
71 TZ_AMERICA_PACIFIC_NO_DST = 4,
72 TZ_AMERICA_PACIFIC = 5,
73 TZ_AMERICA_ALASKA = 6,
74 TZ_AMERICA_HAWAII = 7,
75 TZ_AMERICA_SAMOA = 8,
76 TZ_AMERICA_CHAMORO = 9,
77 TZ_EUROPE_WESTERN = 10,
78 TZ_EUROPE_CENTRAL = 11,
79 TZ_EUROPE_EASTERN = 12,
80 TZ_EUROPE_MOSCOW = 13
81 };
82
86 static const char* timeZones[14];
87
91 static const char* mfModes[4];
92
96 static const char* fgChemistries[8];
97
101 static const char* logModes[8];
102
103 void setMfMode(MultiFunctionPinMode mode);
104 MultiFunctionPinMode getMfMode(void) const;
105
106 void setWiFiKeepAPOn(bool state);
107 bool getWiFiKeepAPOn(void) const;
108
109 void setWiFiDisablePowerSaving(bool state);
110 bool getWiFiDisablePowerSaving(void) const;
111
112 void setWiFiWatchdogEnable(bool state);
113 bool getWiFiWatchdogEnable(void) const;
114
115 void setNoInternetEnable(bool state);
116 bool getNoInternetEnable(void) const;
117
118 void setNtpEnable(bool state);
119 bool getNtpEnable(void) const;
120
121 void setTimeZone(TimeZone tz);
122 TimeZone getTimeZone(void) const;
123
124 void setEthKeepLinkLedOn(bool state);
125 bool getEthKeepLinkLedOn(void) const;
126
127 void setEngineShuntVdropNom(uint8_t mv);
128 uint8_t getEngineShuntVdropNom(void) const;
129
130 void setEngineShuntCurrentNom(uint16_t amperes);
131 uint16_t getEngineShuntCurrentNom(void) const;
132
133 void setEngineShuntCurrentMax(uint16_t amperes);
134 uint16_t getEngineShuntCurrentMax(void) const;
135
136 void setEngineDisableV2(bool state);
137 bool getEngineDisableV2(void) const;
138
139 void setEngineCurrentSignFlip(bool state);
140 bool getEngineCurrentSignFlip(void) const;
141
142 void setEngineMeterVoltageSource(uint8_t source);
143 uint8_t getEngineMeterVoltageSource(void) const;
144
145 void setOcInitialState(bool state);
146 bool getOcInitialState(void) const;
147
148 void setOcInvertOutput(bool state);
149 bool getOcInvertOutput(void) const;
150
151 void setOcLatchRelayOn(bool state);
152 bool getOcLatchRelayOn(void) const;
153
154 void setOcConnectFilter(uint32_t filter_ms);
155 uint32_t getOcConnectFilter(void) const;
156
157 void setOcLvdEnable(bool state);
158 bool getOcLvdEnable(void) const;
159
160 void setOcLvdSource(uint8_t source);
161 uint8_t getOcLvdSource(void) const;
162
163 void setOcLvdDisconnectThreshold(float threshold);
164 float getOcLvdDisconnectThreshold(void) const;
165
166 void setOcLvdConnectThreshold(float threshold);
167 float getOcLvdConnectThreshold(void) const;
168
169 void setOcLvdDisconnectFilter(uint32_t filter_ms);
170 uint32_t getOcLvdDisconnectFilter(void) const;
171
172 void setOcHvdEnable(bool state);
173 bool getOcHvdEnable(void) const;
174
175 void setOcHvdSource(uint8_t source);
176 uint8_t getOcHvdSource(void) const;
177
178 void setOcHvdDisconnectThreshold(float threshold);
179 float getOcHvdDisconnectThreshold(void) const;
180
181 void setOcHvdConnectThreshold(float threshold);
182 float getOcHvdConnectThreshold(void) const;
183
184 void setOcHvdDisconnectFilter(uint32_t filter_ms);
185 uint32_t getOcHvdDisconnectFilter(void) const;
186
187 void setOcOcdEnable(bool state);
188 bool getOcOcdEnable(void) const;
189
190 void setOcOcdSource(uint8_t source);
191 uint8_t getOcOcdSource(void) const;
192
193 void setOcOcdTripThreshold(float threshold);
194 float getOcOcdTripThreshold(void) const;
195
196 void setOcOcdTripFilter(uint32_t filter_ms);
197 uint32_t getOcOcdTripFilter(void) const;
198
199 void setOcLtdEnable(bool state);
200 bool getOcLtdEnable(void) const;
201
202 void setOcLtdDisconnectThreshold(int8_t threshold);
203 int8_t getOcLtdDisconnectThreshold(void) const;
204
205 void setOcLtdConnectThreshold(int8_t threshold);
206 int8_t getOcLtdConnectThreshold(void) const;
207
208 void setOcLtdDisconnectFilter(uint32_t filter_ms);
209 uint32_t getOcLtdDisconnectFilter(void) const;
210
211 void setOcHtdEnable(bool state);
212 bool getOcHtdEnable(void) const;
213
214 void setOcHtdDisconnectThreshold(int8_t threshold);
215 int8_t getOcHtdDisconnectThreshold(void) const;
216
217 void setOcHtdConnectThreshold(int8_t threshold);
218 int8_t getOcHtdConnectThreshold(void) const;
219
220 void setOcHtdDisconnectFilter(uint32_t filter_ms);
221 uint32_t getOcHtdDisconnectFilter(void) const;
222
223 void setOcFgdConnectEnable(bool state);
224 bool getOcFgdConnectEnable(void) const;
225
226 void setOcFgdDisconnectEnable(bool state);
227 bool getOcFgdDisconnectEnable(void) const;
228
229 void setOcFgdConnectThreshold(uint8_t threshold);
230 uint8_t getOcFgdConnectThreshold(void) const;
231
232 void setOcFgdDisconnectThreshold(uint8_t threshold);
233 uint8_t getOcFgdDisconnectThreshold(void) const;
234
235 void setOcAutoOnTimer(uint32_t timer_sec);
236 uint32_t getOcAutoOnTimer(void) const;
237
238 void setOcAutoOffTimer(uint32_t timer_sec);
239 uint32_t getOcAutoOffTimer(void) const;
240
241 void setOcGenControlEnable(bool state);
242 bool getOcGenControlEnable(void) const;
243
244 void setOcGenVonEnable(bool state);
245 bool getOcGenVonEnable(void) const;
246
247 void setOcGenVoffEnable(bool state);
248 bool getOcGenVoffEnable(void) const;
249
250 void setOcGenSoconEnable(bool state);
251 bool getOcGenSoconEnable(void) const;
252
253 void setOcGenSocoffEnable(bool state);
254 bool getOcGenSocoffEnable(void) const;
255
256 void setOcGenVoltageSource(uint8_t source);
257 uint8_t getOcGenVoltageSource(void) const;
258
259 void setOcGenVonThreshold(float threshold);
260 float getOcGenVonThreshold(void) const;
261
262 void setOcGenVoffThreshold(float threshold);
263 float getOcGenVoffThreshold(void) const;
264
265 void setOcGenSoconThreshold(uint8_t threshold);
266 uint8_t getOcGenSoconThreshold(void) const;
267
268 void setOcGenSocoffThreshold(uint8_t threshold);
269 uint8_t getOcGenSocoffThreshold(void) const;
270
271 void setOcGenVonFilter(uint32_t filter_ms);
272 uint32_t getOcGenVonFilter(void) const;
273
274 void setOcGenTurnOffDelay(uint16_t delay_min);
275 uint16_t getOcGenTurnOffDelay(void) const;
276
277 void setOcLiFePOEnable(bool state);
278 bool getOcLiFePOEnable(void) const;
279
280 void setOcLiFePODesignCapacity(float capacity);
281 float getOcLiFePODesignCapacity(void) const;
282
283 void setOcLiFePOCellCount(uint8_t count);
284 uint8_t getOcLiFePOCellCount(void) const;
285
286 void setFgEnable(bool state);
287 bool getFgEnable(void) const;
288
289 void setFgChemistry(FuelgaugeChemistry chemistry);
290 FuelgaugeChemistry getFgChemistry(void) const;
291
292 void setFgCellCount(uint8_t count);
293 uint8_t getFgCellCount(void) const;
294
295 void setFgVoltageSource(uint8_t source);
296 uint8_t getFgVoltageSource(void) const;
297
298 void setFgDesignCapacity(float capacity);
299 float getFgDesignCapacity(void) const;
300
301 void setFgManualChargeDetectionEnable(bool state);
302 bool getFgManualChargeDetectionEnable(void) const;
303
304 void setFgSyncVoltageThreshold(float threshold);
305 float getFgSyncVoltageThreshold(void) const;
306
307 void setFgSyncCurrentThreshold(float threshold);
308 float getFgSyncCurrentThreshold(void) const;
309
310 void setFgSyncFilter(uint32_t filter_ms);
311 uint32_t getFgSyncFilter(void) const;
312
313 void setLogMode(LogMode mode);
314 LogMode getLogMode(void) const;
315
316private:
317 uint8_t mRawConfig[104] alignas(4);
318};
319
320
321#endif
PowermonConfig is a structure containing the PowerMon configuration.
Definition powermon_config.h:30
static const char * fgChemistries[8]
List of all battery chemsitry strings.
Definition powermon_config.h:96
static const char * logModes[8]
List of all log mode strings.
Definition powermon_config.h:101
static const char * mfModes[4]
List of all multi-function mode strings.
Definition powermon_config.h:91
static const char * timeZones[14]
List of all time zones strings.
Definition powermon_config.h:86