Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divert mode back-port #260

Merged
merged 20 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ ubuntu-xenial-16.04-cloudimg-console.log
.vscode/*.db
.vscode/launch.json
.vscode/.browse.c_cpp.db*
lib/ConfigJson
lib/ESPAL
lib/OpenEVSE
61 changes: 43 additions & 18 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,47 @@ data_dir = src/data
default_envs = openevse

[common]
version = -DBUILD_TAG=2.8.1
version = -DBUILD_TAG=2.9.0
monitor_speed=115200
lib_deps = [email protected], ESP Async [email protected], [email protected]
lib_deps =
[email protected]
ESP Async [email protected]
[email protected]
[email protected]
Micro [email protected]
[email protected]
[email protected]
[email protected]
extra_scripts = scripts/extra_script.py
debug_flags = -DENABLE_DEBUG -DENABLE_PROFILE -DDEBUG_PORT=Serial1
ota_flags = -DENABLE_OTA -DWIFI_LED=0
debug_flags =
-DENABLE_DEBUG
# -DENABLE_DEBUG_WEB
# -DENABLE_DEBUG_RAPI
-DENABLE_PROFILE
-DDEBUG_PORT=Serial1
ota_flags =
-DENABLE_OTA
-DWIFI_LED=0
src_build_flags =
# -DENABLE_ASYNC_WIFI_SCAN

build_flags =
# -DENABLE_ASYNC_WIFI_SCAN

# 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-espressif8266.git#release/v1.6.0
platform_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage
#platform = https://github.com/platformio/platform-espressif8266.git#release/v1.6.0
platform = [email protected]
platform_stage = https://github.com/platformio/platform-espressif8266.git#develop

[env:openevse]
platform = ${common.platform}
board = esp12e
framework = arduino
lib_deps = ${common.lib_deps}
src_build_flags = ${common.version} ${common.build_flags}
build_flags = ${common.build_flags}
src_build_flags = ${common.version} ${common.src_build_flags}
# Upload at faster baud: takes 20s instead of 50s. Use 'pio run -t upload -e evse_slow to use slower default baud rate'
upload_speed=921600
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

Expand All @@ -60,7 +79,8 @@ platform = ${common.platform}
board = esp12e
framework = arduino
lib_deps = ${common.lib_deps}
src_build_flags = ${common.version} ${common.build_flags}
build_flags = ${common.build_flags}
src_build_flags = ${common.version} ${common.src_build_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

Expand All @@ -69,9 +89,10 @@ platform = ${common.platform}
board = esp12e
framework = arduino
lib_deps = ${common.lib_deps}
src_build_flags = ${common.version}.dev ${common.build_flags} ${common.ota_flags} ${common.debug_flags}
upload_protocol = espota
upload_port = openevse.local
build_flags = ${common.build_flags} ${common.debug_flags}
src_build_flags = ${common.version}.dev ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
#upload_protocol = espota
#upload_port = openevse.local
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

Expand All @@ -80,8 +101,10 @@ platform = ${common.platform}
board = esp12e
framework = arduino
lib_deps = ${common.lib_deps}
src_build_flags = ${common.version}.dev ${common.build_flags} ${common.ota_flags} ${common.debug_flags}
upload_speed=921600
build_flags = ${common.build_flags} ${common.debug_flags}
src_build_flags = ${common.version}.dev ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
# Upload at faster baud: takes 20s instead of 50s. Use 'pio run -t upload -e evse_slow to use slower default baud rate'
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

Expand All @@ -92,8 +115,9 @@ platform = ${common.platform_stage}
board = esp12e
framework = arduino
lib_deps = ${common.lib_deps}
build_flags = -DDEBUG_ESP_WIFI
src_build_flags = ${common.version}.stag ${common.build_flags} ${common.ota_flags} ${common.debug_flags}
build_flags = ${common.build_flags} ${common.debug_flags}
src_build_flags = ${common.version}.stag ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
#upload_speed = 921600
upload_protocol = espota
upload_port = openevse.local
monitor_speed = ${common.monitor_speed}
Expand All @@ -105,7 +129,8 @@ platform = ${common.platform_stage}
board = esp12e
framework = arduino
lib_deps = https://github.com/knolleary/pubsubclient, https://github.com/me-no-dev/ESPAsyncWebServer.git, https://github.com/me-no-dev/ESPAsyncTCP.git
src_build_flags = ${common.version}.stagelib ${common.build_flags} ${common.ota_flags} ${common.debug_flags}
build_flags = ${common.build_flags} ${common.debug_flags}
src_build_flags = ${common.version}.stagelib ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
upload_protocol = espota
upload_port = openevse.local
monitor_speed = ${common.monitor_speed}
Expand Down
12 changes: 7 additions & 5 deletions scripts/extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_c_name(source_file):

def text_to_header(source_file):
with open(source_file) as source_fh:
original = source_fh.read().decode('utf-8')
original = source_fh.read()
filename = get_c_name(source_file)
output = "static const char CONTENT_{}[] PROGMEM = ".format(filename)
for line in original.splitlines():
Expand All @@ -38,7 +38,7 @@ def binary_to_header(source_file):

with open(source_file, "rb") as source_fh:
byte = source_fh.read(1)
while byte != "":
while byte != b"":
output += "0x{:02x}, ".format(ord(byte))
count += 1
if 16 == count:
Expand All @@ -55,14 +55,14 @@ def data_to_header(env, target, source):
for source_file in source:
#print("Reading {}".format(source_file))
file = source_file.get_abspath()
if file.endswith(".css") or file.endswith(".js") or file.endswith(".htm") or file.endswith(".html"):
if file.endswith(".css") or file.endswith(".js") or file.endswith(".htm") or file.endswith(".html") or file.endswith(".svg"):
output += text_to_header(file)
else:
output += binary_to_header(file)
target_file = target[0].get_abspath()
print("Generating {}".format(target_file))
with open(target_file, "w") as output_file:
output_file.write(output.encode('utf-8'))
output_file.write(output)

def make_static(env, target, source):
output = ""
Expand Down Expand Up @@ -94,6 +94,8 @@ def make_static(env, target, source):
filetype = "JPEG"
elif out_file.endswith(".png"):
filetype = "PNG"
elif out_file.endswith(".svg"):
filetype = "SVG"

c_name = get_c_name(out_file)
output += " { \"/"+out_file+"\", CONTENT_"+c_name+", sizeof(CONTENT_"+c_name+") - 1, _CONTENT_TYPE_"+filetype+" },\n"
Expand All @@ -103,7 +105,7 @@ def make_static(env, target, source):
target_file = target[0].get_abspath()
print("Generating {}".format(target_file))
with open(target_file, "w") as output_file:
output_file.write(output.encode('utf-8'))
output_file.write(output)

def process_html_app(source, dest, env):
web_server_static_files = join(dest, "web_server_static_files.h")
Expand Down
Loading