libpowermon 1.11
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
83 static const char* timeZones[14];
84
85 void setMfMode(MultiFunctionPinMode mode);
86 MultiFunctionPinMode getMfMode(void) const;
87
88 void setWiFiKeepAPOn(bool state);
89 bool getWiFiKeepAPOn(void) const;
90
91 void setWiFiDisablePowerSaving(bool state);
92 bool getWiFiDisablePowerSaving(void) const;
93
94 void setWiFiWatchdogEnable(bool state);
95 bool getWiFiWatchdogEnable(void) const;
96
97 void setNoInternetEnable(bool state);
98 bool getNoInternetEnable(void) const;
99
100 void setNtpEnable(bool state);
101 bool getNtpEnable(void) const;
102
103 void setTimeZone(TimeZone tz);
104 TimeZone getTimeZone(void) const;
105
106 void setEthKeepLinkLedOn(bool state);
107 bool getEthKeepLinkLedOn(void) const;
108
109 void setEngineShuntVdropNom(uint8_t mv);
110 uint8_t getEngineShuntVdropNom(void) const;
111
112 void setEngineShuntCurrentNom(uint16_t amperes);
113 uint16_t getEngineShuntCurrentNom(void) const;
114
115 void setEngineShuntCurrentMax(uint16_t amperes);
116 uint16_t getEngineShuntCurrentMax(void) const;
117
118 void setEngineDisableV2(bool state);
119 bool getEngineDisableV2(void) const;
120
121 void setEngineCurrentSignFlip(bool state);
122 bool getEngineCurrentSignFlip(void) const;
123
124 void setEngineMeterVoltageSource(uint8_t source);
125 uint8_t getEngineMeterVoltageSource(void) const;
126
127 void setOcInitialState(bool state);
128 bool getOcInitialState(void) const;
129
130 void setOcInvertOutput(bool state);
131 bool getOcInvertOutput(void) const;
132
133 void setOcLatchRelayOn(bool state);
134 bool getOcLatchRelayOn(void) const;
135
136 void setOcConnectFilter(uint32_t filter_ms);
137 uint32_t getOcConnectFilter(void) const;
138
139 void setOcLvdEnable(bool state);
140 bool getOcLvdEnable(void) const;
141
142 void setOcLvdSource(uint8_t source);
143 uint8_t getOcLvdSource(void) const;
144
145 void setOcLvdDisconnectThreshold(float threshold);
146 float getOcLvdDisconnectThreshold(void) const;
147
148 void setOcLvdConnectThreshold(float threshold);
149 float getOcLvdConnectThreshold(void) const;
150
151 void setOcLvdDisconnectFilter(uint32_t filter_ms);
152 uint32_t getOcLvdDisconnectFilter(void) const;
153
154 void setOcHvdEnable(bool state);
155 bool getOcHvdEnable(void) const;
156
157 void setOcHvdSource(uint8_t source);
158 uint8_t getOcHvdSource(void) const;
159
160 void setOcHvdDisconnectThreshold(float threshold);
161 float getOcHvdDisconnectThreshold(void) const;
162
163 void setOcHvdConnectThreshold(float threshold);
164 float getOcHvdConnectThreshold(void) const;
165
166 void setOcHvdDisconnectFilter(uint32_t filter_ms);
167 uint32_t getOcHvdDisconnectFilter(void) const;
168
169 void setOcOcdEnable(bool state);
170 bool getOcOcdEnable(void) const;
171
172 void setOcOcdSource(uint8_t source);
173 uint8_t getOcOcdSource(void) const;
174
175 void setOcOcdTripThreshold(float threshold);
176 float getOcOcdTripThreshold(void) const;
177
178 void setOcOcdTripFilter(uint32_t filter_ms);
179 uint32_t getOcOcdTripFilter(void) const;
180
181 void setOcLtdEnable(bool state);
182 bool getOcLtdEnable(void) const;
183
184 void setOcLtdDisconnectThreshold(int8_t threshold);
185 int8_t getOcLtdDisconnectThreshold(void) const;
186
187 void setOcLtdConnectThreshold(int8_t threshold);
188 int8_t getOcLtdConnectThreshold(void) const;
189
190 void setOcLtdDisconnectFilter(uint32_t filter_ms);
191 uint32_t getOcLtdDisconnectFilter(void) const;
192
193 void setOcHtdEnable(bool state);
194 bool getOcHtdEnable(void) const;
195
196 void setOcHtdDisconnectThreshold(int8_t threshold);
197 int8_t getOcHtdDisconnectThreshold(void) const;
198
199 void setOcHtdConnectThreshold(int8_t threshold);
200 int8_t getOcHtdConnectThreshold(void) const;
201
202 void setOcHtdDisconnectFilter(uint32_t filter_ms);
203 uint32_t getOcHtdDisconnectFilter(void) const;
204
205 void setOcFgdConnectEnable(bool state);
206 bool getOcFgdConnectEnable(void) const;
207
208 void setOcFgdDisconnectEnable(bool state);
209 bool getOcFgdDisconnectEnable(void) const;
210
211 void setOcFgdConnectThreshold(uint8_t threshold);
212 uint8_t getOcFgdConnectThreshold(void) const;
213
214 void setOcFgdDisconnectThreshold(uint8_t threshold);
215 uint8_t getOcFgdDisconnectThreshold(void) const;
216
217 void setOcAutoOnTimer(uint32_t timer_sec);
218 uint32_t getOcAutoOnTimer(void) const;
219
220 void setOcAutoOffTimer(uint32_t timer_sec);
221 uint32_t getOcAutoOffTimer(void) const;
222
223 void setOcGenControlEnable(bool state);
224 bool getOcGenControlEnable(void) const;
225
226 void setOcGenVonEnable(bool state);
227 bool getOcGenVonEnable(void) const;
228
229 void setOcGenVoffEnable(bool state);
230 bool getOcGenVoffEnable(void) const;
231
232 void setOcGenSoconEnable(bool state);
233 bool getOcGenSoconEnable(void) const;
234
235 void setOcGenSocoffEnable(bool state);
236 bool getOcGenSocoffEnable(void) const;
237
238 void setOcGenVoltageSource(uint8_t source);
239 uint8_t getOcGenVoltageSource(void) const;
240
241 void setOcGenVonThreshold(float threshold);
242 float getOcGenVonThreshold(void) const;
243
244 void setOcGenVoffThreshold(float threshold);
245 float getOcGenVoffThreshold(void) const;
246
247 void setOcGenSoconThreshold(uint8_t threshold);
248 uint8_t getOcGenSoconThreshold(void) const;
249
250 void setOcGenSocoffThreshold(uint8_t threshold);
251 uint8_t getOcGenSocoffThreshold(void) const;
252
253 void setOcGenVonFilter(uint32_t filter_ms);
254 uint32_t getOcGenVonFilter(void) const;
255
256 void setOcGenTurnOffDelay(uint16_t delay_min);
257 uint16_t getOcGenTurnOffDelay(void) const;
258
259 void setOcLiFePOEnable(bool state);
260 bool getOcLiFePOEnable(void) const;
261
262 void setOcLiFePODesignCapacity(float capacity);
263 float getOcLiFePODesignCapacity(void) const;
264
265 void setOcLiFePOCellCount(uint8_t count);
266 uint8_t getOcLiFePOCellCount(void) const;
267
268 void setFgEnable(bool state);
269 bool getFgEnable(void) const;
270
271 void setFgChemistry(FuelgaugeChemistry chemistry);
272 FuelgaugeChemistry getFgChemistry(void) const;
273
274 void setFgCellCount(uint8_t count);
275 uint8_t getFgCellCount(void) const;
276
277 void setFgVoltageSource(uint8_t source);
278 uint8_t getFgVoltageSource(void) const;
279
280 void setFgDesignCapacity(float capacity);
281 float getFgDesignCapacity(void) const;
282
283 void setFgManualChargeDetectionEnable(bool state);
284 bool getFgManualChargeDetectionEnable(void) const;
285
286 void setFgSyncVoltageThreshold(float threshold);
287 float getFgSyncVoltageThreshold(void) const;
288
289 void setFgSyncCurrentThreshold(float threshold);
290 float getFgSyncCurrentThreshold(void) const;
291
292 void setFgSyncFilter(uint32_t filter_ms);
293 uint32_t getFgSyncFilter(void) const;
294
295 void setLogMode(LogMode mode);
296 LogMode getLogMode(void) const;
297
298private:
299 uint8_t mRawConfig[104] alignas(4);
300};
301
302
303#endif
PowermonConfig is a structure containing the PowerMon configuration.
Definition powermon_config.h:30