From aca98b6911c22d667ef6a5bb7184dba7dd51ff5c Mon Sep 17 00:00:00 2001 From: lumapu Date: Thu, 11 Aug 2022 23:01:44 +0200 Subject: [PATCH] * style update (margins) * automatically convert html files to header file during build --- tools/esp8266/html/convert.py | 19 ++++++++++++++----- tools/esp8266/html/h/style_css.h | 2 +- tools/esp8266/html/style.css | 5 +++-- tools/esp8266/platformio.ini | 4 +++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tools/esp8266/html/convert.py b/tools/esp8266/html/convert.py index 8171b69e..4cbecb20 100755 --- a/tools/esp8266/html/convert.py +++ b/tools/esp8266/html/convert.py @@ -1,8 +1,19 @@ import re +import sys +import os def convert2Header(inFile): - outName = "h/" + inFile.replace(".", "_") + ".h" - fileType = inFile.split(".")[1] + fileType = inFile.split(".")[1] + define = inFile.split(".")[0].upper() + define2 = inFile.split(".")[1].upper() + inFileVarName = inFile.replace(".", "_") + + if os.getcwd()[-4:] != "html": + print("ok") + outName = "html/" + "h/" + inFileVarName + ".h" + inFile = "html/" + inFile + else: + outName = "h/" + inFileVarName + ".h" f = open(inFile, "r") data = f.read().replace('\n', '') @@ -14,12 +25,10 @@ def convert2Header(inFile): else: data = re.sub(r"(\;|\}|\:|\{)\s+", r'\1', data) # whitespaces inner css - define = inFile.split(".")[0].upper() - define2 = inFile.split(".")[1].upper() f = open(outName, "w") f.write("#ifndef __{}_{}_H__\n".format(define, define2)) f.write("#define __{}_{}_H__\n".format(define, define2)) - f.write("const char {}[] PROGMEM = \"{}\";\n".format(inFile.replace(".", "_"), data)) + f.write("const char {}[] PROGMEM = \"{}\";\n".format(inFileVarName, data)) f.write("#endif /*__{}_{}_H__*/\n".format(define, define2)) f.close() diff --git a/tools/esp8266/html/h/style_css.h b/tools/esp8266/html/h/style_css.h index ce458e7c..b7fec0cf 100644 --- a/tools/esp8266/html/h/style_css.h +++ b/tools/esp8266/html/h/style_css.h @@ -1,4 +1,4 @@ #ifndef __STYLE_CSS_H__ #define __STYLE_CSS_H__ -const char style_css[] PROGMEM = "h1 {margin:0;padding:20pt;font-size:22pt;color:#fff;background-color:#006ec0;display:block;text-transform:uppercase;}html, body {font-family:Arial;margin:0;padding:0;}p {text-align:justify;font-size:13pt;}p.lic, p.lic a {font-size:8pt;color:#999;}.des {margin-top:20px;font-size:13pt;color:#006ec0;}.s_active, .s_collapsible:hover {background-color:#006ec0;}.s_content {padding:0 18px;display:none;overflow:hidden;background-color:#fff;}.s_collapsible {background-color:#044e86;color:white;cursor:pointer;padding:18px;width:100%;border:none;text-align:left;outline:none;font-size:15px;}.subdes {font-size:12pt;color:#006ec0;margin-left:7px;}.subsubdes {font-size:12pt;color:#006ec0;margin:0 0 7px 12px;}.hide {display:none;}a:link, a:visited {text-decoration:none;font-size:13pt;color:#006ec0;}a:hover, a:focus {color:#f00;}a.erase {background-color:#006ec0;color:#fff;padding:7px;display:inline-block;margin-top:30px;float:right;}#content {padding:15px 15px 60px 15px;}#footer {position:fixed;bottom:0px;height:45px;background-color:#006ec0;width:100%;border-top:5px solid #fff;}#footer p, #footer a {color:#fff;padding:0 7px 0 7px;font-size:10pt !important;}div.content {background-color:#fff;padding-bottom:65px;overflow:auto;}input, select {padding:7px;font-size:13pt;}input.text, select {width:70%;box-sizing:border-box;margin-bottom:10px;border:1px solid #ccc;}input.sh {max-width:150px !important;margin-right:10px;}input.btn {background-color:#006ec0;color:#fff;border:0px;float:right;margin:10px 0 30px;text-transform:uppercase;}input.cb {margin-bottom:20px;}label {width:20%;display:inline-block;font-size:12pt;padding-right:10px;margin-left:15px;}.left {float:left;}.right {float:right;}div.ch-iv {width:100%;background-color:#32b004;display:inline-block;margin-bottom:15px;padding-bottom:20px;overflow:auto;}div.ch {width:220px;min-height:350px;background-color:#006ec0;display:inline-block;margin:0 10px 15px 10px;overflow:auto;padding-bottom:20px;}div.ch .value, div.ch .info, div.ch .head, div.ch-iv .value, div.ch-iv .info, div.ch-iv .head {color:#fff;display:block;width:100%;text-align:center;}.subgrp {float:left;width:220px;}div.ch .unit, div.ch-iv .unit {font-size:19px;margin-left:10px;}div.ch .value, div.ch-iv .value {margin-top:20px;font-size:24px;}div.ch .info, div.ch-iv .info {margin-top:3px;font-size:10px;}div.ch .head {background-color:#003c80;padding:10px 0 10px 0;}div.ch-iv .head {background-color:#1c6800;padding:10px 0 10px 0;}div.iv {max-width:960px;margin-bottom:40px;}div.ts {font-size:13px;background-color:#ddd;border-top:7px solid #999;padding:7px;}#note {margin:50px 10px 10px 10px;padding-top:10px;width:100%;border-top:1px solid #bbb;}@media(max-width:500px) {div.ch .unit, div.ch-iv .unit {font-size:18px;}div.ch {width:170px;min-height:100px }.subgrp {width:180px;}}"; +const char style_css[] PROGMEM = "h1 {margin:0;padding:20pt;font-size:22pt;color:#fff;background-color:#006ec0;display:block;text-transform:uppercase;}html, body {font-family:Arial;margin:0;padding:0;}p {text-align:justify;font-size:13pt;}p.lic, p.lic a {font-size:8pt;color:#999;}.des {margin-top:20px;font-size:13pt;color:#006ec0;}.s_active, .s_collapsible:hover {background-color:#006ec0;}.s_content {display:none;overflow:hidden;margin-bottom:20px;}.s_collapsible {background-color:#044e86;color:white;cursor:pointer;padding:18px;width:100%;border:none;text-align:left;outline:none;font-size:15px;margin-bottom:4px;}.subdes {font-size:12pt;color:#006ec0;margin-left:7px;}.subsubdes {font-size:12pt;color:#006ec0;margin:0 0 7px 12px;}.hide {display:none;}a:link, a:visited {text-decoration:none;font-size:13pt;color:#006ec0;}a:hover, a:focus {color:#f00;}a.erase {background-color:#006ec0;color:#fff;padding:7px;display:inline-block;margin-top:30px;float:right;}#content {padding:15px 15px 60px 15px;}#footer {position:fixed;bottom:0px;height:45px;background-color:#006ec0;width:100%;border-top:5px solid #fff;}#footer p, #footer a {color:#fff;padding:0 7px 0 7px;font-size:10pt !important;}div.content {background-color:#fff;padding-bottom:65px;overflow:auto;}input, select {padding:7px;font-size:13pt;}input.text, select {width:70%;box-sizing:border-box;margin-bottom:10px;border:1px solid #ccc;}input.sh {max-width:150px !important;margin-right:10px;}input.btn {background-color:#006ec0;color:#fff;border:0px;float:right;margin:10px 0 30px;text-transform:uppercase;}input.cb {margin-bottom:20px;}label {width:20%;display:inline-block;font-size:12pt;padding-right:10px;margin-left:15px;}.left {float:left;}.right {float:right;}div.ch-iv {width:100%;background-color:#32b004;display:inline-block;margin-bottom:15px;padding-bottom:20px;overflow:auto;}div.ch {width:220px;min-height:350px;background-color:#006ec0;display:inline-block;margin:0 10px 15px 10px;overflow:auto;padding-bottom:20px;}div.ch .value, div.ch .info, div.ch .head, div.ch-iv .value, div.ch-iv .info, div.ch-iv .head {color:#fff;display:block;width:100%;text-align:center;}.subgrp {float:left;width:220px;}div.ch .unit, div.ch-iv .unit {font-size:19px;margin-left:10px;}div.ch .value, div.ch-iv .value {margin-top:20px;font-size:24px;}div.ch .info, div.ch-iv .info {margin-top:3px;font-size:10px;}div.ch .head {background-color:#003c80;padding:10px 0 10px 0;}div.ch-iv .head {background-color:#1c6800;padding:10px 0 10px 0;}div.iv {max-width:960px;margin-bottom:40px;}div.ts {font-size:13px;background-color:#ddd;border-top:7px solid #999;padding:7px;}#note {margin:50px 10px 10px 10px;padding-top:10px;width:100%;border-top:1px solid #bbb;}@media(max-width:500px) {div.ch .unit, div.ch-iv .unit {font-size:18px;}div.ch {width:170px;min-height:100px }.subgrp {width:180px;}}"; #endif /*__STYLE_CSS_H__*/ diff --git a/tools/esp8266/html/style.css b/tools/esp8266/html/style.css index 69d60b15..6de836e8 100644 --- a/tools/esp8266/html/style.css +++ b/tools/esp8266/html/style.css @@ -35,10 +35,10 @@ p.lic, p.lic a { } .s_content { - padding: 0 18px; display: none; overflow: hidden; - background-color: #fff; + margin-bottom: 20px; + } .s_collapsible { @@ -51,6 +51,7 @@ p.lic, p.lic a { text-align: left; outline: none; font-size: 15px; + margin-bottom: 4px; } .subdes { diff --git a/tools/esp8266/platformio.ini b/tools/esp8266/platformio.ini index ecfe4748..973ed7de 100644 --- a/tools/esp8266/platformio.ini +++ b/tools/esp8266/platformio.ini @@ -34,6 +34,7 @@ monitor_filters = extra_scripts = pre:scripts/auto_firmware_version.py + pre:html/convert.py lib_deps = nrf24/RF24@1.4.5 @@ -72,6 +73,7 @@ upload_port = /dev/ttyUSB0 extra_scripts = pre:scripts/auto_firmware_version.py + pre:html/convert.py html/ lib_deps = nrf24/RF24@1.4.5 @@ -84,4 +86,4 @@ lib_deps = ;esp8266/ESP8266WebServer@^1.0 ;esp8266/ESP8266WiFi@^1.0 ;esp8266/SPI@1.0 - ;esp8266/Ticker@^1.0 \ No newline at end of file + ;esp8266/Ticker@^1.0