Skip to content

Commit d40fb9c

Browse files
committed
upgrade to MO v1.1
1 parent df5f1f1 commit d40fb9c

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

platformio.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ lib_deps =
3838
jeremypoulter/[email protected]
3939
jeremypoulter/[email protected]
4040
jeremypoulter/[email protected]
41-
42-
41+
42+
43+
https://github.com/matth-x/MicroOcpp#a36e6a443fe660f27b8b21eceb55db5b59e5c3b2
44+
https://github.com/matth-x/MicroOcppMongoose#1a6dc511e9678391bc45225f1d69296ddc352218
4345
lib_ignore = WebSockets ; MicroOcpp: don't compile built-in WS library
4446
extra_scripts =
4547
pre:scripts/auto_fw_version.py
@@ -89,8 +91,8 @@ build_flags =
8991
-D MO_CUSTOM_WS ; MicroOcpp: don't use built-in WS library
9092
-D MO_CUSTOM_CONSOLE ; MicroOcpp: use custom debug out
9193
-D MO_DBG_LEVEL=MO_DL_INFO
94+
-D MO_TRAFFIC_OUT
9295
-D MO_MG_VERSION_614 ; use MG v6.14
93-
-D MO_CA_CERT_LOCAL ; manage certificate locally
9496
#-D ENABLE_DEBUG
9597
#-D ENABLE_DEBUG_MONGOOSE_HTTP_CLIENT
9698
-D RAPI_MAX_COMMANDS=20

src/ocpp.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "ocpp.h"
77

88
#include <MicroOcpp.h>
9+
#include <MicroOcpp/Model/Diagnostics/DiagnosticsService.h>
10+
#include <MicroOcpp/Model/FirmwareManagement/FirmwareService.h>
911
#include <MongooseCore.h>
1012

1113
#include "app_config.h"
@@ -274,17 +276,17 @@ void OcppTask::loadEvseBehavior() {
274276
* Synchronize OpenEVSE data with OCPP-library data
275277
*/
276278

277-
addMeterValueInput([this] () {
278-
return evse->getAmps() * evse->getVoltage();
279-
},
280-
"Power.Active.Import",
281-
"W");
282-
283-
addMeterValueInput([this] () {
284-
return evse->getTotalEnergy() * 1000.; //convert kWh into Wh
285-
},
286-
"Energy.Active.Import.Register",
287-
"Wh");
279+
//basic meter readings
280+
281+
setEnergyMeterInput([this] () {
282+
return evse->getTotalEnergy() * 1000.; //convert kWh into Wh
283+
});
284+
285+
setPowerMeterInput([this] () {
286+
return evse->getAmps() * evse->getVoltage();
287+
});
288+
289+
//further meter readings
288290

289291
addMeterValueInput([this] () {
290292
return evse->getAmps();
@@ -525,6 +527,11 @@ void OcppTask::updateEvseClaim() {
525527
evseState = EvseState::Disabled;
526528
}
527529

530+
//check further error condition not handled by Atmega
531+
if (rfid->communicationFails()) {
532+
evseState = EvseState::Disabled;
533+
}
534+
528535
evseProperties = evseState;
529536

530537
//OCPP Smart Charging?
@@ -728,7 +735,7 @@ void OcppTask::initializeFwService() {
728735

729736
bool OcppTask::isConnected() {
730737
if (instance && instance->connection) {
731-
return instance->connection->isConnectionOpen();
738+
return instance->connection->isConnected();
732739
}
733740
return false;
734741
}

0 commit comments

Comments
 (0)