PowerPort configuration for different charger types improved

- Solar and battery ports now defined as references to actual hardware ports at very beginning of main.cpp, allowing to use the references also in data_objects.cpp
- Different charger types (PWM / MPPT) are configured more clearly by switching on/off features (DC/DC, PWM switch and load) in PCB configuration
This commit is contained in:
Martin Jaeger
2019-10-20 17:44:32 +02:00
parent 0399c4e877
commit b5c7f396e1
25 changed files with 248 additions and 220 deletions
+6 -8
View File
@@ -17,8 +17,6 @@
#ifndef UNIT_TEST
#include "main.h"
extern PowerPort *bat_terminal;
extern PowerPort *solar_terminal;
#ifdef OLED_ENABLED // otherwise don't compile code to reduce firmware size
@@ -95,25 +93,25 @@ void uext_process_1s()
if (half_bridge_enabled()) {
#endif
oled.setTextCursor(0, 18);
oled.printf("%4.0fW", (abs(solar_terminal->power) < 1) ? 0 : -solar_terminal->power); // remove negative zeros
oled.printf("%4.0fW", (abs(solar_terminal.power) < 1) ? 0 : -solar_terminal.power); // remove negative zeros
}
else {
oled.setTextCursor(8, 18);
oled.printf("n/a");
}
#ifndef CHARGER_TYPE_PWM
if (solar_terminal->bus->voltage > bat_terminal->bus->voltage)
if (solar_terminal.bus->voltage > bat_terminal.bus->voltage)
#endif
{
oled.setTextCursor(0, 26);
oled.printf("%4.1fV", solar_terminal->bus->voltage);
oled.printf("%4.1fV", solar_terminal.bus->voltage);
}
// battery data
oled.setTextCursor(42, 18);
oled.printf("%5.1fW", (abs(bat_terminal->power) < 0.1) ? 0 : bat_terminal->power); // remove negative zeros
oled.printf("%5.1fW", (abs(bat_terminal.power) < 0.1) ? 0 : bat_terminal.power); // remove negative zeros
oled.setTextCursor(42, 26);
oled.printf("%5.1fV", bat_terminal->bus->voltage);
oled.printf("%5.1fV", bat_terminal.bus->voltage);
// load data
oled.setTextCursor(90, 18);
@@ -122,7 +120,7 @@ void uext_process_1s()
oled.printf("%5.1fA\n", (abs(load_terminal.current) < 0.1) ? 0 : load_terminal.current);
oled.setTextCursor(0, 36);
oled.printf("Day +%5.0fWh -%5.0fWh", solar_terminal->dis_energy_Wh, fabs(load_terminal.chg_energy_Wh));
oled.printf("Day +%5.0fWh -%5.0fWh", solar_terminal.dis_energy_Wh, fabs(load_terminal.chg_energy_Wh));
oled.printf("Tot +%4.1fkWh -%4.1fkWh", log_data.solar_in_total_Wh / 1000.0, fabs(log_data.load_out_total_Wh) / 1000.0);
oled.setTextCursor(0, 56);