Skip to content

Commit

Permalink
Merge pull request #207 from OpenEVSE/espidf4
Browse files Browse the repository at this point in the history
Platform IO ESP32 core 4.4
  • Loading branch information
glynhudson authored Jun 22, 2022
2 parents 139d881 + 917734b commit 4aa9d89
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 1,495 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Build/Release OpenEVSE

on:
Expand All @@ -17,6 +19,7 @@ jobs:
env:
- openevse_nodemcu-32s
- openevse_esp-wrover-kit
- openevse_esp-wrover-kit_latest
- openevse_huzzah32_dev
- openevse_huzzah32
- openevse_featheresp32
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,3 @@ lib/StreamSpy
lib/MicroTasks

*.bin

165 changes: 64 additions & 101 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ debug_flags =
#-D ENABLE_PROFILE
src_build_flags =
# -D ARDUINOJSON_USE_LONG_LONG
# -D ENABLE_ASYNC_WIFI_SCAN
# -D ENABLE_ASYNC_WIFI_SCAN
build_flags =
-D ESP32
-D CS_PLATFORM=CS_P_ESP32
-D MG_ENABLE_SSL=1
-D MG_ENABLE_HTTP_STREAMING_MULTIPART=1
Expand All @@ -77,6 +78,7 @@ build_flags =
#-D CS_ENABLE_DEBUG
#-D MBEDTLS_DEBUG_C
-D MG_ENABLE_SNTP=1
#-D ENABLE_DEBUG_MICROTASKS
-D CS_PLATFORM=CS_P_ESP32
-D AO_CUSTOM_WS ; ArduinoOcpp: don't use built-in WS library
-D AO_CUSTOM_CONSOLE ; ArduinoOcpp: use custom debug out
Expand All @@ -85,48 +87,57 @@ build_flags =
#-D ENABLE_DEBUG_MONGOOSE_HTTP_CLIENT
-D RAPI_MAX_COMMANDS=20
-D BUILD_ENV_NAME="$PIOENV"
-D ARDUINO_ARCH_ESP32
-D USE_ESP32
-D USE_ESP32_FRAMEWORK_ARDUINO
build_partitions = min_spiffs.csv
monitor_flags = --filter=esp32_exception_decoder

neopixel_lib = adafruit/Adafruit NeoPixel@1.7.0


[env]
# specify exact Arduino ESP SDK version, requires platformio 3.5+ (curently dev version)
# http://docs.platformio.org/en/latest/projectconf/section_env_general.html#platform
#platform = https://github.com/platformio/platform-espressif32.git#feature/stage
#platform = https://github.com/platformio/platform-espressif32.git#develop
platform = espressif32@1.11.1
#platform = espressif32

[env:openevse_nodemcu-32s]
platform = ${common.platform}
board = nodemcu-32s
framework = arduino, espidf
#platform = espressif32@1.11.1
platform = espressif32@4.4.0
#framework = arduino, espidf
framework = arduino
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
src_build_flags =
${common.version}.dev
${common.src_build_flags}
${common.debug_flags}
-D WIFI_LED=2
-D WIFI_LED_ON_STATE=LOW
-D RAPI_PORT=Serial2
build_flags =
${common.build_flags}
#upload_port = openevse.local
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}
#platform_packages =
# ; use a special branch
# framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
# platformio/framework-arduinoespressif32 @ ~3.10006.0
monitor_flags =
--filter=esp32_exception_decoder

[env:openevse_nodemcu-32s]
board = nodemcu-32s
build_flags =
${common.build_flags}
${common.version}.dev
${common.src_build_flags}
${common.debug_flags}
-D WIFI_LED=2
-D WIFI_LED_ON_STATE=LOW
-D RAPI_PORT=Serial2

[env:openevse_esp-wrover-kit]
platform = ${common.platform}
board = esp-wrover-kit
framework = arduino, espidf
lib_deps =
${common.lib_deps}
${common.neopixel_lib}
lib_ignore = ${common.lib_ignore}
src_build_flags =
build_flags =
${common.build_flags}
${common.version}.dev
${common.src_build_flags}
${common.debug_flags}
Expand All @@ -138,30 +149,26 @@ src_build_flags =
-D RED_LED=0
-D GREEN_LED=2
-D BLUE_LED=4
build_flags =
${common.build_flags}
-D RX1=25
-D TX1=27
-ggdb
#upload_port = openevse.local
#upload_protocol = espota
upload_speed = 2000000
#upload_protocol = ftdi
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}
lib_extra_dirs = lib

# export PLATFORMIO_UPLOAD_PORT=172.16.0.157
# export PLATFORMIO_UPLOAD_FLAGS="-p 3232"


[env:openevse_esp-wrover-kit_latest]
extends = env:openevse_esp-wrover-kit
platform = espressif32

[env:openevse_huzzah32_dev]
platform = ${common.platform}
board = featheresp32
framework = arduino, espidf
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
src_build_flags =
build_flags =
${common.version}.dev
${common.build_flags}
${common.src_build_flags}
${common.debug_flags}
-D WIFI_LED=13
Expand All @@ -170,21 +177,11 @@ src_build_flags =
-D WIFI_BUTTON_PRESSED_STATE=LOW
-D RAPI_PORT=Serial
-D DEBUG_PORT=Serial2
-D SERIAL_RX_PULLUP_PIN=3
build_flags =
${common.build_flags}
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}

[env:openevse_huzzah32]
platform = ${common.platform}
board = featheresp32
framework = arduino, espidf
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
src_build_flags =
build_flags =
${common.build_flags}
${common.version}
${common.src_build_flags}
-D WIFI_LED=13
Expand All @@ -193,46 +190,27 @@ src_build_flags =
-D WIFI_BUTTON_PRESSED_STATE=LOW
-D RAPI_PORT=Serial
-D DEBUG_PORT=Serial2
-D SERIAL_RX_PULLUP_PIN=3
build_flags =
${common.build_flags}
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}

