Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/openevse/espidf4' into mqtt_isp…
Browse files Browse the repository at this point in the history
…edfv4
  • Loading branch information
KipK committed Jun 6, 2022
2 parents 7f62a9a + 1a44fec commit 0e209cd
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 1,442 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,3 @@ lib/StreamSpy
lib/MicroTasks

*.bin

/%SystemDrive%
156 changes: 58 additions & 98 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 [email protected]


[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 = [email protected]
#platform = espressif32

[env:openevse_nodemcu-32s]
platform = ${common.platform}
board = nodemcu-32s
framework = arduino, espidf
#platform = [email protected]
platform = [email protected]
#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,21 @@ 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_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 @@ -171,20 +173,11 @@ src_build_flags =
-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 @@ -194,45 +187,27 @@ src_build_flags =
-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 @@ -248,22 +223,13 @@ src_build_flags =
-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}

[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 +240,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
3 changes: 3 additions & 0 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
2 changes: 1 addition & 1 deletion src/net_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ net_loop()
dnsServer.processNextRequest(); // Captive portal DNS re-dierct
}

Profile_End(net_wifi_loop, 5);
Profile_End(net_loop, 5);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/ota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void ota_setup()
// Clean SPIFFS
//SPIFFS.end();
DBUGF("Starting ArduinoOTA update");
lcd.display(F("Updating WiFi"), 0, 0, 0, LCD_CLEAR_LINE);
lcd.display(F("Updating WiFi"), 0, 0, 10, LCD_CLEAR_LINE | LCD_DISPLAY_NOW);
lcd.display(F(""), 0, 1, 10 * 1000, LCD_CLEAR_LINE | LCD_DISPLAY_NOW);
});

Expand Down
3 changes: 1 addition & 2 deletions src/profile.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef __PROFILE_H
#define __PROFILE_H

#if defined(ENABLE_PROFILE) && defined(ENABLE_DEBUG)
#if defined(ENABLE_PROFILE)

#if defined(ENABLE_NOISY_PROFILE)

#define Profile_Start(x) \
unsigned long profile ## x = millis(); \
DBUGLN(">> Start " #x)
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void Scheduler::Event::setId(uint32_t id) {

String Scheduler::Event::getTime()
{
char time[9];
char time[14];
snprintf(time, sizeof(time), "%02d:%02d:%02d", getHours(), getMinutes(), getSeconds());
String timeString(time);
return timeString;
Expand Down
Loading

0 comments on commit 0e209cd

Please sign in to comment.