Feature: add support for a third Victron MPPT
only on ESP32-S3-USB. this fiddles with the available hardware UARTs to make it possible to use a third Victron MPPT. if three MPPTs are defined int the pin mapping, you will not be able to use the SmartShunt and JK BMS battery interfaces. note that using a second MPPT will also conflict with the SDM power meter, and that conflict is not detected, yet.
This commit is contained in:
parent
90aafe2cbf
commit
5a1c3af31f
@ -14,7 +14,7 @@ public:
|
|||||||
virtual void deinit() = 0;
|
virtual void deinit() = 0;
|
||||||
virtual void loop() = 0;
|
virtual void loop() = 0;
|
||||||
virtual std::shared_ptr<BatteryStats> getStats() const = 0;
|
virtual std::shared_ptr<BatteryStats> getStats() const = 0;
|
||||||
virtual bool usesHwPort2() const { return false; }
|
virtual int usedHwUart() const { return -1; } // -1 => no HW UART used
|
||||||
};
|
};
|
||||||
|
|
||||||
class BatteryClass {
|
class BatteryClass {
|
||||||
|
|||||||
@ -11,6 +11,8 @@ class DataPointContainer;
|
|||||||
|
|
||||||
namespace JkBms {
|
namespace JkBms {
|
||||||
|
|
||||||
|
uint8_t constexpr HwSerialPort = ((ARDUINO_USB_CDC_ON_BOOT != 1)?2:0);
|
||||||
|
|
||||||
class Controller : public BatteryProvider {
|
class Controller : public BatteryProvider {
|
||||||
public:
|
public:
|
||||||
Controller() = default;
|
Controller() = default;
|
||||||
@ -19,9 +21,7 @@ class Controller : public BatteryProvider {
|
|||||||
void deinit() final;
|
void deinit() final;
|
||||||
void loop() final;
|
void loop() final;
|
||||||
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
||||||
bool usesHwPort2() const final {
|
int usedHwUart() const final { return HwSerialPort; }
|
||||||
return ARDUINO_USB_CDC_ON_BOOT != 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Status : unsigned {
|
enum class Status : unsigned {
|
||||||
|
|||||||
@ -45,6 +45,8 @@ struct PinMapping_t {
|
|||||||
int8_t victron_rx;
|
int8_t victron_rx;
|
||||||
int8_t victron_tx2;
|
int8_t victron_tx2;
|
||||||
int8_t victron_rx2;
|
int8_t victron_rx2;
|
||||||
|
int8_t victron_tx3;
|
||||||
|
int8_t victron_rx3;
|
||||||
int8_t battery_rx;
|
int8_t battery_rx;
|
||||||
int8_t battery_rxen;
|
int8_t battery_rxen;
|
||||||
int8_t battery_tx;
|
int8_t battery_tx;
|
||||||
|
|||||||
@ -5,14 +5,16 @@
|
|||||||
|
|
||||||
class SerialPortManagerClass {
|
class SerialPortManagerClass {
|
||||||
public:
|
public:
|
||||||
bool allocateMpptPort(int port);
|
void init();
|
||||||
bool allocateBatteryPort(int port);
|
bool allocateMpptPort(uint8_t port);
|
||||||
|
bool allocateBatteryPort(uint8_t port);
|
||||||
void invalidateBatteryPort();
|
void invalidateBatteryPort();
|
||||||
void invalidateMpptPorts();
|
void invalidateMpptPorts();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Owner {
|
enum class Owner {
|
||||||
BATTERY,
|
Console,
|
||||||
|
Battery,
|
||||||
MPPT
|
MPPT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,8 @@ private:
|
|||||||
using controller_t = std::unique_ptr<VeDirectMpptController>;
|
using controller_t = std::unique_ptr<VeDirectMpptController>;
|
||||||
std::vector<controller_t> _controllers;
|
std::vector<controller_t> _controllers;
|
||||||
|
|
||||||
bool initController(int8_t rx, int8_t tx, bool logging, int hwSerialPort);
|
bool initController(int8_t rx, int8_t tx, bool logging,
|
||||||
|
uint8_t instance, uint8_t hwSerialPort);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern VictronMpptClass VictronMppt;
|
extern VictronMpptClass VictronMppt;
|
||||||
|
|||||||
@ -9,11 +9,10 @@ public:
|
|||||||
void deinit() final { }
|
void deinit() final { }
|
||||||
void loop() final;
|
void loop() final;
|
||||||
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
||||||
bool usesHwPort2() const final {
|
int usedHwUart() const final { return _hwSerialPort; }
|
||||||
return ARDUINO_USB_CDC_ON_BOOT != 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static uint8_t constexpr _hwSerialPort = ((ARDUINO_USB_CDC_ON_BOOT != 1)?2:0);
|
||||||
uint32_t _lastUpdate = 0;
|
uint32_t _lastUpdate = 0;
|
||||||
std::shared_ptr<VictronSmartShuntStats> _stats =
|
std::shared_ptr<VictronSmartShuntStats> _stats =
|
||||||
std::make_shared<VictronSmartShuntStats>();
|
std::make_shared<VictronSmartShuntStats>();
|
||||||
|
|||||||
@ -62,7 +62,8 @@ VeDirectFrameHandler<T>::VeDirectFrameHandler() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void VeDirectFrameHandler<T>::init(char const* who, int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging, uint16_t hwSerialPort)
|
void VeDirectFrameHandler<T>::init(char const* who, int8_t rx, int8_t tx,
|
||||||
|
Print* msgOut, bool verboseLogging, uint8_t hwSerialPort)
|
||||||
{
|
{
|
||||||
_vedirectSerial = std::make_unique<HardwareSerial>(hwSerialPort);
|
_vedirectSerial = std::make_unique<HardwareSerial>(hwSerialPort);
|
||||||
_vedirectSerial->end(); // make sure the UART will be re-initialized
|
_vedirectSerial->end(); // make sure the UART will be re-initialized
|
||||||
|
|||||||
@ -30,7 +30,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
VeDirectFrameHandler();
|
VeDirectFrameHandler();
|
||||||
void init(char const* who, int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging, uint16_t hwSerialPort);
|
void init(char const* who, int8_t rx, int8_t tx, Print* msgOut,
|
||||||
|
bool verboseLogging, uint8_t hwSerialPort);
|
||||||
virtual bool hexDataHandler(VeDirectHexData const &data) { return false; } // handles the disassembeled hex response
|
virtual bool hexDataHandler(VeDirectHexData const &data) { return false; } // handles the disassembeled hex response
|
||||||
|
|
||||||
bool _verboseLogging;
|
bool _verboseLogging;
|
||||||
|
|||||||
@ -12,9 +12,11 @@
|
|||||||
|
|
||||||
//#define PROCESS_NETWORK_STATE
|
//#define PROCESS_NETWORK_STATE
|
||||||
|
|
||||||
void VeDirectMpptController::init(int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging, uint16_t hwSerialPort)
|
void VeDirectMpptController::init(int8_t rx, int8_t tx, Print* msgOut,
|
||||||
|
bool verboseLogging, uint8_t hwSerialPort)
|
||||||
{
|
{
|
||||||
VeDirectFrameHandler::init("MPPT", rx, tx, msgOut, verboseLogging, hwSerialPort);
|
VeDirectFrameHandler::init("MPPT", rx, tx, msgOut,
|
||||||
|
verboseLogging, hwSerialPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VeDirectMpptController::processTextDataDerived(std::string const& name, std::string const& value)
|
bool VeDirectMpptController::processTextDataDerived(std::string const& name, std::string const& value)
|
||||||
|
|||||||
@ -40,7 +40,8 @@ class VeDirectMpptController : public VeDirectFrameHandler<veMpptStruct> {
|
|||||||
public:
|
public:
|
||||||
VeDirectMpptController() = default;
|
VeDirectMpptController() = default;
|
||||||
|
|
||||||
void init(int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging, uint16_t hwSerialPort);
|
void init(int8_t rx, int8_t tx, Print* msgOut,
|
||||||
|
bool verboseLogging, uint8_t hwSerialPort);
|
||||||
|
|
||||||
using data_t = veMpptStruct;
|
using data_t = veMpptStruct;
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
VeDirectShuntController VeDirectShunt;
|
VeDirectShuntController VeDirectShunt;
|
||||||
|
|
||||||
void VeDirectShuntController::init(int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging)
|
void VeDirectShuntController::init(int8_t rx, int8_t tx, Print* msgOut,
|
||||||
|
bool verboseLogging, uint8_t hwSerialPort)
|
||||||
{
|
{
|
||||||
VeDirectFrameHandler::init("SmartShunt", rx, tx, msgOut, verboseLogging,
|
VeDirectFrameHandler::init("SmartShunt", rx, tx, msgOut,
|
||||||
((ARDUINO_USB_CDC_ON_BOOT != 1)?2:0));
|
verboseLogging, hwSerialPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VeDirectShuntController::processTextDataDerived(std::string const& name, std::string const& value)
|
bool VeDirectShuntController::processTextDataDerived(std::string const& name, std::string const& value)
|
||||||
|
|||||||
@ -8,7 +8,8 @@ class VeDirectShuntController : public VeDirectFrameHandler<veShuntStruct> {
|
|||||||
public:
|
public:
|
||||||
VeDirectShuntController() = default;
|
VeDirectShuntController() = default;
|
||||||
|
|
||||||
void init(int8_t rx, int8_t tx, Print* msgOut, bool verboseLogging);
|
void init(int8_t rx, int8_t tx, Print* msgOut,
|
||||||
|
bool verboseLogging, uint8_t hwSerialPort);
|
||||||
|
|
||||||
using data_t = veShuntStruct;
|
using data_t = veShuntStruct;
|
||||||
|
|
||||||
|
|||||||
@ -60,17 +60,17 @@ void BatteryClass::updateSettings()
|
|||||||
_upProvider = std::make_unique<VictronSmartShunt>();
|
_upProvider = std::make_unique<VictronSmartShunt>();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MessageOutput.printf("Unknown battery provider: %d\r\n", config.Battery.Provider);
|
MessageOutput.printf("[Battery] Unknown provider: %d\r\n", config.Battery.Provider);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_upProvider->usesHwPort2()) {
|
// port is -1 if provider is neither JK BMS nor SmartShunt. otherwise, port
|
||||||
if (!SerialPortManager.allocateBatteryPort(2)) {
|
// is 2, unless running on ESP32-S3 with USB CDC, then port is 0.
|
||||||
MessageOutput.printf("[Battery] Serial port %d already in use. Initialization aborted!\r\n", 2);
|
int port = _upProvider->usedHwUart();
|
||||||
|
if (port >= 0 && !SerialPortManager.allocateBatteryPort(port)) {
|
||||||
_upProvider = nullptr;
|
_upProvider = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!_upProvider->init(verboseLogging)) {
|
if (!_upProvider->init(verboseLogging)) {
|
||||||
SerialPortManager.invalidateBatteryPort();
|
SerialPortManager.invalidateBatteryPort();
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
#include "JkBmsController.h"
|
#include "JkBmsController.h"
|
||||||
#include <frozen/map.h>
|
#include <frozen/map.h>
|
||||||
|
|
||||||
|
namespace JkBms {
|
||||||
|
|
||||||
//#define JKBMS_DUMMY_SERIAL
|
//#define JKBMS_DUMMY_SERIAL
|
||||||
|
|
||||||
#ifdef JKBMS_DUMMY_SERIAL
|
#ifdef JKBMS_DUMMY_SERIAL
|
||||||
@ -198,11 +200,9 @@ class DummySerial {
|
|||||||
};
|
};
|
||||||
DummySerial HwSerial;
|
DummySerial HwSerial;
|
||||||
#else
|
#else
|
||||||
HardwareSerial HwSerial((ARDUINO_USB_CDC_ON_BOOT != 1)?2:0);
|
HardwareSerial HwSerial(HwSerialPort);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace JkBms {
|
|
||||||
|
|
||||||
bool Controller::init(bool verboseLogging)
|
bool Controller::init(bool verboseLogging)
|
||||||
{
|
{
|
||||||
_verboseLogging = verboseLogging;
|
_verboseLogging = verboseLogging;
|
||||||
|
|||||||
@ -100,6 +100,14 @@
|
|||||||
#define VICTRON_PIN_RX2 -1
|
#define VICTRON_PIN_RX2 -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef VICTRON_PIN_TX3
|
||||||
|
#define VICTRON_PIN_TX3 -1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef VICTRON_PIN_RX3
|
||||||
|
#define VICTRON_PIN_RX3 -1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef BATTERY_PIN_RX
|
#ifndef BATTERY_PIN_RX
|
||||||
#define BATTERY_PIN_RX -1
|
#define BATTERY_PIN_RX -1
|
||||||
#endif
|
#endif
|
||||||
@ -207,8 +215,11 @@ PinMappingClass::PinMappingClass()
|
|||||||
_pinMapping.victron_rx = VICTRON_PIN_RX;
|
_pinMapping.victron_rx = VICTRON_PIN_RX;
|
||||||
_pinMapping.victron_tx = VICTRON_PIN_TX;
|
_pinMapping.victron_tx = VICTRON_PIN_TX;
|
||||||
|
|
||||||
_pinMapping.victron_rx2 = VICTRON_PIN_RX;
|
_pinMapping.victron_rx2 = VICTRON_PIN_RX2;
|
||||||
_pinMapping.victron_tx2 = VICTRON_PIN_TX;
|
_pinMapping.victron_tx2 = VICTRON_PIN_TX2;
|
||||||
|
|
||||||
|
_pinMapping.victron_rx3 = VICTRON_PIN_RX3;
|
||||||
|
_pinMapping.victron_tx3 = VICTRON_PIN_TX3;
|
||||||
|
|
||||||
_pinMapping.battery_rx = BATTERY_PIN_RX;
|
_pinMapping.battery_rx = BATTERY_PIN_RX;
|
||||||
_pinMapping.battery_rxen = BATTERY_PIN_RXEN;
|
_pinMapping.battery_rxen = BATTERY_PIN_RXEN;
|
||||||
@ -292,6 +303,8 @@ bool PinMappingClass::init(const String& deviceMapping)
|
|||||||
_pinMapping.victron_tx = doc[i]["victron"]["tx"] | VICTRON_PIN_TX;
|
_pinMapping.victron_tx = doc[i]["victron"]["tx"] | VICTRON_PIN_TX;
|
||||||
_pinMapping.victron_rx2 = doc[i]["victron"]["rx2"] | VICTRON_PIN_RX2;
|
_pinMapping.victron_rx2 = doc[i]["victron"]["rx2"] | VICTRON_PIN_RX2;
|
||||||
_pinMapping.victron_tx2 = doc[i]["victron"]["tx2"] | VICTRON_PIN_TX2;
|
_pinMapping.victron_tx2 = doc[i]["victron"]["tx2"] | VICTRON_PIN_TX2;
|
||||||
|
_pinMapping.victron_rx3 = doc[i]["victron"]["rx3"] | VICTRON_PIN_RX3;
|
||||||
|
_pinMapping.victron_tx3 = doc[i]["victron"]["tx3"] | VICTRON_PIN_TX3;
|
||||||
|
|
||||||
_pinMapping.battery_rx = doc[i]["battery"]["rx"] | BATTERY_PIN_RX;
|
_pinMapping.battery_rx = doc[i]["battery"]["rx"] | BATTERY_PIN_RX;
|
||||||
_pinMapping.battery_rxen = doc[i]["battery"]["rxen"] | BATTERY_PIN_RXEN;
|
_pinMapping.battery_rxen = doc[i]["battery"]["rxen"] | BATTERY_PIN_RXEN;
|
||||||
|
|||||||
@ -6,12 +6,19 @@
|
|||||||
|
|
||||||
SerialPortManagerClass SerialPortManager;
|
SerialPortManagerClass SerialPortManager;
|
||||||
|
|
||||||
bool SerialPortManagerClass::allocateBatteryPort(int port)
|
void SerialPortManagerClass::init()
|
||||||
{
|
{
|
||||||
return allocatePort(port, Owner::BATTERY);
|
if (ARDUINO_USB_CDC_ON_BOOT != 1) {
|
||||||
|
allocatePort(0, Owner::Console);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SerialPortManagerClass::allocateMpptPort(int port)
|
bool SerialPortManagerClass::allocateBatteryPort(uint8_t port)
|
||||||
|
{
|
||||||
|
return allocatePort(port, Owner::Battery);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SerialPortManagerClass::allocateMpptPort(uint8_t port)
|
||||||
{
|
{
|
||||||
return allocatePort(port, Owner::MPPT);
|
return allocatePort(port, Owner::MPPT);
|
||||||
}
|
}
|
||||||
@ -19,16 +26,27 @@ bool SerialPortManagerClass::allocateMpptPort(int port)
|
|||||||
bool SerialPortManagerClass::allocatePort(uint8_t port, Owner owner)
|
bool SerialPortManagerClass::allocatePort(uint8_t port, Owner owner)
|
||||||
{
|
{
|
||||||
if (port >= MAX_CONTROLLERS) {
|
if (port >= MAX_CONTROLLERS) {
|
||||||
MessageOutput.printf("[SerialPortManager] Invalid serial port = %d \r\n", port);
|
MessageOutput.printf("[SerialPortManager] Invalid serial port: %d\r\n", port);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return allocatedPorts.insert({port, owner}).second;
|
auto res = allocatedPorts.insert({port, owner});
|
||||||
|
|
||||||
|
if (!res.second) {
|
||||||
|
MessageOutput.printf("[SerialPortManager] Cannot assign HW UART "
|
||||||
|
"port %d to %s: already in use by %s\r\n",
|
||||||
|
port, print(owner), print(res.first->second));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageOutput.printf("[SerialPortManager] HW UART port %d now in use "
|
||||||
|
"by %s\r\n", port, print(owner));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPortManagerClass::invalidateBatteryPort()
|
void SerialPortManagerClass::invalidateBatteryPort()
|
||||||
{
|
{
|
||||||
invalidate(Owner::BATTERY);
|
invalidate(Owner::Battery);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPortManagerClass::invalidateMpptPorts()
|
void SerialPortManagerClass::invalidateMpptPorts()
|
||||||
@ -51,10 +69,12 @@ void SerialPortManagerClass::invalidate(Owner owner)
|
|||||||
const char* SerialPortManagerClass::print(Owner owner)
|
const char* SerialPortManagerClass::print(Owner owner)
|
||||||
{
|
{
|
||||||
switch (owner) {
|
switch (owner) {
|
||||||
case BATTERY:
|
case Owner::Console:
|
||||||
return "BATTERY";
|
return "Serial Console";
|
||||||
case MPPT:
|
case Owner::Battery:
|
||||||
return "MPPT";
|
return "Battery Interface";
|
||||||
|
case Owner::MPPT:
|
||||||
|
return "Victron MPPT";
|
||||||
}
|
}
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,29 +29,32 @@ void VictronMpptClass::updateSettings()
|
|||||||
|
|
||||||
const PinMapping_t& pin = PinMapping.get();
|
const PinMapping_t& pin = PinMapping.get();
|
||||||
|
|
||||||
int hwSerialPort = 1;
|
// HW UART 1 has always been the designated UART to connect a Victron MPPT
|
||||||
bool initSuccess = initController(pin.victron_rx, pin.victron_tx, config.Vedirect.VerboseLogging, hwSerialPort);
|
if (!initController(pin.victron_rx, pin.victron_tx,
|
||||||
if (initSuccess) {
|
config.Vedirect.VerboseLogging, 1, 1)) { return; }
|
||||||
hwSerialPort++;
|
|
||||||
|
// HW UART 2 conflicts with the SDM power meter and the battery interface
|
||||||
|
if (!initController(pin.victron_rx2, pin.victron_tx2,
|
||||||
|
config.Vedirect.VerboseLogging, 2, 2)) { return; }
|
||||||
|
|
||||||
|
// HW UART 0 is only available on ESP32-S3 with logging over USB CDC, and
|
||||||
|
// furthermore still conflicts with the battery interface in that case
|
||||||
|
initController(pin.victron_rx3, pin.victron_tx3,
|
||||||
|
config.Vedirect.VerboseLogging, 3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
initController(pin.victron_rx2, pin.victron_tx2, config.Vedirect.VerboseLogging, hwSerialPort);
|
bool VictronMpptClass::initController(int8_t rx, int8_t tx, bool logging,
|
||||||
}
|
uint8_t instance, uint8_t hwSerialPort)
|
||||||
|
|
||||||
bool VictronMpptClass::initController(int8_t rx, int8_t tx, bool logging, int hwSerialPort)
|
|
||||||
{
|
{
|
||||||
MessageOutput.printf("[VictronMppt] rx = %d, tx = %d, hwSerialPort = %d\r\n", rx, tx, hwSerialPort);
|
MessageOutput.printf("[VictronMppt Instance %d] rx = %d, tx = %d, "
|
||||||
|
"hwSerialPort = %d\r\n", instance, rx, tx, hwSerialPort);
|
||||||
|
|
||||||
if (rx < 0) {
|
if (rx < 0) {
|
||||||
MessageOutput.printf("[VictronMppt] invalid pin config rx = %d, tx = %d\r\n", rx, tx);
|
MessageOutput.printf("[VictronMppt Instance %d] invalid pin config\r\n", instance);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SerialPortManager.allocateMpptPort(hwSerialPort)) {
|
if (!SerialPortManager.allocateMpptPort(hwSerialPort)) { return false; }
|
||||||
MessageOutput.printf("[VictronMppt] Serial port %d already in use. Initialization aborted!\r\n",
|
|
||||||
hwSerialPort);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto upController = std::make_unique<VeDirectMpptController>();
|
auto upController = std::make_unique<VeDirectMpptController>();
|
||||||
upController->init(rx, tx, &MessageOutput, logging, hwSerialPort);
|
upController->init(rx, tx, &MessageOutput, logging, hwSerialPort);
|
||||||
|
|||||||
@ -21,7 +21,7 @@ bool VictronSmartShunt::init(bool verboseLogging)
|
|||||||
auto tx = static_cast<gpio_num_t>(pin.battery_tx);
|
auto tx = static_cast<gpio_num_t>(pin.battery_tx);
|
||||||
auto rx = static_cast<gpio_num_t>(pin.battery_rx);
|
auto rx = static_cast<gpio_num_t>(pin.battery_rx);
|
||||||
|
|
||||||
VeDirectShunt.init(rx, tx, &MessageOutput, verboseLogging);
|
VeDirectShunt.init(rx, tx, &MessageOutput, verboseLogging, _hwSerialPort);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,8 @@ void WebApiDeviceClass::onDeviceAdminGet(AsyncWebServerRequest* request)
|
|||||||
victronPinObj["tx"] = pin.victron_tx;
|
victronPinObj["tx"] = pin.victron_tx;
|
||||||
victronPinObj["rx2"] = pin.victron_rx2;
|
victronPinObj["rx2"] = pin.victron_rx2;
|
||||||
victronPinObj["tx2"] = pin.victron_tx2;
|
victronPinObj["tx2"] = pin.victron_tx2;
|
||||||
|
victronPinObj["rx3"] = pin.victron_rx3;
|
||||||
|
victronPinObj["tx3"] = pin.victron_tx3;
|
||||||
|
|
||||||
auto batteryPinObj = curPin["battery"].to<JsonObject>();
|
auto batteryPinObj = curPin["battery"].to<JsonObject>();
|
||||||
batteryPinObj["rx"] = pin.battery_rx;
|
batteryPinObj["rx"] = pin.battery_rx;
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "InverterSettings.h"
|
#include "InverterSettings.h"
|
||||||
#include "Led_Single.h"
|
#include "Led_Single.h"
|
||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
|
#include "SerialPortManager.h"
|
||||||
#include "VictronMppt.h"
|
#include "VictronMppt.h"
|
||||||
#include "Battery.h"
|
#include "Battery.h"
|
||||||
#include "Huawei_can.h"
|
#include "Huawei_can.h"
|
||||||
@ -96,6 +97,8 @@ void setup()
|
|||||||
const auto& pin = PinMapping.get();
|
const auto& pin = PinMapping.get();
|
||||||
MessageOutput.println("done");
|
MessageOutput.println("done");
|
||||||
|
|
||||||
|
SerialPortManager.init();
|
||||||
|
|
||||||
// Initialize WiFi
|
// Initialize WiFi
|
||||||
MessageOutput.print("Initialize Network... ");
|
MessageOutput.print("Initialize Network... ");
|
||||||
NetworkSettings.init(scheduler);
|
NetworkSettings.init(scheduler);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user