Compare commits

...

5 Commits

Author SHA1 Message Date
83d14b32d1 fix: add debounce handling for TTP223 touch sensor 2025-03-29 14:23:55 +01:00
2bf7c9fb7d feat: add TTP223 touch sensor support and wiring configuration 2025-03-29 14:18:58 +01:00
07a919b6ba docs: update changelog and header for version v1.4.9
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m48s
2025-03-29 10:11:25 +01:00
8618b90e33 docs: update platformio.ini for version v1.4.9 2025-03-29 10:11:25 +01:00
57723b5354 fix: enhance HTTP method handling in sendToApi function 2025-03-29 10:03:17 +01:00
6 changed files with 36 additions and 23 deletions

View File

@ -1,5 +1,13 @@
# 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

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.4.8"
version = "1.4.9"
to_old_version = "1.4.0"
##

View File

@ -100,9 +100,10 @@ void sendToApi(void *parameter) {
http.addHeader("Content-Type", "application/json");
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 == "POST") httpCode = http.POST(updatePayload);
else if (httpType == "POST") httpCode = http.POST(updatePayload);
else httpCode = http.PUT(updatePayload);
if (httpCode == HTTP_CODE_OK) {
Serial.println("Spoolman erfolgreich aktualisiert");

View File

@ -19,6 +19,12 @@ const uint16_t SCALE_LEVEL_WEIGHT = 500;
uint16_t defaultScaleCalibrationValue = 430;
// ***** HX711
// ***** TTP223 (Touch Sensor)
// TTP223 circuit wiring
const uint8_t TTP223_PIN = 15;
// ***** TTP223
// ***** Display
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// On an ESP32: 21(SDA), 22(SCL)

View File

@ -11,6 +11,8 @@ extern const uint8_t LOADCELL_SCK_PIN;
extern const uint8_t calVal_eepromAdress;
extern const uint16_t SCALE_LEVEL_WEIGHT;
extern const uint8_t TTP223_PIN;
extern const int8_t OLED_RESET;
extern const uint8_t SCREEN_ADDRESS;
extern const uint8_t SCREEN_WIDTH;

View File

@ -39,7 +39,6 @@ void setup() {
setupWebserver(server);
// Spoolman API
// api.cpp
initSpoolman();
// Bambu MQTT
@ -48,6 +47,7 @@ void setup() {
// NFC Reader
startNfc();
// Scale
start_scale();
// WDT initialisieren mit 10 Sekunden Timeout
@ -56,6 +56,9 @@ void setup() {
// Aktuellen Task (loopTask) zum Watchdog hinzufügen
esp_task_wdt_add(NULL);
// Touch Sensor
pinMode(TTP223_PIN, INPUT_PULLUP);
}
@ -84,13 +87,25 @@ uint8_t autoAmsCounter = 0;
uint8_t weightSend = 0;
int16_t lastWeight = 0;
// WIFI check variables
unsigned long lastWifiCheckTime = 0;
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 #####
void loop() {
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
if (intervalElapsed(currentMillis, lastWifiCheckTime, wifiCheckInterval))
{
@ -158,25 +173,6 @@ void loop() {
{
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
if (weight == lastWeight && weight > 5)
{