Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter

- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
This commit is contained in:
Eric F
2026-06-08 00:38:27 -04:00
parent 468cfeaa50
commit d398a6ced2
7326 changed files with 1177561 additions and 7 deletions

View File

@@ -0,0 +1,254 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
#include "BUPowerSupplyDC.hpp"
#include "ftxui/component/component.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/dom/table.hpp"
using namespace ftxui;
namespace module {
static std::vector<std::vector<std::string>> to_string(types::power_supply_DC::Capabilities c) {
std::vector<std::vector<std::string>> hw_caps;
hw_caps.push_back({"Bi-Directional", (c.bidirectional ? "yes" : "no")});
hw_caps.push_back({"Export", fmt::format("{}V/{}V {}A/{}A {}W Efficiency {}", c.max_export_voltage_V,
c.min_export_voltage_V, c.max_export_current_A, c.min_export_current_A,
c.max_export_power_W, c.conversion_efficiency_export.value_or(1.0))});
if (c.bidirectional) {
hw_caps.push_back(
{"Import", fmt::format("{}V/{}V {}A/{}A {}W Efficiency {}", c.max_import_voltage_V.value_or(0),
c.min_import_voltage_V.value_or(0), c.max_import_current_A.value_or(0),
c.min_import_current_A.value_or(0), c.max_import_power_W.value_or(0),
c.conversion_efficiency_import.value_or(1.0))});
}
hw_caps.push_back({"Current", fmt::format("Ripple {}A Regulation {}A", c.peak_current_ripple_A,
c.current_regulation_tolerance_A)});
return hw_caps;
}
void BUPowerSupplyDC::init() {
}
void BUPowerSupplyDC::ready() {
auto screen = ScreenInteractive::Fullscreen();
r_psu->subscribe_voltage_current([this, &screen](const types::power_supply_DC::VoltageCurrent v) {
std::scoped_lock lock(data_mutex);
actual_voltage = fmt::format("{}V", v.voltage_V);
actual_current = fmt::format("{}A", v.current_A);
screen.Post(Event::Custom);
});
r_psu->subscribe_mode([this, &screen](const types::power_supply_DC::Mode mode) {
std::scoped_lock lock(data_mutex);
actual_mode = mode_to_string(mode);
screen.Post(Event::Custom);
});
r_psu->subscribe_capabilities([this, &screen](const types::power_supply_DC::Capabilities caps) {
std::scoped_lock lock(data_mutex);
raw_caps = caps;
screen.Post(Event::Custom);
});
std::string last_command = "None";
// ---------------------------------------------------------------------------
// Select mode
// ---------------------------------------------------------------------------
Component psu_off = Button(
"Power Off",
[&] {
last_command = "Switch Off";
r_psu->call_setMode(types::power_supply_DC::Mode::Off, types::power_supply_DC::ChargingPhase::Other);
},
ButtonOption::Animated(Color::Blue, Color::White, Color::BlueLight, Color::White));
Component psu_export_cablecheck = Button(
"Export (cablecheck EV)",
[&] {
last_command = "Export (precharge EV)";
r_psu->call_setMode(types::power_supply_DC::Mode::Export,
types::power_supply_DC::ChargingPhase::CableCheck);
},
ButtonOption::Animated(Color::Red, Color::White, Color::RedLight, Color::White));
Component psu_export_precharge = Button(
"Export (precharge EV)",
[&] {
last_command = "Export (precharge EV)";
r_psu->call_setMode(types::power_supply_DC::Mode::Export, types::power_supply_DC::ChargingPhase::PreCharge);
},
ButtonOption::Animated(Color::Red, Color::White, Color::RedLight, Color::White));
Component psu_export = Button(
"Export (charge EV)",
[&] {
last_command = "Export (charge EV)";
r_psu->call_setMode(types::power_supply_DC::Mode::Export, types::power_supply_DC::ChargingPhase::Charging);
},
ButtonOption::Animated(Color::Red, Color::White, Color::RedLight, Color::White));
Component psu_import = Button(
"Import (discharge EV)",
[&] {
last_command = "Import (discharge EV)";
r_psu->call_setMode(types::power_supply_DC::Mode::Import, types::power_supply_DC::ChargingPhase::Other);
},
ButtonOption::Animated(Color::Red, Color::White, Color::RedLight, Color::White));
auto mode_component = Container::Horizontal({
Container::Vertical({
psu_off,
psu_export_cablecheck,
psu_export_precharge,
psu_export,
psu_import,
}),
});
auto mode_renderer = Renderer(mode_component, [&] {
auto mode_win = window(text("Relais"), mode_component->Render());
return vbox({
hbox({
mode_win,
}),
}) |
flex_grow;
});
// ---------------------------------------------------------------------------
// PWM control
// ---------------------------------------------------------------------------
std::string setpoint_export_voltage{"10.0"};
std::string setpoint_export_current{"1.0"};
std::string setpoint_import_voltage{"10.0"};
std::string setpoint_import_current{"1.0"};
Component set_export_voltage_current = Button(
"Set Export voltage/current limit",
[&] {
float v = std::stof(setpoint_export_voltage);
float c = std::stof(setpoint_export_current);
last_command = fmt::format("Set Export voltage/current limit ({}V / {}A)", v, c);
r_psu->call_setExportVoltageCurrent(v, c);
},
ButtonOption::Animated(Color::Blue, Color::White, Color::BlueLight, Color::White));
Component set_import_voltage_current = Button(
"Set Import voltage/current limit",
[&] {
float v = std::stof(setpoint_import_voltage);
float c = std::stof(setpoint_import_current);
last_command = fmt::format("Set Import voltage/current limit ({}V / {}A)", v, c);
r_psu->call_setImportVoltageCurrent(v, c);
},
ButtonOption::Animated(Color::Blue, Color::White, Color::BlueLight, Color::White));
InputOption o;
o.multiline = false;
o.cursor_position = 0;
auto export_voltage_input = Input(&setpoint_export_voltage, "10.0", o);
auto export_current_input = Input(&setpoint_export_current, "1.0", o);
auto import_voltage_input = Input(&setpoint_import_voltage, "10.0", o);
auto import_current_input = Input(&setpoint_import_current, "1.0", o);
auto voltage_current_component = Container::Horizontal({
Container::Vertical({
set_export_voltage_current,
set_import_voltage_current,
export_voltage_input,
export_current_input,
import_voltage_input,
import_current_input,
}),
});
auto voltage_current_component_renderer = Renderer(voltage_current_component, [&] {
return vbox({hbox(set_export_voltage_current->Render()),
hbox(text(" Export voltage (V): "), export_voltage_input->Render()),
hbox(text(" Export current (A): "), export_current_input->Render()),
hbox(set_import_voltage_current->Render()),
hbox(text(" Import voltage (V): "), import_voltage_input->Render()),
hbox(text(" Import current (A): "), import_current_input->Render())});
});
auto voltage_current_renderer = Renderer(voltage_current_component, [&] {
return vbox({
hbox({
window(text("Voltage/Current Setting"), voltage_current_component_renderer->Render()),
}),
}) |
flex_grow;
});
// ---------------------------------------------------------------------------
// Vars
// ---------------------------------------------------------------------------
auto vars_renderer = Renderer([&] {
Element last_command_element = text("Last command: " + last_command);
std::vector<std::vector<std::string>> table_content;
{
std::scoped_lock lock(data_mutex);
table_content = {
{"Actual voltage", actual_voltage}, {"Actual current", actual_current}, {"Actual mode", actual_mode}};
}
auto vars = Table(table_content);
vars.SelectColumn(0).Border(LIGHT);
for (int i = 0; i < table_content.size(); i++) {
vars.SelectRow(i).Border(LIGHT);
}
return vbox({
hbox({
window(text("Information"), vbox({text("Last command: " + last_command), vars.Render()})),
}),
}) |
flex_grow;
});
// ---------------------------------------------------------------------------
// Capabilities
// ---------------------------------------------------------------------------
auto caps_renderer = Renderer([&] {
std::vector<std::vector<std::string>> caps_table_content;
{
std::scoped_lock lock(data_mutex);
caps_table_content = to_string(raw_caps);
}
auto caps = Table(caps_table_content);
caps.SelectColumn(0).Border(LIGHT);
for (int i = 0; i < caps_table_content.size(); i++) {
caps.SelectRow(i).Border(LIGHT);
}
return vbox({
hbox({
window(text("Capabilities"), caps.Render()),
}),
}) |
flex_grow;
});
auto main_container = Container::Horizontal(
{voltage_current_renderer, mode_renderer, Container::Vertical({caps_renderer, vars_renderer})});
auto main_renderer = Renderer(main_container, [&] {
return vbox({
text("Power Supply DC Bringup") | bold | hcenter,
main_container->Render(),
});
});
screen.Loop(main_renderer);
}
} // namespace module

