move html location

This commit is contained in:
Siwat Sirichai 2024-01-02 13:22:00 +07:00
parent 74c37e3747
commit a9cde5ac54
6 changed files with 9 additions and 9 deletions

View File

@ -34,11 +34,11 @@ for html_file in html_files:
# Use xxd to convert the html file to a C++ file
# The C++ file will have the same name as the original file but with a .h extension
# Save the C++ file in lib/ESPMegaPRO/html
os.system("xxd -i temp/" + os.path.basename(html_file) + " > lib/ESPMegaPRO/html/" + os.path.basename(html_file).replace(".html", ".h"))
os.system("xxd -i temp/" + os.path.basename(html_file) + " > lib/ESPMegaPRO/" + os.path.basename(html_file).replace(".html", "_html.h"))
# Now delete the temp file
os.remove("temp/" + os.path.basename(html_file))
# Next we open the C++ file
f = open("lib/ESPMegaPRO/html/" + os.path.basename(html_file).replace(".html", ".h"), "r")
f = open("lib/ESPMegaPRO/" + os.path.basename(html_file).replace(".html", "_html.h"), "r")
# Read the content of the C++ file
cpp_content = f.read()
# Close the C++ file
@ -59,7 +59,7 @@ for html_file in html_files:
filename = os.path.basename(html_file).replace(".html", "")
cpp_content = re.sub(r"const char (.*?)\[\] PROGMEM = {", r"const char " + filename + r"_html[] PROGMEM = {", cpp_content)
# Reopen the C++ file
f = open("lib/ESPMegaPRO/html/" + os.path.basename(html_file).replace(".html", ".h"), "w")
f = open("lib/ESPMegaPRO/" + os.path.basename(html_file).replace(".html", "_html.h"), "w")
# Write the new content to the C++ file
f.write(cpp_content)
# Close the C++ file
@ -67,10 +67,10 @@ for html_file in html_files:
# Lastly, we need to create a header file that includes all the html files
# Open the header file
f = open("lib/ESPMegaPRO/html/all.h", "w")
f = open("lib/ESPMegaPRO/all_html.h", "w")
# Write the pragma once directive
f.write("#pragma once\n")
# Write the includes for all the html files
for html_file in html_files:
f.write("#include \"" + os.path.basename(html_file).replace(".html", ".h") + "\"\n")
f.write("#include \"" + os.path.basename(html_file).replace(".html", "_html.h") + "\"\n")
# Close the header file

View File

@ -6,7 +6,7 @@
#include <FRAM.h>
#include <ArduinoJson.h>
#include <AsyncJson.h>
#include <html/all.h>
#include <all_html.h>
/**

View File

@ -0,0 +1,3 @@
#pragma once
#include "config_html.h"
#include "ota_html.h"

View File

@ -1,3 +0,0 @@
#pragma once
#include "config.h"
#include "ota.h"