Restore the extruder name fallback and fix the loading-busy check

This commit is contained in:
SoftFever
2026-07-17 01:16:47 +08:00
parent 4bca7b3008
commit 8a6609f282
3 changed files with 14 additions and 9 deletions

View File

@@ -374,15 +374,19 @@ std::string DevPrinterConfigUtil::get_toolhead_display_name(
}
}
// Fallback: all dual-extruder printers should have tool_head_display_names configured.
// This is a safety net only — return a generic name.
// Orca: models that ship no tool_head_display_names (e.g. H2D/H2S) must still get distinct
// per-extruder labels, so fall back to the previous programmatic Left/Right construction.
// Engages only when the config lookup above yields nothing, so models that ship the key
// behave exactly like the reference.
if (result.empty()) {
static const std::map<ToolHeadComponent, std::string> fallback_names = {
{ ToolHeadComponent::Extruder, "Extruder" },
{ ToolHeadComponent::Nozzle, "Nozzle" },
{ ToolHeadComponent::Hotend, "Hotend" }
};
result = fallback_names.at(component);
const std::string side = ext_id == DEPUTY_EXTRUDER_ID ? "Left" : "Right";
const std::string component_name = component == ToolHeadComponent::Extruder ? "Extruder" :
component == ToolHeadComponent::Hotend ? "Hotend" : "Nozzle";
result = side + " " + component_name;
if (name_case == ToolHeadNameCase::SentenceCase && result.size() > side.size() + 1)
result[side.size() + 1] = static_cast<char>(std::tolower(static_cast<unsigned char>(result[side.size() + 1])));
else if (name_case == ToolHeadNameCase::LowerCase)
std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
}
// short_name: return only the role prefix (e.g. "Main" from "Main Nozzle")

View File

@@ -271,7 +271,7 @@ namespace Slic3r
system->m_current_loading_extder_id = INVALID_EXTRUDER_ID;
if (!system->m_extders[MAIN_EXTRUDER_ID].m_star.ams_id.empty())
{
system->m_current_busy_for_loading = (system->m_extders[MAIN_EXTRUDER_ID].m_snow == system->m_extders[MAIN_EXTRUDER_ID].m_star);
system->m_current_busy_for_loading = (system->m_extders[MAIN_EXTRUDER_ID].m_snow != system->m_extders[MAIN_EXTRUDER_ID].m_star);
if (system->m_current_busy_for_loading)
{
system->m_current_loading_extder_id = MAIN_EXTRUDER_ID;

View File

@@ -22,6 +22,7 @@ struct DevAmsSlotInfo
std::string slot_id;
public:
bool operator!=(const DevAmsSlotInfo& other) const { return !(*this == other); }
bool operator==(const DevAmsSlotInfo& other) const { return ams_id == other.ams_id && slot_id == other.slot_id;}
};