diff --git a/src/connect/marlin_printer.cpp b/src/connect/marlin_printer.cpp index 8a90f0fbd4..b4da419dc7 100644 --- a/src/connect/marlin_printer.cpp +++ b/src/connect/marlin_printer.cpp @@ -220,7 +220,7 @@ Printer::Params MarlinPrinter::params() const { params.time_to_pause = marlin_vars()->time_to_pause; params.progress_percent = marlin_vars()->sd_percent_done; params.filament_used = Odometer_s::instance().get_extruded_all(); - params.nozzle_diameter = config_store().get_nozzle_diameter(params.preferred_slot()); + params.nozzle_diameter = config_store().get_nozzle_diameter(params.preferred_head()); params.has_usb = marlin_vars()->media_inserted; params.can_start_download = can_start_download; diff --git a/src/connect/printer.cpp b/src/connect/printer.cpp index 3a54495c07..d8de14f3bc 100644 --- a/src/connect/printer.cpp +++ b/src/connect/printer.cpp @@ -187,4 +187,12 @@ uint8_t Printer::Params::preferred_slot() const { } } +uint8_t Printer::Params::preferred_head() const { +#if HAS_TOOLCHANGER() + return preferred_slot(); +#else + return 0; +#endif +} + } // namespace connect_client diff --git a/src/connect/printer.hpp b/src/connect/printer.hpp index 437d913d1a..a10c56ae17 100644 --- a/src/connect/printer.hpp +++ b/src/connect/printer.hpp @@ -145,6 +145,13 @@ class Printer { } // Either the active slot, if any, or the first available slot if no slot is active. uint8_t preferred_slot() const; + // Either the active head, if any, or the first available one. + // + // This is the same as preferred_slot for XL (where tools and slots are + // the same thing), but always returns 0 on other printers, including + // ones with MMU (they have multiple filament slots, but just one head + // / nozzle / ...). + uint8_t preferred_head() const; }; struct Config { diff --git a/src/connect/render.cpp b/src/connect/render.cpp index 32306f0bef..28738d8db2 100644 --- a/src/connect/render.cpp +++ b/src/connect/render.cpp @@ -123,7 +123,7 @@ namespace { // need to coordinate with Connect, as these are probably // "essential" fields right now. if (telemetry.mode == SendTelemetry::Mode::Full) { - JSON_FIELD_FFIXED("temp_nozzle", params.slots[params.preferred_slot()].temp_nozzle, 1) JSON_COMMA; + JSON_FIELD_FFIXED("temp_nozzle", params.slots[params.preferred_head()].temp_nozzle, 1) JSON_COMMA; JSON_FIELD_FFIXED("temp_bed", params.temp_bed, 1) JSON_COMMA; JSON_FIELD_FFIXED("target_nozzle", params.target_nozzle, 1) JSON_COMMA; JSON_FIELD_FFIXED("target_bed", params.target_bed, 1) JSON_COMMA; @@ -148,8 +148,8 @@ namespace { } JSON_FIELD_FFIXED("axis_z", params.pos[Printer::Z_AXIS_POS], 2) JSON_COMMA; if (params.has_job) { - JSON_FIELD_INT("fan_extruder", params.slots[params.preferred_slot()].heatbreak_fan_rpm) JSON_COMMA; - JSON_FIELD_INT("fan_print", params.slots[params.preferred_slot()].print_fan_rpm) JSON_COMMA; + JSON_FIELD_INT("fan_extruder", params.slots[params.preferred_head()].heatbreak_fan_rpm) JSON_COMMA; + JSON_FIELD_INT("fan_print", params.slots[params.preferred_head()].print_fan_rpm) JSON_COMMA; JSON_FIELD_FFIXED("filament", params.filament_used, 1) JSON_COMMA; }