Compare commits
No commits in common. "83d14b32d1551b629328f95df92ec031e76f26ec" and "d2be75217506fdf26ab87a3581e78bb69b0a03a2" have entirely different histories.
83d14b32d1
...
d2be752175
@ -1,13 +1,5 @@
|
|||||||
# 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
|
## [1.4.8] - 2025-03-29
|
||||||
### Changed
|
### Changed
|
||||||
- update platformio.ini for version v1.4.8
|
- update platformio.ini for version v1.4.8
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
version = "1.4.9"
|
version = "1.4.8"
|
||||||
to_old_version = "1.4.0"
|
to_old_version = "1.4.0"
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -100,10 +100,9 @@ void sendToApi(void *parameter) {
|
|||||||
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;
|
int httpCode = http.PUT(updatePayload);
|
||||||
if (httpType == "PATCH") httpCode = http.PATCH(updatePayload);
|
if (httpType == "PATCH") httpCode = http.PATCH(updatePayload);
|
||||||
else if (httpType == "POST") httpCode = http.POST(updatePayload);
|
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");
|
||||||
|
@ -19,12 +19,6 @@ 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,8 +11,6 @@ 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,6 +39,7 @@ void setup() {
|
|||||||
setupWebserver(server);
|
setupWebserver(server);
|
||||||
|
|
||||||
// Spoolman API
|
// Spoolman API
|
||||||
|
// api.cpp
|
||||||
initSpoolman();
|
initSpoolman();
|
||||||
|
|
||||||
// Bambu MQTT
|
// Bambu MQTT
|
||||||
@ -47,7 +48,6 @@ 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,9 +56,6 @@ 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,25 +84,13 @@ 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))
|
||||||
{
|
{
|
||||||
@ -173,6 +158,25 @@ 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)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user