Feature: Support for second Victron MPPT charge controller

this change adds support for a second Victron MPPT charge controller
using a second serial connection.

* Add device configuration for a second victron mppt
* Update VedirectView for second victron mppt
* Update MqttHandleVedirect for second victron mppt
* Update MqttHandleVedirectHass for second victron mppt
* Handle nonexisting victron controllers with optionals
* Add bool-function to Battery and inherited classes, if uart port 2 is
  being used
* Introduced a serial port manager. In order to prevent the battery and
  the Victron MPPT to use the same hw serial ports, this class keeps
  track of the used ports and their owners.
This commit is contained in:
Arman Vartan
2024-02-26 01:27:13 +01:00
committed by Bernhard Kirchen
parent 21c19f4b7f
commit 75541be248
28 changed files with 456 additions and 236 deletions

View File

@@ -1,9 +1,9 @@
#include <Arduino.h>
#include "VeDirectMpptController.h"
void VeDirectMpptController::init(int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging)
void VeDirectMpptController::init(int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging, uint16_t hwSerialPort)
{
VeDirectFrameHandler::init(rx, tx, msgOut, verboseLogging, 1);
VeDirectFrameHandler::init(rx, tx, msgOut, verboseLogging, hwSerialPort);
_spData = std::make_shared<veMpptStruct>();
if (_verboseLogging) { _msgOut->println("Finished init MPPTController"); }
}