Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
matth-x committed Oct 21, 2023
2 parents ca7f8b6 + 47c50dc commit c502d9e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# <img src="https://user-images.githubusercontent.com/63792403/133922028-fefc8abb-fde9-460b-826f-09a458502d17.png" alt="Icon" height="24"> &nbsp; MicroOcpp (ArduinoOcpp)
# <img src="https://github.com/matth-x/MicroOcpp/assets/63792403/1c49d1ad-7afc-48d3-a54e-9aef2d4886db" alt="Icon" height="24"> &nbsp; MicroOcpp

[![Build Status]( https://github.com/matth-x/MicroOcpp/workflows/PlatformIO%20CI/badge.svg)](https://github.com/matth-x/MicroOcpp/actions)
[![Unit tests]( https://github.com/matth-x/MicroOcpp/workflows/Unit%20tests/badge.svg)](https://github.com/matth-x/MicroOcpp/actions)
[![codecov](https://codecov.io/github/matth-x/ArduinoOcpp/branch/develop/graph/badge.svg?token=UN6LO96HM7)](https://codecov.io/github/matth-x/ArduinoOcpp)

OCPP 1.6 client for microcontrollers. Portable C/C++. Compatible with Espressif, Arduino, NXP, STM and Linux and more.
OCPP 1.6 client for microcontrollers. Portable C/C++. Compatible with Espressif, Arduino, NXP, STM, Linux and more.

**Formerly ArduinoOcpp ([migration guide](https://matth-x.github.io/MicroOcpp/migration/))**: *the initial version of this library used the Arduino API but this dependency was dropped some time ago and the old name has become outdated. Despite the new name, nothing changes for existing users and the Arduino integration will continue to be fully functional.*

Reference usage: [OpenEVSE](https://github.com/OpenEVSE/ESP32_WiFi_V4.x/blob/master/src/ocpp.cpp) | Technical introduction: [Docs](https://matth-x.github.io/MicroOcpp/intro-tech) | Website: [www.arduino-ocpp.com](https://www.arduino-ocpp.com)
Reference usage: [OpenEVSE](https://github.com/OpenEVSE/ESP32_WiFi_V4.x/blob/master/src/ocpp.cpp) | Technical introduction: [Docs](https://matth-x.github.io/MicroOcpp/intro-tech) | Website: [www.micro-ocpp.com](https://www.micro-ocpp.com)

:heavy_check_mark: Works with [SteVe](https://github.com/RWTH-i5-IDSG/steve) and [15+ commercial Central Systems](https://www.arduino-ocpp.com/#h.314525e8447cc93c_81)
:heavy_check_mark: Works with [SteVe](https://github.com/RWTH-i5-IDSG/steve) and [15+ commercial Central Systems](https://www.micro-ocpp.com/#h.314525e8447cc93c_81)

:heavy_check_mark: Eligible for public chargers (Eichrecht-compliant)

Expand All @@ -22,7 +22,7 @@ Reference usage: [OpenEVSE](https://github.com/OpenEVSE/ESP32_WiFi_V4.x/blob/mas

(Beta) The Simulator is a demo & development tool for MicroOcpp which allows to quickly assess the compatibility with different OCPP backends. It simulates a full charging station, adds a GUI and a mocked hardware binding to MicroOcpp and runs in the browser (using WebAssembly): [Try it](https://demo.micro-ocpp.com/)

[![Screenshot](https://github.com/agruenb/arduino-ocpp-dashboard/blob/master/docs/img/status_page.png)](https://demo.micro-ocpp.com/)
<div align="center"><img src="https://github.com/matth-x/MicroOcpp/assets/63792403/27f2819b-41fd-41a7-88a8-9e673b8a88b8" alt="Screenshot" width="800em" href="https://demo.micro-ocpp.com/"></div>

#### Usage

Expand All @@ -32,6 +32,23 @@ If you don't have an OCPP server at hand, leave the charge box ID blank and ente

**RFID authentication**: Go to "Control Center" > "Connectors" > "Transaction" and update the idTag with the desired value.

## Benchmarks

*Full report: [MicroOcpp benchmark (esp-idf)](https://github.com/matth-x/MicroOcpp-benchmark)*

The following measurements were taken on the ESP32 @ 160MHz and represent the optimistic best case scenario for a charger with two physical connectors (i.e. compiled with `-Os`, disabled debug output and logs).

| Description | Value |
| :--- | ---: |
| Flash size (minimal) | 121,170 B |
| Heap occupation (idle) | 12,308 B |
| Heap occupation (peak) | 21,916 B |
| Initailization | 21 ms |
| `loop()` call (idle) | 0.05 ms |
| Large message sent | 5 ms |

In practical setups, the execution time is largely determined by IO delays and the heap occupation is significantly influenced by the configuration with reservation, local authorization and charging profile lists.

## Developers guide

PlatformIO package: [ArduinoOcpp](https://platformio.org/lib/show/11975/ArduinoOcpp)
Expand Down Expand Up @@ -62,9 +79,9 @@ MicroOcpp is a good foundation for starting the OCPP 2.0.1 development:

:hammer: Comes with development tools and a CI/CD specialized for OCPP

:man_teacher: Academic background: started as a research project, evolved into enterprise software
:man_teacher: Academic background: roots in a research project

:closed_lock_with_key: Unit tests with valgrind, [AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer) and [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html)
:closed_lock_with_key: Unit tests with valgrind, AddressSanitizer and UndefinedBehaviorSanitizer

:heart: Contributions are highly welcome. Open to building a team

Expand Down
11 changes: 8 additions & 3 deletions src/MicroOcpp/Core/FilesystemAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,13 @@ std::shared_ptr<FilesystemAdapter> makeDefaultFilesystemAdapter(FilesystemOpt co

#include <sys/stat.h>
#include <dirent.h>
#include <string.h>
#include "esp_spiffs.h"

#ifndef MO_PARTITION_LABEL
#define MO_PARTITION_LABEL "mo"
#endif

namespace MicroOcpp {

class EspIdfFileAdapter : public FileAdapter {
Expand Down Expand Up @@ -265,7 +270,7 @@ class EspIdfFilesystemAdapter : public FilesystemAdapter {

~EspIdfFilesystemAdapter() {
if (config.mustMount()) {
esp_vfs_spiffs_unregister("mo"); //partition label
esp_vfs_spiffs_unregister(MO_PARTITION_LABEL); //partition label
MO_DBG_DEBUG("SPIFFS unmounted");
}
}
Expand Down Expand Up @@ -355,8 +360,8 @@ std::shared_ptr<FilesystemAdapter> makeDefaultFilesystemAdapter(FilesystemOpt co
}

esp_vfs_spiffs_conf_t conf = {
.base_path = fn_prefix,
.partition_label = "mo", //also see deconstructor
.base_path = (MO_FILENAME_PREFIX[0] == '/' && MO_FILENAME_PREFIX[1] == '\0') ? MO_FILENAME_PREFIX : (MO_FILENAME_PREFIX[strlen(MO_FILENAME_PREFIX) - 1] == '/' ? strndup(MO_FILENAME_PREFIX, strlen(MO_FILENAME_PREFIX) - 1) : MO_FILENAME_PREFIX),
.partition_label = MO_PARTITION_LABEL, //also see deconstructor
.max_files = 5,
.format_if_mount_failed = config.formatOnFail()
};
Expand Down
4 changes: 4 additions & 0 deletions src/MicroOcpp/Core/FilesystemAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#define MO_FILENAME_PREFIX "/"
#endif

#ifndef MOCPP_PARTITION_LABEL
#define MOCPP_PARTITION_LABEL "mo"
#endif

#define DISABLE_FS 0
#define ARDUINO_LITTLEFS 1
#define ARDUINO_SPIFFS 2
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Model/FirmwareManagement/FirmwareService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ void FirmwareService::loop() {

timestampTransition = mocpp_tick_ms();
delayTransition = 10000;
return;
}
return;
} else {
//if client doesn't report download state, assume download to be finished (at least 30s download time have passed until here)
if (downloadStatusInput == nullptr) {
Expand Down

0 comments on commit c502d9e

Please sign in to comment.