Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a7d3318a2 | ||
|
|
9875e85e31 | ||
|
|
741a7d9262 | ||
|
|
8bad4fe256 | ||
|
|
185cb5b081 | ||
|
|
0d9132127a | ||
|
|
d39d481c65 | ||
|
|
1cae1e3ae1 |
No files matched your search
+4
-4
@@ -7,12 +7,12 @@
|
||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script>
|
||||
fetch('/api/version')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
fetch('/version.txt')
|
||||
.then(response => response.text())
|
||||
.then(version => {
|
||||
const versionSpan = document.querySelector('.version');
|
||||
if (versionSpan) {
|
||||
versionSpan.textContent = 'v' + data.version;
|
||||
versionSpan.textContent = 'v' + version.trim();
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error fetching version:', error));
|
||||
|
||||
+1
-2
@@ -30,8 +30,7 @@
|
||||
<nav style="display: flex; gap: 1rem;">
|
||||
<a href="/">Start</a>
|
||||
<a href="/waage">Scale</a>
|
||||
<a href="/config">Config</a>
|
||||
<a href="/about">About</a>
|
||||
<a href="/setup">Setup</a>
|
||||
<a href="/upgrade">Upgrade</a>
|
||||
</nav>
|
||||
<div class="status-container">
|
||||
|
||||
+18
-1
@@ -6,13 +6,24 @@
|
||||
<title>FilaMan - Setup</title>
|
||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script>
|
||||
fetch('/api/version')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const versionSpan = document.querySelector('.version');
|
||||
if (versionSpan) {
|
||||
versionSpan.textContent = 'v' + data.version;
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error fetching version:', error));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar">
|
||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||
<div class="logo-text">
|
||||
<h1>FilaMan</h1>
|
||||
<h1>FilaMan<span class="version"></span></h1>
|
||||
<h4>Filament Management Tool</h4>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,6 +33,12 @@
|
||||
<a href="/setup">Setup</a>
|
||||
<a href="/upgrade">Upgrade</a>
|
||||
</nav>
|
||||
<div class="status-container">
|
||||
<div class="status-item">
|
||||
<span class="status-dot" id="filamanDot"></span>F
|
||||
</div>
|
||||
<div class="ram-status" id="ramStatus"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
||||
+7
-2
@@ -30,10 +30,15 @@
|
||||
<nav style="display: flex; gap: 1rem;">
|
||||
<a href="/">Start</a>
|
||||
<a href="/waage">Scale</a>
|
||||
<a href="/config">Config</a>
|
||||
<a href="/about">About</a>
|
||||
<a href="/setup">Setup</a>
|
||||
<a href="/upgrade">Upgrade</a>
|
||||
</nav>
|
||||
<div class="status-container">
|
||||
<div class="status-item">
|
||||
<span class="status-dot" id="filamanDot"></span>F
|
||||
</div>
|
||||
<div class="ram-status" id="ramStatus"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[common]
|
||||
version = "3.0.6"
|
||||
version = "3.0.8"
|
||||
to_old_version = "2.0.10"
|
||||
|
||||
##
|
||||
|
||||
+23
-1
@@ -105,8 +105,30 @@ bool sendWeight(int spoolId, String tagUuid, float measuredWeight) {
|
||||
String payload;
|
||||
serializeJson(doc, payload);
|
||||
int httpCode = http.POST(payload);
|
||||
|
||||
if (httpCode == 200) {
|
||||
String response = http.getString();
|
||||
JsonDocument responseDoc;
|
||||
DeserializationError error = deserializeJson(responseDoc, response);
|
||||
if (!error && responseDoc["remaining_weight_g"].is<float>()) {
|
||||
int remaining = (int)responseDoc["remaining_weight_g"].as<float>();
|
||||
pauseMainTask = 1;
|
||||
oledShowRemainingWeight(remaining);
|
||||
vTaskDelay(pdMS_TO_TICKS(3000));
|
||||
pauseMainTask = 0;
|
||||
}
|
||||
http.end();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
pauseMainTask = 1;
|
||||
oledShowProgressBar(1, 1, "Failure", "API Error");
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
pauseMainTask = 0;
|
||||
}
|
||||
|
||||
http.end();
|
||||
return (httpCode == 200);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sendLocation(int spoolId, String spoolTagUuid, int locationId, String locationTagUuid) {
|
||||
|
||||
@@ -50,6 +50,21 @@ bool loadJsonValue(const char* filename, JsonDocument& doc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String readFile(const char* filename) {
|
||||
File file = LittleFS.open(filename, "r");
|
||||
if (!file) {
|
||||
Serial.print("Fehler beim Öffnen der Datei: ");
|
||||
Serial.println(filename);
|
||||
return "";
|
||||
}
|
||||
String content = "";
|
||||
while (file.available()) {
|
||||
content += (char)file.read();
|
||||
}
|
||||
file.close();
|
||||
return content;
|
||||
}
|
||||
|
||||
void initializeFileSystem() {
|
||||
if (!LittleFS.begin(true)) {
|
||||
Serial.println("LittleFS Mount Failed");
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
bool removeJsonValue(const char* filename);
|
||||
bool saveJsonValue(const char* filename, const JsonDocument& doc);
|
||||
bool loadJsonValue(const char* filename, JsonDocument& doc);
|
||||
String readFile(const char* filename);
|
||||
void initializeFileSystem();
|
||||
|
||||
#endif
|
||||
@@ -254,6 +254,19 @@ void oledShowWeight(uint16_t weight) {
|
||||
display.display();
|
||||
}
|
||||
|
||||
void oledShowRemainingWeight(uint16_t remainingWeight) {
|
||||
oledcleardata();
|
||||
display.setTextSize(1);
|
||||
display.setCursor(oled_center_h("Weight sent, rest:"), OLED_DATA_START + 4);
|
||||
display.print("Weight sent, rest:");
|
||||
|
||||
display.setTextSize(3);
|
||||
String weightStr = String(remainingWeight) + " g";
|
||||
display.setCursor(oled_center_h(weightStr), OLED_DATA_START + 22);
|
||||
display.print(weightStr);
|
||||
display.display();
|
||||
}
|
||||
|
||||
void oledShowConnectionError(const char* error, const String& ip) {
|
||||
oledcleardata();
|
||||
display.setTextSize(1);
|
||||
|
||||
@@ -19,6 +19,7 @@ int oled_center_v(const String &text);
|
||||
void oledShowProgressBar(const uint8_t step, const uint8_t numSteps, const char* largeText, const char* statusMessage);
|
||||
|
||||
void oledShowWeight(uint16_t weight);
|
||||
void oledShowRemainingWeight(uint16_t remainingWeight);
|
||||
void oledDisplayText(const String &message, uint8_t size = 2);
|
||||
void oledShowConnectionError(const char* error, const String& ip);
|
||||
void oledShowTopRow();
|
||||
|
||||
+9
-7
@@ -162,7 +162,7 @@ void loop() {
|
||||
{
|
||||
// Use filtered weight for smooth display, but still check API weight for significant changes
|
||||
int16_t displayWeight = getFilteredDisplayWeight();
|
||||
if (mainTaskWasPaused || (weight != lastWeight && nfcReaderState == NFC_IDLE))
|
||||
if (mainTaskWasPaused || (weight != lastWeight && (nfcReaderState == NFC_IDLE || tagProcessed)))
|
||||
{
|
||||
(displayWeight < 2) ? ((displayWeight < -2) ? oledDisplayText("!! -0") : oledShowWeight(0)) : oledShowWeight(displayWeight);
|
||||
}
|
||||
@@ -191,12 +191,6 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
// reset weight counter after writing tag
|
||||
if (currentMillis - lastWeightReadTime >= weightReadInterval && nfcReaderState != NFC_IDLE && nfcReaderState != NFC_READ_SUCCESS)
|
||||
{
|
||||
weightCounterToApi = 0;
|
||||
}
|
||||
|
||||
lastWeight = weight;
|
||||
|
||||
// Wenn ein Tag erkannt wurde und das Gewicht stabil ist, an FilaMan senden
|
||||
@@ -211,6 +205,10 @@ void loop() {
|
||||
sendWeightAsync(sId, activeTagUuid, weight);
|
||||
weightSend = 1;
|
||||
Serial.println("Weight queued for FilaMan");
|
||||
|
||||
// Feedback to user
|
||||
pauseMainTask = 1;
|
||||
oledShowProgressBar(3, 4, "Spool Tag", "Sending...");
|
||||
}
|
||||
|
||||
// Handle successful tag write
|
||||
@@ -221,6 +219,10 @@ void loop() {
|
||||
sendWeightAsync(sId, activeTagUuid, weight);
|
||||
weightSend = 1;
|
||||
Serial.println("Weight queued for FilaMan after tag write");
|
||||
|
||||
// Feedback to user
|
||||
pauseMainTask = 1;
|
||||
oledShowProgressBar(3, 4, "Tag written", "Sending...");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2025,6 +2025,7 @@ void scanRfidTask(void * parameter) {
|
||||
nfcJsonData = "";
|
||||
activeSpoolId = "";
|
||||
activeTagUuid = "";
|
||||
tagProcessed = false;
|
||||
oledShowWeight(weight);
|
||||
}
|
||||
|
||||
@@ -2032,6 +2033,7 @@ void scanRfidTask(void * parameter) {
|
||||
else if (!success && nfcReaderState == NFC_READ_SUCCESS)
|
||||
{
|
||||
nfcReaderState = NFC_IDLE;
|
||||
tagProcessed = false;
|
||||
Serial.println("Tag nach erfolgreichem Lesen entfernt - bereit für nächsten Tag");
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -128,14 +128,19 @@ void setupWebserver(AsyncWebServer &server) {
|
||||
|
||||
server.on("/waage", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
Serial.println("Web: Request /waage");
|
||||
AsyncWebServerResponse *response = request->beginResponse(LittleFS, "/waage.html", "text/html");
|
||||
String html = readFile("/waage.html");
|
||||
html.replace("{{autoTare}}", autoTare ? "checked" : "");
|
||||
auto response = request->beginResponse(200, "text/html", html);
|
||||
response->addHeader("Cache-Control", NO_CACHE);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
server.on("/setup", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
Serial.println("Web: Request /setup");
|
||||
AsyncWebServerResponse *response = request->beginResponse(LittleFS, "/setup.html", "text/html");
|
||||
String html = readFile("/setup.html");
|
||||
html.replace("{{registered}}", filamanRegistered ? "Registered" : "Not Registered");
|
||||
html.replace("{{filamanUrl}}", filamanUrl);
|
||||
auto response = request->beginResponse(200, "text/html", html);
|
||||
response->addHeader("Cache-Control", NO_CACHE);
|
||||
request->send(response);
|
||||
});
|
||||
@@ -154,6 +159,12 @@ void setupWebserver(AsyncWebServer &server) {
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
server.on("/version.txt", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
AsyncWebServerResponse *response = request->beginResponse(LittleFS, "/version.txt", "text/plain");
|
||||
response->addHeader("Cache-Control", NO_CACHE);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
server.on("/style.css", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
AsyncWebServerResponse *response = request->beginResponse(LittleFS, "/style.css", "text/css");
|
||||
response->addHeader("Cache-Control", NO_CACHE);
|
||||
|
||||
Reference in new issue
Block a user