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.print("Fehler beim Parsen der JSON-Antwort: ");
|
||||||
Serial.println(error.c_str());
|
Serial.println(error.c_str());
|
||||||
} else {
|
} else {
|
||||||
float remaining_weight = doc["remaining_weight"].as<float>();
|
if (httpType == "PUT") {
|
||||||
Serial.print("Aktuelles Gewicht: ");
|
uint16_t remaining_weight = doc["remaining_weight"].as<float>();
|
||||||
Serial.println(remaining_weight);
|
Serial.print("Aktuelles Gewicht: ");
|
||||||
|
Serial.println(remaining_weight);
|
||||||
oledShowMessage("Remaining: " + String(remaining_weight) + "g");
|
oledShowMessage("Remaining: " + String(remaining_weight) + "g");
|
||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
}
|
||||||
|
|
||||||
|
vTaskDelay(3000 / portTICK_PERIOD_MS);
|
||||||
doc.clear();
|
doc.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Fehler beim Senden an Spoolman!");
|
Serial.println("Fehler beim Senden an Spoolman! HTTP Code: " + String(httpCode));
|
||||||
oledShowMessage("Spoolman update failed");
|
oledShowMessage("Spoolman update failed");
|
||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
@ -674,6 +674,7 @@ bool setupMqtt() {
|
|||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
connected = false;
|
connected = false;
|
||||||
oledShowTopRow();
|
oledShowTopRow();
|
||||||
|
autoSetToBambuSpoolId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!connected) return false;
|
if (!connected) return false;
|
||||||
@ -687,6 +688,8 @@ bool setupMqtt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bambu_restart() {
|
void bambu_restart() {
|
||||||
|
Serial.println("Bambu restart");
|
||||||
|
|
||||||
if (BambuMqttTask) {
|
if (BambuMqttTask) {
|
||||||
vTaskDelete(BambuMqttTask);
|
vTaskDelete(BambuMqttTask);
|
||||||
delay(10);
|
delay(10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user