diff --git a/html/.DS_Store b/html/.DS_Store
deleted file mode 100644
index 68ead17..0000000
Binary files a/html/.DS_Store and /dev/null differ
diff --git a/html/favicon.ico b/html/favicon.ico
deleted file mode 100644
index 14b7586..0000000
Binary files a/html/favicon.ico and /dev/null differ
diff --git a/html/header.html b/html/header.html
deleted file mode 100644
index 224a246..0000000
--- a/html/header.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
FilaMan
-
Filament Management Tool
-
Your smart solution for Filament Management in 3D printing.
-
-
About FilaMan
-
- FilaMan is a tool designed to simplify filament spool management. It allows you to identify and weigh filament spools,
- automatically syncing data with the FilaMan-System.
-
-
-
Get more information at https://www.filaman.app.
-
-
-
-
Spool Identification
-
Easily identify filament spools using NFC tags.
-
-
-
Automatic Syncing
-
Seamlessly update spool data with the FilaMan API for accurate tracking.
-
-
-
Scale Integration
-
Built-in scale support for precise remaining weight calculation.
-
-
-
-
-
-
-
diff --git a/html/logo.png b/html/logo.png
deleted file mode 100644
index c4adb61..0000000
Binary files a/html/logo.png and /dev/null differ
diff --git a/html/setup.html b/html/setup.html
deleted file mode 100644
index 147fcfc..0000000
--- a/html/setup.html
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
Firmware Upgrade
-
-
- Warning: Do not power off the device during update.
-
-
-
-
-
1) Firmware Update
-
Upload a new firmware file (upgrade_filaman_firmware_*.bin)
-
-
-
-
-
-
-
2) Webpage Update
-
Upload a new webpage file (upgrade_filaman_website_*.bin)
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/html/waage.html b/html/waage.html
deleted file mode 100644
index d82f435..0000000
--- a/html/waage.html
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
-
WiFi Configuration
-
Your device is connected to WiFi.
-
To change WiFi settings, you can reset the WiFi configuration by holding the hardware button (if available) or using the WiFi manager portal.
-
-
-
-
-
diff --git a/platformio.ini b/platformio.ini
index 4c33fc0..ad819e1 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -58,15 +58,11 @@ build_flags =
-DCONFIG_LWIP_TCP_MSL=60000
-DCONFIG_LWIP_TCP_RCV_BUF_DEFAULT=4096
-DCONFIG_LWIP_MAX_ACTIVE_TCP=16
+ -DCONFIG_ASYNC_TCP_RUNNING_CORE=0
+ -DCONFIG_ASYNC_TCP_USE_WDT=0
extra_scripts =
scripts/extra_script.py
- ${env:buildfs.extra_scripts}
-
-[env:buildfs]
-extra_scripts =
- pre:scripts/combine_html.py ; Combine header with HTML files
- scripts/gzip_files.py ; Compress files for SPIFFS
[platformio]
default_envs = esp32dev
diff --git a/scripts/combine_html.py b/scripts/combine_html.py
deleted file mode 100644
index def4a95..0000000
--- a/scripts/combine_html.py
+++ /dev/null
@@ -1,34 +0,0 @@
-Import("env")
-import os
-import re
-
-def combine_html_files(source, target, env):
- print("COMBINE HTML FILES")
-
- html_dir = "./html"
- header_file = os.path.join(html_dir, "header.html")
-
- # Read header content
- with open(header_file, 'r') as f:
- header_content = f.read()
-
- # Process all HTML files except header.html
- for filename in os.listdir(html_dir):
- if filename.endswith('.html') and filename != 'header.html':
- file_path = os.path.join(html_dir, filename)
-
- # Read content
- with open(file_path, 'r') as f:
- content = f.read()
-
- # Replace content between head comments with header content
- pattern = r'().*?()'
- new_content = re.sub(pattern, r'\1' + header_content + r'\2', content, flags=re.DOTALL)
-
- # Write back combined content
- with open(file_path, 'w') as f:
- f.write(new_content)
- print(f"Combined header with {filename}")
-
-# Register the script to run before building SPIFFS
-env.AddPreAction("buildfs", combine_html_files)
\ No newline at end of file
diff --git a/scripts/gzip_files.py b/scripts/gzip_files.py
deleted file mode 100644
index b67c70a..0000000
--- a/scripts/gzip_files.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import gzip
-import os
-import shutil
-
-## gzip files
-
-def compress_file(input_file, output_file):
- with open(input_file, 'rb') as f_in:
- with gzip.open(output_file, 'wb') as f_out:
- f_out.writelines(f_in)
-
-def copy_file(input_file, output_file):
- shutil.copy2(input_file, output_file)
-
-def should_compress(file):
- # Skip compression for spoolman.html
- if file == 'spoolman.html' or file == 'waage.html':
- return False
- # Komprimiere nur bestimmte Dateitypen
- return file.endswith(('.js', '.png', '.css', '.html'))
-
-def main(source_dir, target_dir):
- for root, dirs, files in os.walk(source_dir):
- rel_path = os.path.relpath(root, source_dir)
- for file in files:
- input_file = os.path.join(root, file)
- output_file_compressed = os.path.join(target_dir, rel_path, file + '.gz')
- output_file_original = os.path.join(target_dir, rel_path, file)
-
- os.makedirs(os.path.dirname(output_file_compressed), exist_ok=True)
-
- if should_compress(file):
- compress_file(input_file, output_file_compressed)
- print(f'Compressed {input_file} to {output_file_compressed}')
- else:
- copy_file(input_file, output_file_original)
- print(f'Copied {input_file} to {output_file_original}')
-
-def init():
- source_dir = 'html'
- target_dir = 'data'
-
- if os.path.exists(target_dir):
- shutil.rmtree(target_dir)
-
- main(source_dir, target_dir)
-
-init()
\ No newline at end of file
diff --git a/src/api.cpp b/src/api.cpp
index 4cff372..ccee5dc 100644
--- a/src/api.cpp
+++ b/src/api.cpp
@@ -12,6 +12,20 @@
volatile filamanApiStateType filamanApiState = API_IDLE;
bool filamanConnected = false;
+struct ApiRequest {
+ FilamanApiRequestType type;
+ int id1;
+ int id2;
+ String str1;
+ String str2;
+ float val;
+ bool active = false;
+};
+
+#define MAX_API_QUEUE 10
+ApiRequest apiQueue[MAX_API_QUEUE];
+SemaphoreHandle_t queueMutex;
+
void saveFilamanConfig() {
Preferences preferences;
preferences.begin(NVS_NAMESPACE_API, false);
@@ -36,136 +50,174 @@ bool checkFilamanRegistration() {
bool registerDevice(const String& deviceCode) {
if (filamanUrl.length() == 0) return false;
-
HTTPClient http;
- String url = filamanUrl + "/api/v1/devices/register";
-
- http.begin(url);
+ http.setTimeout(5000);
+ http.begin(filamanUrl + "/api/v1/devices/register");
http.addHeader("Content-Type", "application/json");
http.addHeader("X-Device-Code", deviceCode);
-
int httpCode = http.POST("{}");
- bool success = false;
-
- if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_CREATED) {
- String payload = http.getString();
+ if (httpCode == 200 || httpCode == 201) {
JsonDocument doc;
- DeserializationError error = deserializeJson(doc, payload);
- if (!error && doc["token"].is