[env:openevse_featheresp32]
platform = ${common.platform}
board = featheresp32
framework = arduino, espidf
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
src_build_flags =
build_flags =
${common.build_flags}
${common.version}.dev
${common.src_build_flags}
${common.debug_flags}
-D WIFI_LED=LED_BUILTIN
-D WIFI_BUTTON=LED_BUILTIN
-D RAPI_PORT=Serial2
-D ENABLE_DEBUG_LED
build_flags =
${common.build_flags}
#upload_port = openevse.local
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}

[env:openevse_wifi_v1]
platform = ${common.platform}
board = esp32dev
framework = arduino, espidf
lib_deps =
${common.lib_deps}
${common.neopixel_lib}
adafruit/Adafruit MCP9808 Library @ 1.1.2
lib_ignore = ${common.lib_ignore}
src_build_flags =
build_flags =
${common.build_flags}
${common.version}
${common.src_build_flags}
${common.debug_flags}
Expand All @@ -243,27 +221,18 @@ src_build_flags =
-D WIFI_BUTTON_PRESSED_STATE=LOW
-D RAPI_PORT=Serial
-D DEBUG_PORT=Serial1
-D SERIAL_RX_PULLUP_PIN=3
-D I2C_SDA=21
-D I2C_SCL=22
-D ENABLE_MCP9808
-D ENABLE_PN532
build_flags =
${common.build_flags}
-D TX1=16
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}
upload_command = curl -F firmware=@$SOURCE http://$UPLOAD_PORT/update --progress-bar | cat

[env:openevse_esp32-gateway]
#For hardware older than RevE
platform = ${common.platform}
board = esp32-gateway
framework = arduino, espidf
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
src_build_flags =
build_flags =
${common.build_flags}
${common.version}
${common.src_build_flags}
-D WIFI_LED=33
Expand All @@ -274,46 +243,40 @@ src_build_flags =
-D RAPI_PORT=Serial2
-D ENABLE_WIRED_ETHERNET
-D RANDOM_SEED_CHANNEL=1
build_flags =
${common.build_flags}
upload_speed = 115200
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
# https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/ETH_LAN8720/ETH_LAN8720.ino
board_build.partitions = ${common.build_partitions}

[env:openevse_esp32-gateway-e]
# Tested working with hardware RevE and RevF
#https://github.com/OpenEVSE/ESP32_WiFi_V3.x/blob/master/docs/wired-ethernet.md
extends = env:openevse_esp32-gateway
framework = arduino, espidf
build_flags =
${common.build_flags}
${common.version}
${common.src_build_flags}
-D WIFI_LED=33
-D WIFI_LED_ON_STATE=HIGH
-D WIFI_BUTTON=34
-D WIFI_BUTTON_PRESSED_STATE=LOW
-D DEBUG_PORT=Serial
-D RAPI_PORT=Serial2
-D ENABLE_WIRED_ETHERNET
-D RANDOM_SEED_CHANNEL=1
-D RX2=16
-D TX2=32
board_build.extra_flags = "-DARDUINO_ESP32_GATEWAY=\'E\'"
upload_speed = 921600

[env:openevse_esp32-heltec-wifi-lora-v2]
platform = ${common.platform}
board = heltec_wifi_lora_32_V2
framework = arduino, espidf
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
src_build_flags =
${common.version}.dev
build_flags =
${common.build_flags}
${common.src_build_flags}
${common.version}.dev
-D DEBUG_PORT=Serial
-D WIFI_LED=25
-D WIFI_BUTTON=2
-D WIFI_LED_ON_STATE=HIGH
-D WIFI_BUTTON=2
-D WIFI_BUTTON_PRESSED_STATE=LOW
-D RAPI_PORT=Serial1
build_flags =
${common.build_flags}
-D RX1=25
-D TX1=27
#upload_port = openevse.local
#upload_speed = 921600
upload_protocol = esptool
monitor_speed = 115200
extra_scripts = ${common.extra_scripts}
board_build.partitions = ${common.build_partitions}
1 change: 1 addition & 0 deletions src/evse_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ EvseMonitor::EvseMonitor(OpenEVSEClass &openevse) :
_session_complete(EVSE_MONITOR_SESSION_COMPLETE_MASK, EVSE_MONITOR_SESSION_COMPLETE_TRIGGER),
_count(0),
_heartbeat(false),
_firmware_version(""),
#ifdef ENABLE_MCP9808
_mcp9808(),
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "openevse.h"
#include "input.h"
#include "app_config.h"
#include <time.h>
#include <sys/time.h>

static void IGNORE(int ret) {
}
Expand Down
9 changes: 3 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ loop() {
ota_loop();
rapiSender.loop();
divert_current_loop();

Profile_Start(MicroTask);
MicroTask.update();
Profile_End(MicroTask, 10);

if(OpenEVSE.isConnected())
{
Expand Down Expand Up @@ -262,12 +265,6 @@ void event_send(JsonDocument &event)
void hardware_setup()
{
debug_setup();

#ifdef SERIAL_RX_PULLUP_PIN
// https://forums.adafruit.com/viewtopic.php?f=57&t=153553&p=759890&hilit=esp32+serial+pullup#p769168
pinMode(SERIAL_RX_PULLUP_PIN, INPUT_PULLUP);
#endif

enableLoopWDT();
}

Expand Down
Loading

0 comments on commit 4aa9d89

Please sign in to comment.