View File

@@ -0,0 +1,63 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
#ifndef BUPOWER_SUPPLY_DC_HPP
#define BUPOWER_SUPPLY_DC_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 2
//
#include "ld-ev.hpp"
// headers for required interface implementations
#include <generated/interfaces/power_supply_DC/Interface.hpp>
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
// insert your custom include headers here
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
namespace module {
struct Conf {};
class BUPowerSupplyDC : public Everest::ModuleBase {
public:
BUPowerSupplyDC() = delete;
BUPowerSupplyDC(const ModuleInfo& info, std::unique_ptr<power_supply_DCIntf> r_psu, Conf& config) :
ModuleBase(info), r_psu(std::move(r_psu)), config(config){};
const std::unique_ptr<power_supply_DCIntf> r_psu;
const Conf& config;
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
// insert your public definitions here
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
protected:
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1
// insert your protected definitions here
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1
private:
friend class LdEverest;
void init();
void ready();
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1
// insert your private definitions here
std::mutex data_mutex;
types::power_supply_DC::Capabilities raw_caps;
std::string actual_voltage;
std::string actual_current;
std::string actual_mode;
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1
};
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1
// insert other definitions here
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1
} // namespace module
#endif // BUPOWER_SUPPLY_DC_HPP

View File

@@ -0,0 +1,21 @@
#
# AUTO GENERATED - MARKED REGIONS WILL BE KEPT
# template version 3
#
# module setup:
# - ${MODULE_NAME}: module name
ev_setup_cpp_module()
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
# insert your custom targets and additional config variables here
target_link_libraries(${MODULE_NAME}
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
# insert other things like install cmds etc here
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

View File

@@ -0,0 +1,8 @@
description: Interactive bring up helper for power supply DC interface
requires:
psu:
interface: power_supply_DC
metadata:
license: https://opensource.org/licenses/Apache-2.0
authors:
- Cornelius Claussen