Compare commits
3 Commits
0f24a63d32
...
0afc543b5f
Author | SHA1 | Date | |
---|---|---|---|
0afc543b5f | |||
adee46e3fc | |||
1db74867e6 |
@ -154,11 +154,11 @@
|
||||
<p>If activated, FilaMan will automatically update the next filled tray with the last scanned and weighed spool.</p>
|
||||
<div class="input-group" style="display: flex; margin-bottom: 0;">
|
||||
<label for="autoSend" style="width: 250px; margin-right: 5px;">Auto Send to Bambu:</label>
|
||||
<label for="autoSendTime" style="width: 250px; margin-right: 5px;">Wait time in Seconds:</label>
|
||||
<label for="autoSendTime" style="width: 250px; margin-right: 5px;">Wait for Spool in Sec:</label>
|
||||
</div>
|
||||
<div class="input-group" style="display: flex;">
|
||||
<input type="checkbox" id="autoSend" {{autoSendToBambu}} style="width: 190px; margin-right: 10px;">
|
||||
<input type="text" id="autoSendTime" placeholder="Time to wait for new Spool" value="{{autoSendTime}}" style="width: 100px;">
|
||||
<input type="number" min="60" id="autoSendTime" placeholder="Time to wait" value="{{autoSendTime}}" style="width: 100px;">
|
||||
</div>
|
||||
|
||||
<button style="margin: 0;" onclick="saveBambuCredentials()">Save Bambu Credentials</button>
|
||||
|
@ -188,14 +188,18 @@ label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"], input[type="submit"] {
|
||||
input[type="text"], input[type="submit"], input[type="number"] {
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
input[type="text"]:focus {
|
||||
input[type="number"] {
|
||||
width: 108px !important;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, input[type="number"]:focus {
|
||||
border-color: #007bff;
|
||||
outline: none;
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ void updateAmsWsData(JsonDocument& doc, JsonArray& amsArray, int& ams_count, Jso
|
||||
ams_data[i].trays[j].tray_color = trayObj["tray_color"].as<String>();
|
||||
ams_data[i].trays[j].nozzle_temp_min = trayObj["nozzle_temp_min"].as<int>();
|
||||
ams_data[i].trays[j].nozzle_temp_max = trayObj["nozzle_temp_max"].as<int>();
|
||||
//ams_data[i].trays[j].setting_id = trayObj["setting_id"].as<String>();
|
||||
if (trayObj["tray_type"].as<String>() == "") ams_data[i].trays[j].setting_id = "";
|
||||
ams_data[i].trays[j].cali_idx = trayObj["cali_idx"].as<String>();
|
||||
}
|
||||
}
|
||||
@ -425,16 +425,8 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Wenn bambu auto set spool aktiv und eine spule erkannt und mqtt meldung das neue spule im ams
|
||||
if (autoSendToBambu && autoSetToBambuSpoolId > 0 &&
|
||||
doc["print"]["command"].as<String>() == "push_status" && doc["print"]["ams"]["tray_pre"].as<uint8_t>()
|
||||
&& !doc["print"]["ams"]["ams"].as<JsonArray>())
|
||||
{
|
||||
autoSetSpool(autoSetToBambuSpoolId, doc["print"]["ams"]["tray_pre"].as<uint8_t>());
|
||||
}
|
||||
|
||||
// Prüfen, ob "print->upgrade_state" und "print.ams.ams" existieren
|
||||
if (doc["print"]["upgrade_state"].is<JsonObject>())
|
||||
if (doc["print"]["upgrade_state"].is<JsonObject>() || (doc["print"]["command"].is<String>() && doc["print"]["command"] == "push_status"))
|
||||
{
|
||||
// Prüfen ob AMS-Daten vorhanden sind
|
||||
if (!doc["print"]["ams"].is<JsonObject>() || !doc["print"]["ams"]["ams"].is<JsonArray>())
|
||||
@ -443,7 +435,7 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
||||
}
|
||||
|
||||
JsonArray amsArray = doc["print"]["ams"]["ams"].as<JsonArray>();
|
||||
|
||||
|
||||
// Prüfe ob sich die AMS-Daten geändert haben
|
||||
bool hasChanges = false;
|
||||
|
||||
@ -479,6 +471,12 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
||||
(trayObj["setting_id"].as<String>() != "" && trayObj["setting_id"].as<String>() != ams_data[storedIndex].trays[j].setting_id) ||
|
||||
trayObj["cali_idx"].as<String>() != ams_data[storedIndex].trays[j].cali_idx) {
|
||||
hasChanges = true;
|
||||
|
||||
if (autoSendToBambu && autoSetToBambuSpoolId > 0 && hasChanges)
|
||||
{
|
||||
autoSetSpool(autoSetToBambuSpoolId, ams_data[storedIndex].trays[j].id);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -497,6 +495,11 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
||||
(vtTray["setting_id"].as<String>() != "" && vtTray["setting_id"].as<String>() != ams_data[i].trays[0].setting_id) ||
|
||||
(vtTray["tray_type"].as<String>() != "" && vtTray["cali_idx"].as<String>() != ams_data[i].trays[0].cali_idx)) {
|
||||
hasChanges = true;
|
||||
|
||||
if (autoSendToBambu && autoSetToBambuSpoolId > 0 && hasChanges)
|
||||
{
|
||||
autoSetSpool(autoSetToBambuSpoolId, 254);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void scale_loop(void * parameter) {
|
||||
weight = round(scale.get_units());
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); // Verzögerung, um die CPU nicht zu überlasten
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ uint8_t start_scale() {
|
||||
BaseType_t result = xTaskCreatePinnedToCore(
|
||||
scale_loop, /* Function to implement the task */
|
||||
"ScaleLoop", /* Name of the task */
|
||||
10000, /* Stack size in words */
|
||||
2048, /* Stack size in words */
|
||||
NULL, /* Task input parameter */
|
||||
scaleTaskPrio, /* Priority of the task */
|
||||
&ScaleTask, /* Task handle. */
|
||||
@ -170,6 +170,12 @@ uint8_t calibrate_scale() {
|
||||
esp_task_wdt_reset();
|
||||
}
|
||||
|
||||
if (scale.wait_ready_timeout(1000))
|
||||
{
|
||||
scale.set_scale(verifyValue); // this value is obtained by calibrating the scale with known weights; see the README for details
|
||||
scale.tare();
|
||||
}
|
||||
|
||||
oledShowMessage("Calibration done");
|
||||
|
||||
for (uint16_t i = 0; i < 2000; i++) {
|
||||
@ -177,8 +183,6 @@ uint8_t calibrate_scale() {
|
||||
vTaskDelay(pdMS_TO_TICKS(1));
|
||||
esp_task_wdt_reset();
|
||||
}
|
||||
|
||||
//ESP.restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -211,9 +215,8 @@ uint8_t calibrate_scale() {
|
||||
}
|
||||
|
||||
oledShowMessage("Scale Ready");
|
||||
|
||||
|
||||
Serial.println("starte Scale Task");
|
||||
Serial.println("restart Scale Task");
|
||||
start_scale();
|
||||
|
||||
pauseBambuMqttTask = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user