Merge remote-tracking branch 'origin/v3.4' into dev

This commit is contained in:
proddy
2022-01-23 17:56:52 +01:00
parent 02e2b51814
commit 77e1898512
538 changed files with 32282 additions and 38655 deletions

31
scripts/api_test.http Normal file
View File

@@ -0,0 +1,31 @@
# testing EMS-ESP API
# use with https://marketplace.visualstudio.com/items?itemName=humao.rest-client
@token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.2bHpWya2C7Q12WjNUBD6_7N3RCD7CMl-EGhyQVzFdDg
GET http://ems-esp.local/api/system/info
###
GET http://ems-esp.local/api/thermostat/seltemp
###
POST http://ems-esp.local/api/thermostat/seltemp
Content-Type: application/json
Authorization: Bearer {{token}}
{
"value" : 21.0
}
###
POST http://ems-esp.local/api/thermostat
Content-Type: application/json
Authorization: Bearer {{token}}
{
"entity" : "seltemp",
"value" : 21.0
}

Binary file not shown.

24
scripts/build_interface.py Executable file → Normal file
View File

@@ -1,11 +1,17 @@
from pathlib import Path
from shutil import copytree
from shutil import rmtree
from shutil import copytree, rmtree, copyfileobj
from subprocess import check_output, Popen, PIPE, STDOUT, CalledProcessError
from os import chdir
import os
import gzip
Import("env")
def gzipFile(file):
with open(file, 'rb') as f_in:
with gzip.open(file + '.gz', 'wb') as f_out:
copyfileobj(f_in, f_out)
os.remove(file)
def flagExists(flag):
buildFlags = env.ParseFlags(env["BUILD_FLAGS"])
for define in buildFlags.get("CPPDEFINES"):
@@ -13,7 +19,7 @@ def flagExists(flag):
return True
def buildWeb():
chdir("interface")
os.chdir("interface")
print("Building interface with npm")
try:
env.Execute("npm install")
@@ -22,10 +28,16 @@ def buildWeb():
wwwPath = Path("../data/www")
if wwwPath.exists() and wwwPath.is_dir():
rmtree(wwwPath)
if not flagExists("PROGMEM_WWW"):
print("Copying interface to data directory")
copytree(buildPath, wwwPath)
for currentpath, folders, files in os.walk(wwwPath):
for file in files:
gzipFile(os.path.join(currentpath, file))
finally:
chdir("..")
os.chdir("..")
if (len(BUILD_TARGETS) == 0 or "upload" in BUILD_TARGETS):
buildWeb()
else:
print("Skipping build interface step for target(s): " + ", ".join(BUILD_TARGETS))
print("Skipping build interface step for target(s): " + ", ".join(BUILD_TARGETS))

0
scripts/clang-format.py Executable file → Normal file
View File

0
scripts/clang-tidy.py Executable file → Normal file
View File

0
scripts/espota.py Executable file → Normal file
View File

0
scripts/esptool.py Executable file → Normal file
View File

0
scripts/helpers.py Executable file → Normal file
View File

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env python
Import("env")
class Color(object):
BLACK = '\x1b[1;30m'
RED = '\x1b[1;31m'
GREEN = '\x1b[1;32m'
YELLOW = '\x1b[1;33m'
BLUE = '\x1b[1;34m'
MAGENTA = '\x1b[1;35m'
CYAN = '\x1b[1;36m'
WHITE = '\x1b[1;37m'
LIGHT_GREY = '\x1b[0;30m'
LIGHT_RED = '\x1b[0;31m'
LIGHT_GREEN = '\x1b[0;32m'
LIGHT_YELLOW = '\x1b[0;33m'
LIGHT_BLUE = '\x1b[0;34m'
LIGHT_MAGENTA = '\x1b[0;35m'
LIGHT_CYAN = '\x1b[0;36m'
LIGHT_WHITE = '\x1b[0;37m'
def clr(color, text):
return color + str(text) + '\x1b[0m'
def remove_float_support():
flags = " ".join(env['LINKFLAGS'])
# print(clr(Color.BLUE, "LINKFLAGS = %ss" % flags))
flags = flags.replace("-u _printf_float", "")
flags = flags.replace("-u _scanf_float", "")
newflags = flags.split()
env.Replace(
LINKFLAGS=newflags
)
remove_float_support()

0
scripts/rename_fw.py Executable file → Normal file
View File

0
scripts/upload_esp32.py Executable file → Normal file
View File

View File

@@ -1,18 +0,0 @@
# for calling dos upload from Window WSL2 Linux, because serial ports are not mapped yet
Import('env', "projenv")
from subprocess import call
def upload(source, target, env):
print("bin file: " + str(target[0]))
# esp8266 or esp32
platform = "esp" + env['PIOPLATFORM'].strip("espressif")
if platform == 'esp8266':
call(["cmd.exe", "/c", "C:\\Users\\Paul\\Desktop\\ems-esp8266.bat"])
if platform == 'esp32':
call(["cmd.exe", "/c", "C:\\Users\\Paul\\Desktop\\ems-esp32.bat"])
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [upload])