OpenDTU-old/include
Bernhard Kirchen d23b991f5c
VE.Direct: Fix design issues and prepare support for multiple instances (#505)
* introduce VictronMpptClass

this solves a design issue where the loop() method of a static instance
of VeDirectMpptController, which is part of library code, is called as
part of the main loop() implementation. that is a problem because the
call to this loop() must be handled differently from all other calls:
the lib does not know whether or not the feature is enabled at all.
also, the instance would not be initialized when enabling the feature
during normal operation. that would even lead to a nullptr exception
since the pointer to the serial implementation is still uninitialized.

this new intermediate class is implemented with the support for multiple
Victron charge controllers in mind. adding support for more charge
controllers should be more viable than ever.

fixes #481.

related to #397 #129.

* VE.Direct: move get.*AsString methods to respective structs

those structs, which hold the data to be translated into strings, know
best how to translate them. this change also simplifies access to those
translation, as no parameter must be handed to the respective methods:
they now act upon the data of the instance they are called for. adds
constness to those methods.

* VE.Direct: simplify and clean up get.*AsString methods

use a map, which is much easier to maintain and which reads much easier.
move the strings to flash memory to save RAM.

* DPL: use VictronMpptClass::getPowerOutputWatts method

remove redundant calculation of output power from DPL. consider
separation of concern: VictronMpptClass will provide the total solar
output power. the DPL shall not concern itself about how that value is
calculated and it certainly should be unaware about how many MPPT charge
controllers there actually are.

* VE.Direct: avoid shadowing struct member "P"

P was part of the base struct for both MPPT and SmartShunt controller.
however, P was also part of the SmartShunt controller data struct,
shadowing the member in the base struct.

since P has slightly different meaning in MPPT versus SmartShunt, and
since P is calculated for MPPT controllers but read from SmartShunts, P
now lives in both derived structs, but not in the base struct.

* VE.Direct: isDataValid(): avoid copying data structs

pass a const reference to the base class implementation of isDataValid()
rather than a copy of the whole struct.

* VE.Direct: unify logging of text events

* VE.Direct: stop processing text event if handled by base

in case the base class processed a text event, do not try to match it
against values that are only valid in the derived class -- none will
match.

* VE.Direct MPPT: manage data in a shared_ptr

instead of handing out a reference to a struct which is part of a class
instance that may disappear, e.g., on a config change, we now manage the
lifetime of said data structure using a shared_ptr and hand out copies
of that shared_ptr. this makes sure that users have a valid copy of the
data as long as they hold the shared_ptr.

* VE.Direct MPPT: implement getDataAgeMillis()

this works even if millis() wraps around.

* VE.Direct: process frame end event only for valid frames

save a parameters, save a level of indention, save a function call for
invalid frames.
2023-10-19 16:15:29 +02:00
..
Battery.h Support for Jikong JK BMS using serial connection (#319) 2023-08-31 16:21:32 +02:00
BatteryStats.h Integration of Victron SmartShunt via VE.Direct (#452) 2023-09-22 17:24:57 +02:00
Configuration.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
Datastore.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
defaults.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
Display_Graphic.h Feature: Turn off Display before reboot 2023-08-25 16:57:24 +02:00
helper.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
HttpPowerMeter.h fix: #438 2023-09-18 17:56:22 +02:00
Huawei_can.h Move Huawei CAN bus communication to separate thread (#454) 2023-10-02 11:22:10 +02:00
InverterSettings.h Added settings to pause polling/sending commands in general and at night 2023-02-18 19:44:16 +01:00
JkBmsController.h Support for Jikong JK BMS using serial connection (#319) 2023-08-31 16:21:32 +02:00
JkBmsDataPoints.h JK BMS: Support for MQTT (#432) 2023-09-15 10:06:30 +02:00
JkBmsSerialMessage.h Support for Jikong JK BMS using serial connection (#319) 2023-08-31 16:21:32 +02:00
Led_Single.h Feature: Turn off LEDs before reboot 2023-08-25 13:15:55 +02:00
MessageOutput.h Messages: thread-safety and dynamic memory (#418) 2023-09-04 14:08:30 +02:00
MqttHandleDtu.h Initialize variables before first usage 2023-09-18 20:23:00 +02:00
MqttHandleHass.h Rename FLD_PRA to FLD_Q 2023-04-24 22:29:59 +02:00
MqttHandleHuawei.h Adding Huawei CAN interface, web-api, websocket and Mqtt extensions to access the data 2023-03-24 10:03:22 +01:00
MqttHandleInverter.h Initialize variables before first usage 2023-09-18 20:23:00 +02:00
MqttHandleInverterTotal.h Feature: Implemented MQTT publishing of total values 2023-04-24 18:51:30 +02:00
MqttHandlePowerLimiter.h Fix DPL Mode 2 MQTT Status (#402) 2023-08-28 13:20:56 +02:00
MqttHandlePylontechHass.h Feature: add nice Icons for HA autoconfiguration (#413) 2023-09-04 14:07:24 +02:00
MqttHandleVedirect.h Integration of Victron SmartShunt via VE.Direct (#452) 2023-09-22 17:24:57 +02:00
MqttHandleVedirectHass.h Integration of Victron SmartShunt via VE.Direct (#452) 2023-09-22 17:24:57 +02:00
MqttSettings.h Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-08-04 12:21:16 +02:00
NetworkSettings.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
NtpSettings.h Cleanup includes 2022-12-14 22:13:03 +01:00
PinMapping.h VE.Direct: Fix design issues and prepare support for multiple instances (#505) 2023-10-19 16:15:29 +02:00
PowerLimiter.h DPL: (re-)send power limits periodically (#483) 2023-10-09 09:51:40 +02:00
PowerMeter.h PowerMeter fixes (#342) 2023-07-31 14:16:06 +02:00
PylontechCanReceiver.h Support for Jikong JK BMS using serial connection (#319) 2023-08-31 16:21:32 +02:00
README Initial commit 2022-04-09 11:05:14 +02:00
SunPosition.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
Utils.h Move different restart calls into one method 2023-08-25 12:58:53 +02:00
VictronMppt.h VE.Direct: Fix design issues and prepare support for multiple instances (#505) 2023-10-19 16:15:29 +02:00
VictronSmartShunt.h Integration of Victron SmartShunt via VE.Direct (#452) 2023-09-22 17:24:57 +02:00
WebApi_battery.h initial merge of power_limiter * missing is inverter and channel setting in gui 2023-02-20 15:56:02 +01:00
WebApi_config.h webapp: Allow download of individual config files 2023-01-05 01:44:38 +01:00
WebApi_device.h Added Device Profiles 2023-01-16 21:09:24 +01:00
WebApi_devinfo.h Added small dialog to show inverter info (firmware version etc.) 2022-08-11 16:42:50 +02:00
WebApi_dtu.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
WebApi_errors.h Feature: Admin AccessPoint Timeout now configurable 2023-07-22 18:14:07 +02:00
WebApi_eventlog.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
WebApi_firmware.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
WebApi_gridprofile.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
WebApi_Huawei.h Adding enable/disable option and pin to control a switch/relais to power the Huawei PSU 2023-03-26 11:00:37 +02:00
WebApi_inverter.h Feature: Allow reordering of the inverters in the live view 2023-05-29 20:17:07 +02:00
WebApi_limit.h Added web api to set limit 2022-09-30 18:34:30 +02:00
WebApi_maintenance.h Added device reboot functionality 2022-11-21 23:29:57 +01:00
WebApi_mqtt.h src/WebApi_mqtt.cpp: rename function getRootCaCertInfo 2023-04-12 08:47:24 +02:00
WebApi_network.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
WebApi_ntp.h Added API to set and get the current time 2022-09-20 19:44:24 +02:00
WebApi_power.h Implemented WebAPI to get status of last power command 2022-10-04 18:48:21 +02:00
WebApi_powerlimiter.h initial merge of power_limiter * missing is inverter and channel setting in gui 2023-02-20 15:56:02 +01:00
WebApi_powermeter.h New Power meter support: HTTP(S) + JSON (Shelly 3EM, Tasmota, Volkszähler etc.) (#153) 2023-04-03 21:36:20 +02:00
WebApi_prometheus.h Prometheus Endpoint: Simplify code by looping over fields instead of duplicated code 2023-08-22 13:00:52 +02:00
WebApi_security.h Introduce configuration option to decide wether the web ui is accessable without password or not 2022-11-22 23:32:52 +01:00
WebApi_sysstatus.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
WebApi_vedirect.h Password protection for vedirect settings API 2022-11-19 14:34:59 +01:00
WebApi_webapp.h Change License to GPLv2 as the RF24 lib uses GPL-2.0-only 2022-07-15 18:05:58 +02:00
WebApi_ws_battery.h Support for Jikong JK BMS using serial connection (#319) 2023-08-31 16:21:32 +02:00
WebApi_ws_console.h Added websocket for debug output 2022-12-19 21:38:39 +01:00
WebApi_ws_Huawei.h Adding Huawei CAN interface, web-api, websocket and Mqtt extensions to access the data 2023-03-24 10:03:22 +01:00
WebApi_ws_live.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00
WebApi_ws_vedirect_live.h VE.Direct: Fix design issues and prepare support for multiple instances (#505) 2023-10-19 16:15:29 +02:00
WebApi.h revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development" 2023-09-14 13:45:23 +02:00

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
 ...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html