1
0
Fork 0
mirror of https://github.com/lumapu/ahoy.git synced 2025-05-28 00:06:12 +02:00

* pinout can be saved using the web setup

* html / css files are now located inside PROGMEM
* conversion of files is done with python script (OS independent, open source)
* moved as much as possible for now to the hm* modules - the app should only be the body
* successfully tested with HM1200
This commit is contained in:
lumapu 2022-04-25 17:48:12 +02:00
parent a95069e65c
commit d195eee498
16 changed files with 240 additions and 215 deletions
tools/esp8266/html

View file

@ -0,0 +1,28 @@
import re
def convert2Header(inFile):
outName = "h/" + inFile.replace(".", "_") + ".h"
fileType = inFile.split(".")[1]
f = open(inFile, "r")
data = f.read().replace('\n', '')
f.close()
if fileType == "html":
data = re.sub(r"\>\s+\<", '><', data) # whitespaces between xml tags
data = re.sub(r"(\;|\}|\>|\{)\s+", r'\1', data) # whitespaces inner javascript
data = re.sub(r"\"", '\\\"', data) # escape quotation marks
else:
data = re.sub(r"(\;|\}|\:|\{)\s+", r'\1', data) # whitespaces inner css
define = inFile.split(".")[0].upper()
f = open(outName, "w")
f.write("#ifndef __{}_H__\n".format(define))
f.write("#define __{}_H__\n".format(define))
f.write("const char {}[] PROGMEM = \"{}\";\n".format(inFile.replace(".", "_"), data))
f.write("#endif /*__{}_H__*/\n".format(define))
f.close()
convert2Header("index.html")
convert2Header("setup.html")
convert2Header("hoymiles.html")
convert2Header("style.css")