fix: add remaining weight logging for PUT requests and improve error reporting in sendToApi function
This commit is contained in:
parent
e79c522e46
commit
c78c20979d
16
src/api.cpp
16
src/api.cpp
@ -118,17 +118,19 @@ void sendToApi(void *parameter) {
|
||||
Serial.print("Fehler beim Parsen der JSON-Antwort: ");
|
||||
Serial.println(error.c_str());
|
||||
} else {
|
||||
float remaining_weight = doc["remaining_weight"].as<float>();
|
||||
Serial.print("Aktuelles Gewicht: ");
|
||||
Serial.println(remaining_weight);
|
||||
|
||||
oledShowMessage("Remaining: " + String(remaining_weight) + "g");
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
if (httpType == "PUT") {
|
||||
uint16_t remaining_weight = doc["remaining_weight"].as<float>();
|
||||
Serial.print("Aktuelles Gewicht: ");
|
||||
Serial.println(remaining_weight);
|
||||
oledShowMessage("Remaining: " + String(remaining_weight) + "g");
|
||||
}
|
||||
|
||||
vTaskDelay(3000 / portTICK_PERIOD_MS);
|
||||
doc.clear();
|
||||
}
|
||||
|
||||
} else {
|
||||
Serial.println("Fehler beim Senden an Spoolman!");
|
||||
Serial.println("Fehler beim Senden an Spoolman! HTTP Code: " + String(httpCode));
|
||||
oledShowMessage("Spoolman update failed");
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
@ -674,6 +674,7 @@ bool setupMqtt() {
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
connected = false;
|
||||
oledShowTopRow();
|
||||
autoSetToBambuSpoolId = 0;
|
||||
}
|
||||
|
||||
if (!connected) return false;
|
||||
@ -687,6 +688,8 @@ bool setupMqtt() {
|
||||
}
|
||||
|
||||
void bambu_restart() {
|
||||
Serial.println("Bambu restart");
|
||||
|
||||
if (BambuMqttTask) {
|
||||
vTaskDelete(BambuMqttTask);
|
||||
delay(10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user