Compare commits
12 Commits
v1.4.7
...
83d14b32d1
Author | SHA1 | Date | |
---|---|---|---|
83d14b32d1 | |||
2bf7c9fb7d | |||
07a919b6ba | |||
8618b90e33 | |||
57723b5354 | |||
d2be752175 | |||
97a050ace8 | |||
367e692c74 | |||
926a21249b | |||
2635c19667 | |||
6cc4efca0a | |||
1484a6b0da |
20
CHANGELOG.md
20
CHANGELOG.md
@ -1,5 +1,25 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.4.9] - 2025-03-29
|
||||||
|
### Changed
|
||||||
|
- update platformio.ini for version v1.4.9
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- enhance HTTP method handling in sendToApi function
|
||||||
|
|
||||||
|
|
||||||
|
## [1.4.8] - 2025-03-29
|
||||||
|
### Changed
|
||||||
|
- update platformio.ini for version v1.4.8
|
||||||
|
- Merge pull request #30 from janecker/main
|
||||||
|
- Merge branch 'testing' into main
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- improve HTTP client configuration and clear update documents after API calls
|
||||||
|
- Fixes memory leak in HTTPClient by disabling connection reuse
|
||||||
|
- update reload logic after removing and saving Bambu credentials for better cache handling
|
||||||
|
|
||||||
|
|
||||||
## [1.4.7] - 2025-03-27
|
## [1.4.7] - 2025-03-27
|
||||||
### Added
|
### Added
|
||||||
- add forced cache refresh after removing and saving Bambu credentials
|
- add forced cache refresh after removing and saving Bambu credentials
|
||||||
|
@ -70,8 +70,8 @@
|
|||||||
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials removed!';
|
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials removed!';
|
||||||
// Reload with forced cache refresh after short delay
|
// Reload with forced cache refresh after short delay
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.replace('/');
|
window.location.reload(true);
|
||||||
location.reload(true);
|
window.location.href = '/';
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('bambuStatusMessage').innerText = 'Error while removing Bambu Credentials.';
|
document.getElementById('bambuStatusMessage').innerText = 'Error while removing Bambu Credentials.';
|
||||||
@ -116,8 +116,8 @@
|
|||||||
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials saved!';
|
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials saved!';
|
||||||
// Reload with forced cache refresh after short delay
|
// Reload with forced cache refresh after short delay
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.replace('/');
|
window.location.reload(true);
|
||||||
location.reload(true);
|
window.location.href = '/';
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('bambuStatusMessage').innerText = 'Error while saving Bambu Credentials.';
|
document.getElementById('bambuStatusMessage').innerText = 'Error while saving Bambu Credentials.';
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
version = "1.4.7"
|
version = "1.4.9"
|
||||||
to_old_version = "1.4.0"
|
to_old_version = "1.4.0"
|
||||||
|
|
||||||
##
|
##
|
||||||
|
14
src/api.cpp
14
src/api.cpp
@ -94,13 +94,16 @@ void sendToApi(void *parameter) {
|
|||||||
String octoToken = params->octoToken;
|
String octoToken = params->octoToken;
|
||||||
|
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
|
http.setReuse(false);
|
||||||
|
|
||||||
http.begin(spoolsUrl);
|
http.begin(spoolsUrl);
|
||||||
http.addHeader("Content-Type", "application/json");
|
http.addHeader("Content-Type", "application/json");
|
||||||
if (octoEnabled && octoToken != "") http.addHeader("X-Api-Key", octoToken);
|
if (octoEnabled && octoToken != "") http.addHeader("X-Api-Key", octoToken);
|
||||||
|
|
||||||
int httpCode = http.PUT(updatePayload);
|
int httpCode;
|
||||||
if (httpType == "PATCH") httpCode = http.PATCH(updatePayload);
|
if (httpType == "PATCH") httpCode = http.PATCH(updatePayload);
|
||||||
if (httpType == "POST") httpCode = http.POST(updatePayload);
|
else if (httpType == "POST") httpCode = http.POST(updatePayload);
|
||||||
|
else httpCode = http.PUT(updatePayload);
|
||||||
|
|
||||||
if (httpCode == HTTP_CODE_OK) {
|
if (httpCode == HTTP_CODE_OK) {
|
||||||
Serial.println("Spoolman erfolgreich aktualisiert");
|
Serial.println("Spoolman erfolgreich aktualisiert");
|
||||||
@ -111,6 +114,7 @@ void sendToApi(void *parameter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http.end();
|
http.end();
|
||||||
|
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
// Speicher freigeben
|
// Speicher freigeben
|
||||||
delete params;
|
delete params;
|
||||||
@ -165,6 +169,8 @@ bool updateSpoolTagId(String uidString, const char* payload) {
|
|||||||
NULL // Task-Handle (nicht benötigt)
|
NULL // Task-Handle (nicht benötigt)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateDoc.clear();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +207,8 @@ uint8_t updateSpoolWeight(String spoolId, uint16_t weight) {
|
|||||||
NULL // Task-Handle (nicht benötigt)
|
NULL // Task-Handle (nicht benötigt)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateDoc.clear();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +246,8 @@ bool updateSpoolOcto(int spoolId) {
|
|||||||
NULL // Task-Handle (nicht benötigt)
|
NULL // Task-Handle (nicht benötigt)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateDoc.clear();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,12 @@ const uint16_t SCALE_LEVEL_WEIGHT = 500;
|
|||||||
uint16_t defaultScaleCalibrationValue = 430;
|
uint16_t defaultScaleCalibrationValue = 430;
|
||||||
// ***** HX711
|
// ***** HX711
|
||||||
|
|
||||||
|
// ***** TTP223 (Touch Sensor)
|
||||||
|
// TTP223 circuit wiring
|
||||||
|
const uint8_t TTP223_PIN = 15;
|
||||||
|
// ***** TTP223
|
||||||
|
|
||||||
|
|
||||||
// ***** Display
|
// ***** Display
|
||||||
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
||||||
// On an ESP32: 21(SDA), 22(SCL)
|
// On an ESP32: 21(SDA), 22(SCL)
|
||||||
|
@ -11,6 +11,8 @@ extern const uint8_t LOADCELL_SCK_PIN;
|
|||||||
extern const uint8_t calVal_eepromAdress;
|
extern const uint8_t calVal_eepromAdress;
|
||||||
extern const uint16_t SCALE_LEVEL_WEIGHT;
|
extern const uint16_t SCALE_LEVEL_WEIGHT;
|
||||||
|
|
||||||
|
extern const uint8_t TTP223_PIN;
|
||||||
|
|
||||||
extern const int8_t OLED_RESET;
|
extern const int8_t OLED_RESET;
|
||||||
extern const uint8_t SCREEN_ADDRESS;
|
extern const uint8_t SCREEN_ADDRESS;
|
||||||
extern const uint8_t SCREEN_WIDTH;
|
extern const uint8_t SCREEN_WIDTH;
|
||||||
|
36
src/main.cpp
36
src/main.cpp
@ -39,7 +39,6 @@ void setup() {
|
|||||||
setupWebserver(server);
|
setupWebserver(server);
|
||||||
|
|
||||||
// Spoolman API
|
// Spoolman API
|
||||||
// api.cpp
|
|
||||||
initSpoolman();
|
initSpoolman();
|
||||||
|
|
||||||
// Bambu MQTT
|
// Bambu MQTT
|
||||||
@ -48,6 +47,7 @@ void setup() {
|
|||||||
// NFC Reader
|
// NFC Reader
|
||||||
startNfc();
|
startNfc();
|
||||||
|
|
||||||
|
// Scale
|
||||||
start_scale();
|
start_scale();
|
||||||
|
|
||||||
// WDT initialisieren mit 10 Sekunden Timeout
|
// WDT initialisieren mit 10 Sekunden Timeout
|
||||||
@ -56,6 +56,9 @@ void setup() {
|
|||||||
|
|
||||||
// Aktuellen Task (loopTask) zum Watchdog hinzufügen
|
// Aktuellen Task (loopTask) zum Watchdog hinzufügen
|
||||||
esp_task_wdt_add(NULL);
|
esp_task_wdt_add(NULL);
|
||||||
|
|
||||||
|
// Touch Sensor
|
||||||
|
pinMode(TTP223_PIN, INPUT_PULLUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,13 +87,25 @@ uint8_t autoAmsCounter = 0;
|
|||||||
uint8_t weightSend = 0;
|
uint8_t weightSend = 0;
|
||||||
int16_t lastWeight = 0;
|
int16_t lastWeight = 0;
|
||||||
|
|
||||||
|
// WIFI check variables
|
||||||
unsigned long lastWifiCheckTime = 0;
|
unsigned long lastWifiCheckTime = 0;
|
||||||
const unsigned long wifiCheckInterval = 60000; // Überprüfe alle 60 Sekunden (60000 ms)
|
const unsigned long wifiCheckInterval = 60000; // Überprüfe alle 60 Sekunden (60000 ms)
|
||||||
|
|
||||||
|
// Button debounce variables
|
||||||
|
unsigned long lastButtonPress = 0;
|
||||||
|
const unsigned long debounceDelay = 500; // 500 ms debounce delay
|
||||||
|
|
||||||
// ##### PROGRAM START #####
|
// ##### PROGRAM START #####
|
||||||
void loop() {
|
void loop() {
|
||||||
unsigned long currentMillis = millis();
|
unsigned long currentMillis = millis();
|
||||||
|
|
||||||
|
// Überprüfe den Status des Touch Sensors
|
||||||
|
if (digitalRead(TTP223_PIN) == LOW && currentMillis - lastButtonPress > debounceDelay)
|
||||||
|
{
|
||||||
|
lastButtonPress = currentMillis;
|
||||||
|
scaleTareRequest = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Überprüfe regelmäßig die WLAN-Verbindung
|
// Überprüfe regelmäßig die WLAN-Verbindung
|
||||||
if (intervalElapsed(currentMillis, lastWifiCheckTime, wifiCheckInterval))
|
if (intervalElapsed(currentMillis, lastWifiCheckTime, wifiCheckInterval))
|
||||||
{
|
{
|
||||||
@ -158,25 +173,6 @@ void loop() {
|
|||||||
{
|
{
|
||||||
lastWeightReadTime = currentMillis;
|
lastWeightReadTime = currentMillis;
|
||||||
|
|
||||||
// Prüfen ob die Waage korrekt genullt ist
|
|
||||||
if ((weight > 0 && weight < 5) || weight < -1)
|
|
||||||
{
|
|
||||||
if(scaleTareCounter < 5)
|
|
||||||
{
|
|
||||||
scaleTareCounter++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scaleTareRequest = true;
|
|
||||||
scaleTareCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scaleTareCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prüfen ob das Gewicht gleich bleibt und dann senden
|
// Prüfen ob das Gewicht gleich bleibt und dann senden
|
||||||
if (weight == lastWeight && weight > 5)
|
if (weight == lastWeight && weight > 5)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user