mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-17 14:02:35 +00:00
Merge branch 'main' into feature/filament_id
Brings in 560 commits (merge base 2026-07-04 .. origin/main af9fd10d7a).
19 conflicts resolved; the other 138 touched files auto-merged.
Conflict resolutions
- Snapmaker/Polymaker (7): main normalised JSON key order in #15039 while this
branch inserted filament_id/filament_vendor. Took main's key order and kept
this branch's values, inserting a single filament_id key rather than letting
git's line merge leave duplicate "from"/"instantiation" keys.
- re3D rPETG @0.8/@1.75 nozzle (2): main renamed these from "re3D Greengate
rPETG @*" and re-vendored GreenGate3D -> re3D (#15169). Git's rename-aware
merge produced a file with two filament_vendor keys; took main's version
wholesale instead. The id is reconciled by the tooling, not by hand.
- re3D rPP (1): kept main's inherits change (fdm_filament_pet -> fdm_filament_pp,
local filament_type override dropped) and its widened compatible_printers.
The flattened type is still PP, so the product triple and id OFfHGM1D are
unchanged.
- re3D Greengate rPETG.json, Afinia {ABS+,ABS,PLA,TPU,Value ABS,Value PLA}.json
(7 modify/delete): accepted main's deletions. The Afinia ids are not orphaned
- the surviving @HS presets resolve the same triple and already carry the
same ids, so nothing is retired.
- .github/workflows/check_profiles.yml: kept both main's new "validate slice"
step and this branch's tree-wide filament-subtype check.
- tests/libslic3r/CMakeLists.txt: kept both test_filament_id_succession.cpp and
main's test_preset_diff.cpp.
Verified
- No conflict markers; all 12795 profile JSONs parse with no duplicate keys.
- All branch artifacts (tooling, snapshot, ledger, doc, tests) intact and
unmodified by the merge.
- The succession-ledger C++ call sites survived main's refactors; audited
Preset.{cpp,hpp}, PresetBundle.cpp, DeviceManager.cpp, PresetComboBoxes.cpp,
CaliHistoryDialog.cpp, MoonrakerPrinterAgent.cpp against base/ours/theirs.
- scripts/tests: 115/116 pass.
Known follow-up: assign_filament_ids.py --check reports 243 errors, all from
filament data main added in the last month (BBL/addnorth, Qidi X5/Plus 5,
Snapmaker U1, re3D). The single failing unit test is the live-tree conformance
test asserting that count is zero. Reconciliation lands separately.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "fast_float/fast_float.h"
|
||||
|
||||
#include "DeviceCore/DevFilaSystem.h"
|
||||
#include "DeviceCore/DevFilaSwitch.h"
|
||||
#include "DeviceCore/DevExtensionTool.h"
|
||||
#include "DeviceCore/DevExtruderSystem.h"
|
||||
#include "DeviceCore/DevNozzleSystem.h"
|
||||
@@ -39,9 +40,16 @@
|
||||
#include "DeviceCore/DevHMS.h"
|
||||
|
||||
#include "DeviceCore/DevMapping.h"
|
||||
#include "DeviceCore/DevMappingNozzle.h"
|
||||
#include "DeviceCore/DevManager.h"
|
||||
#include "DeviceCore/DevUtil.h"
|
||||
|
||||
// Orca: adopt DeviceCore split — axis/calib/chamber/status/upgrade modules
|
||||
#include "DeviceCore/DevAxis.h"
|
||||
#include "DeviceCore/DevChamber.h"
|
||||
#include "DeviceCore/DevStatus.h"
|
||||
#include "DeviceCore/DevUpgrade.h"
|
||||
|
||||
|
||||
#define CALI_DEBUG
|
||||
#define MINUTE_30 1800000 //ms
|
||||
@@ -66,6 +74,44 @@ int get_tray_id_by_ams_id_and_slot_id(int ams_id, int slot_id)
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// Stringing-prone filament IDs per nozzle-diameter bucket.
|
||||
// Mirrors the printer firmware tables (see g_leak_pron_idx_for_0_4 / _0_6_0_8).
|
||||
// Keep these in sync with firmware when new stringing-prone filaments are added.
|
||||
const std::unordered_set<std::string> g_stringing_prone_for_0_4 = {
|
||||
"GFA11", // PLA Aero
|
||||
"GFU90", // TPU 90A
|
||||
"GFU00", // TPU 95A HF
|
||||
"GFU02", // Generic TPU for AMS
|
||||
"GFU98", // TPU for AMS
|
||||
};
|
||||
|
||||
const std::unordered_set<std::string> g_stringing_prone_for_0_6_0_8 = {
|
||||
"GFA11", // PLA Aero
|
||||
"GFU00", // TPU 95A HF
|
||||
};
|
||||
|
||||
// Pick the right table for the given nozzle diameter; returns nullptr if the
|
||||
// nozzle bucket has no entries (e.g. 0.2 mm) or the diameter is invalid.
|
||||
const std::unordered_set<std::string>* pick_stringing_set(float nozzle_diameter)
|
||||
{
|
||||
if (!(nozzle_diameter > 0.f)) return nullptr;
|
||||
if (nozzle_diameter < 0.3f) return nullptr; // 0.2 nozzle: empty
|
||||
if (nozzle_diameter < 0.5f) return &g_stringing_prone_for_0_4;
|
||||
return &g_stringing_prone_for_0_6_0_8; // 0.6 / 0.8 nozzles
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool Slic3r::is_stringing_prone_filament(const std::string& filament_id, float nozzle_diameter)
|
||||
{
|
||||
if (filament_id.empty()) return false;
|
||||
const auto* set = pick_stringing_set(nozzle_diameter);
|
||||
if (!set) return false;
|
||||
return set->count(filament_id) > 0;
|
||||
}
|
||||
|
||||
wxString Slic3r::get_stage_string(int stage)
|
||||
{
|
||||
switch(stage) {
|
||||
@@ -551,6 +597,7 @@ MachineObject::MachineObject(DeviceManager* manager, NetworkAgent* agent, std::s
|
||||
mc_print_sub_stage = 0;
|
||||
mc_left_time = 0;
|
||||
hw_switch_state = 0;
|
||||
m_print_error_img_id = "";
|
||||
|
||||
has_ipcam = true; // default true
|
||||
|
||||
@@ -566,12 +613,22 @@ MachineObject::MachineObject(DeviceManager* manager, NetworkAgent* agent, std::s
|
||||
m_extder_system = new DevExtderSystem(this);
|
||||
m_extension_tool = DevExtensionTool::Create(this);
|
||||
m_nozzle_system = new DevNozzleSystem(this);
|
||||
m_fila_system = new DevFilaSystem(this);
|
||||
m_fila_system = std::make_shared<DevFilaSystem>(this);
|
||||
m_fila_switch = new DevFilaSwitch(this);
|
||||
m_hms_system = new DevHMS(this);
|
||||
m_config = new DevConfig(this);
|
||||
|
||||
m_ctrl = new DevCtrl(this);
|
||||
m_print_options = new DevPrintOptions(this);
|
||||
|
||||
m_nozzle_mapping_ptr = std::make_shared<DevNozzleMappingCtrl>(this);
|
||||
|
||||
// Orca: adopt DeviceCore split — axis/calib/chamber/status/upgrade modules
|
||||
m_axis = DevAxis::Create(this);
|
||||
m_chamber = DevChamber::Create(this);
|
||||
m_upgrade = DevUpgrade::Create(this);
|
||||
m_status = new DevStatus(this);
|
||||
m_calib = new DevCalib(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,8 +669,9 @@ MachineObject::~MachineObject()
|
||||
delete m_ctrl;
|
||||
m_ctrl = nullptr;
|
||||
|
||||
delete m_fila_system;
|
||||
m_fila_system = nullptr;
|
||||
|
||||
delete m_fila_switch;
|
||||
m_fila_switch = nullptr;
|
||||
|
||||
delete m_hms_system;
|
||||
m_hms_system = nullptr;
|
||||
@@ -623,6 +681,13 @@ MachineObject::~MachineObject()
|
||||
|
||||
delete m_print_options;
|
||||
m_print_options = nullptr;
|
||||
|
||||
// Orca: adopt DeviceCore split
|
||||
delete m_calib;
|
||||
m_calib = nullptr;
|
||||
|
||||
delete m_status;
|
||||
m_status = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,6 +757,33 @@ std::string MachineObject::get_filament_display_type(const std::string& ams_id,
|
||||
return this->get_tray(ams_id, tray_id).get_display_filament_type();
|
||||
}
|
||||
|
||||
bool MachineObject::any_loaded_filament_is_stringing_prone() const
|
||||
{
|
||||
if (print_job_filament_mapping.empty()) return false;
|
||||
|
||||
std::vector<float> nozzle_diameters;
|
||||
if (m_extder_system) {
|
||||
for (const auto& ext : m_extder_system->GetExtruders()) {
|
||||
const float d = ext.GetNozzleDiameter();
|
||||
if (d > 0.f) nozzle_diameters.push_back(d);
|
||||
}
|
||||
}
|
||||
if (nozzle_diameters.empty()) return false;
|
||||
|
||||
for (uint16_t v : print_job_filament_mapping) {
|
||||
if (v == 0xFFFF) continue;
|
||||
const int ams_id = (v >> 8) & 0xFF;
|
||||
const int slot_id = v & 0xFF;
|
||||
const std::string fid = this->get_filament_id(std::to_string(ams_id), std::to_string(slot_id));
|
||||
if (fid.empty()) continue;
|
||||
for (float d : nozzle_diameters) {
|
||||
if (Slic3r::is_stringing_prone_filament(fid, d))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MachineObject::_parse_ams_status(int ams_status)
|
||||
{
|
||||
ams_status_sub = ams_status & 0xFF;
|
||||
@@ -710,6 +802,8 @@ void MachineObject::_parse_ams_status(int ams_status)
|
||||
ams_status_main = AmsStatusMain::AMS_STATUS_MAIN_SELF_CHECK;
|
||||
} else if (ams_status_main_int == (int) AmsStatusMain::AMS_STATUS_MAIN_DEBUG) {
|
||||
ams_status_main = AmsStatusMain::AMS_STATUS_MAIN_DEBUG;
|
||||
} else if (ams_status_main_int == (int) AmsStatusMain::AMS_STATUS_MAIN_COLD_PULL) {
|
||||
ams_status_main = AmsStatusMain::AMS_STATUS_MAIN_COLD_PULL;
|
||||
} else {
|
||||
ams_status_main = AmsStatusMain::AMS_STATUS_MAIN_UNKNOWN;
|
||||
}
|
||||
@@ -861,7 +955,14 @@ void MachineObject::clear_version_info()
|
||||
laser_version_info = DevFirmwareVersionInfo();
|
||||
cutting_module_version_info = DevFirmwareVersionInfo();
|
||||
extinguish_version_info = DevFirmwareVersionInfo();
|
||||
rotary_version_info = DevFirmwareVersionInfo();
|
||||
exhaustfan_version_info = DevFirmwareVersionInfo();
|
||||
amshub_version_info = DevFirmwareVersionInfo();
|
||||
filatrack_version_info = DevFirmwareVersionInfo();
|
||||
module_vers.clear();
|
||||
// Drop cached rack-hotend (WTM) firmware alongside the module list.
|
||||
// Inert for non-rack printers (rack firmware map is empty).
|
||||
m_nozzle_system->ClearFirmwareInfoWTM();
|
||||
}
|
||||
|
||||
void MachineObject::store_version_info(const DevFirmwareVersionInfo& info)
|
||||
@@ -874,6 +975,19 @@ void MachineObject::store_version_info(const DevFirmwareVersionInfo& info)
|
||||
cutting_module_version_info = info;
|
||||
} else if (info.isExtinguishSystem()) {
|
||||
extinguish_version_info = info;
|
||||
} else if (info.isRotary()) {
|
||||
rotary_version_info = info;
|
||||
} else if (info.isWTM()) {
|
||||
// Route rack-hotend / extruder-nozzle firmware into the nozzle system so
|
||||
// the rack upgrade UI can read per-nozzle versions. isWTM() is false for every non-rack
|
||||
// printer's modules, so this branch never fires outside H2C.
|
||||
m_nozzle_system->AddFirmwareInfoWTM(info);
|
||||
} else if (info.isExhaustFan()) {
|
||||
exhaustfan_version_info = info;
|
||||
} else if (info.isHmshub()) {
|
||||
amshub_version_info = info;
|
||||
} else if (info.isFilaTrackSwitch()) {
|
||||
filatrack_version_info = info;
|
||||
}
|
||||
|
||||
module_vers.emplace(info.name, info);
|
||||
@@ -1190,7 +1304,7 @@ bool MachineObject::canEnableTimelapse(wxString &error_message) const
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_storage->get_sdcard_state() != DevStorage::SdcardState::HAS_SDCARD_NORMAL) {
|
||||
if (m_storage->get_sdcard_state() != DevStorage::SdcardState::HAS_SDCARD_NORMAL && !m_has_timelapse_kit) {
|
||||
if (m_storage->get_sdcard_state() == DevStorage::SdcardState::NO_SDCARD) {
|
||||
error_message = _L("Timelapse is not supported while the storage does not exist.");
|
||||
} else if (m_storage->get_sdcard_state() == DevStorage::SdcardState::HAS_SDCARD_ABNORMAL) {
|
||||
@@ -1556,7 +1670,7 @@ int MachineObject::check_resume_condition()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int MachineObject::command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp, int new_temp)
|
||||
int MachineObject::command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp, int new_temp, std::optional<int> extruder_id)
|
||||
{
|
||||
json j;
|
||||
try {
|
||||
@@ -1588,6 +1702,13 @@ int MachineObject::command_ams_change_filament(bool load, std::string ams_id, st
|
||||
j["print"]["slot_id"] = atoi(slot_id.c_str());
|
||||
}
|
||||
|
||||
// Filament Track Switch: route the load to the chosen extruder. Only present when the
|
||||
// caller supplied a value (FTS-installed+ready path), so every other caller is unchanged.
|
||||
if (extruder_id.has_value())
|
||||
{
|
||||
j["print"]["extruder_id"] = *extruder_id;
|
||||
}
|
||||
|
||||
} catch (const std::exception &) {}
|
||||
return this->publish_json(j);
|
||||
}
|
||||
@@ -1833,10 +1954,17 @@ int MachineObject::command_axis_control(std::string axis, double unit, double in
|
||||
{
|
||||
if (m_support_mqtt_axis_control)
|
||||
{
|
||||
int dir = input_val > 0 ? 1 : -1;
|
||||
// i3-arch printers move the bed for Y/Z, so the on-screen direction is
|
||||
// reversed — same negation the g-code fallback below applies.
|
||||
if (!is_core_xy() && (axis.compare("Y") == 0 || axis.compare("Z") == 0)) {
|
||||
dir = -dir;
|
||||
}
|
||||
|
||||
json j;
|
||||
j["print"]["command"] = "xyz_ctrl";
|
||||
j["print"]["axis"] = axis;
|
||||
j["print"]["dir"] = input_val > 0 ? 1 : -1;
|
||||
j["print"]["dir"] = dir;
|
||||
j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return this->publish_json(j);
|
||||
@@ -1976,6 +2104,10 @@ int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult> &
|
||||
j["print"]["filaments"][i]["n_coef"] = std::to_string(pa_calib_values[i].n_coef);
|
||||
else
|
||||
j["print"]["filaments"][i]["n_coef"] = "0.0";
|
||||
if (pa_calib_values[i].nozzle_pos_id >= 0) {
|
||||
j["print"]["filaments"][i]["nozzle_pos"] = pa_calib_values[i].nozzle_pos_id;
|
||||
j["print"]["filaments"][i]["nozzle_sn"] = pa_calib_values[i].nozzle_sn;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_set: " << j.dump();
|
||||
@@ -1994,6 +2126,10 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali
|
||||
j["print"]["nozzle_id"] = _generate_nozzle_id(pa_calib.nozzle_volume_type, to_string_nozzle_diameter(pa_calib.nozzle_diameter)).ToStdString();
|
||||
j["print"]["filament_id"] = pa_calib.filament_id;
|
||||
j["print"]["cali_idx"] = pa_calib.cali_idx;
|
||||
if (pa_calib.nozzle_pos_id >= 0) {
|
||||
j["print"]["nozzle_pos"] = pa_calib.nozzle_pos_id;
|
||||
j["print"]["nozzle_sn"] = pa_calib.nozzle_sn;
|
||||
}
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_del: " << j.dump();
|
||||
@@ -2014,6 +2150,11 @@ int MachineObject::command_get_pa_calibration_tab(const PACalibExtruderInfo &cal
|
||||
j["print"]["nozzle_id"] = _generate_nozzle_id(calib_info.nozzle_volume_type, to_string_nozzle_diameter(calib_info.nozzle_diameter)).ToStdString();
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_info.nozzle_diameter);
|
||||
|
||||
if (calib_info.nozzle_pos_id >= 0) {
|
||||
j["print"]["nozzle_pos"] = calib_info.nozzle_pos_id;
|
||||
j["print"]["nozzle_sn"] = calib_info.nozzle_sn;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get: " << j.dump();
|
||||
request_tab_from_bbs = true;
|
||||
return this->publish_json(j);
|
||||
@@ -2040,6 +2181,10 @@ int MachineObject::commnad_select_pa_calibration(const PACalibIndexInfo& pa_cali
|
||||
j["print"]["slot_id"] = pa_calib_info.slot_id;
|
||||
j["print"]["cali_idx"] = pa_calib_info.cali_idx;
|
||||
j["print"]["filament_id"] = pa_calib_info.filament_id;
|
||||
if (pa_calib_info.nozzle_pos_id >= 0) {
|
||||
j["print"]["nozzle_pos"] = pa_calib_info.nozzle_pos_id;
|
||||
j["print"]["nozzle_sn"] = pa_calib_info.nozzle_sn;
|
||||
}
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_info.nozzle_diameter);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_sel: " << j.dump();
|
||||
@@ -2158,6 +2303,14 @@ int MachineObject::command_ack_proceed(json& proceed) {
|
||||
} else {
|
||||
proceed["err_ignored"] = std::vector<int>{proceed["err_index"]};
|
||||
}
|
||||
|
||||
for (auto& item : proceed["err_ignored"]) {
|
||||
json error_item;
|
||||
error_item["idx"] = item.get<int>();
|
||||
error_item["mode"] = 0;
|
||||
proceed["rm_idx"].push_back(error_item);
|
||||
}
|
||||
|
||||
proceed["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
json j;
|
||||
@@ -2165,6 +2318,78 @@ int MachineObject::command_ack_proceed(json& proceed) {
|
||||
return this->publish_json(j);
|
||||
}
|
||||
|
||||
bool MachineObject::is_timelapse_storage_low(const std::string& storage) const
|
||||
{
|
||||
return m_storage && m_storage->is_timelapse_storage_low(storage);
|
||||
}
|
||||
|
||||
int MachineObject::command_ipcam_check_timelapse_storage(const std::string& storage, int total_layer)
|
||||
{
|
||||
json j;
|
||||
j["camera"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["camera"]["command"] = "ipcam_get_media_info";
|
||||
j["camera"]["sub_command"] = "is_timelapse_storage_enough";
|
||||
j["camera"]["storage"] = storage;
|
||||
j["camera"]["total_layer"] = total_layer;
|
||||
return this->publish_json(j);
|
||||
}
|
||||
|
||||
int MachineObject::command_ipcam_delete_oldest_timelapse(const std::string& storage, int total_layer)
|
||||
{
|
||||
json j;
|
||||
j["camera"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["camera"]["command"] = "ipcam_delete_oldest_timelapse";
|
||||
j["camera"]["storage"] = storage;
|
||||
j["camera"]["total_layer"] = total_layer;
|
||||
return this->publish_json(j);
|
||||
}
|
||||
|
||||
int MachineObject::command_purification_disable()
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "close_air_filt";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
return this->publish_json(j, 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_dont_remind_next_time(json& mqtt_guard_json)
|
||||
{
|
||||
if (!mqtt_guard_json.contains("command") ||
|
||||
!mqtt_guard_json.contains("err_index") ||
|
||||
mqtt_guard_json["err_index"].empty()) return -1;
|
||||
|
||||
json j;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
try {
|
||||
j["print"]["command"] = mqtt_guard_json["command"].get<std::string>();
|
||||
int err_index = mqtt_guard_json["err_index"].get<int>();
|
||||
|
||||
if (mqtt_guard_json.contains("err_ignored") &&
|
||||
mqtt_guard_json["err_ignored"].is_array()) {
|
||||
j["print"]["err_ignored"] = mqtt_guard_json["err_ignored"];
|
||||
j["print"]["err_ignored"].push_back(err_index);
|
||||
} else {
|
||||
j["print"]["err_ignored"] = std::vector<int>{err_index};
|
||||
}
|
||||
|
||||
for (auto& item : j["print"]["err_ignored"]) {
|
||||
if (!item.is_number_integer()) continue;
|
||||
|
||||
json item_json;
|
||||
item_json["idx"] = item.get<int>();
|
||||
item_json["mode"] = 1; // 1-next time ignore, 2-always ignore
|
||||
j["print"]["rm_idx"].push_back(item_json);
|
||||
}
|
||||
} catch (const json::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "JSON parsing error in command_dont_remind_next_time: " << e.what();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return this->publish_json(j, 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string lvl)
|
||||
{
|
||||
bool print_halt = (lvl == "never_halt") ? false:true;
|
||||
@@ -2379,6 +2604,7 @@ void MachineObject::reset()
|
||||
jobState_ = 0;
|
||||
m_plate_index = -1;
|
||||
device_cert_installed = false;
|
||||
clear_auto_nozzle_mapping();// reset nozzle mapping
|
||||
|
||||
// reset print_json
|
||||
json empty_j;
|
||||
@@ -2881,6 +3107,7 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
|
||||
//supported function
|
||||
m_config->ParseConfig(jj);
|
||||
m_status->ParseStatus(jj); // Orca: adopt DeviceCore split — populate DevStatus module
|
||||
|
||||
if (jj.contains("support_build_plate_marker_detect")) {
|
||||
if (jj["support_build_plate_marker_detect"].is_boolean()) {
|
||||
@@ -2904,6 +3131,7 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
}
|
||||
|
||||
m_fan->ParseV2_0(jj);
|
||||
m_fila_switch->ParseFilaSwitchInfo(jj);
|
||||
|
||||
if (jj.contains("support_filament_backup")) {
|
||||
if (jj["support_filament_backup"].is_boolean()) {
|
||||
@@ -3008,6 +3236,8 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
|
||||
|
||||
if (jj.contains("command")) {
|
||||
m_nozzle_mapping_ptr->ParseAutoNozzleMapping(jj);
|
||||
|
||||
if (jj["command"].get<std::string>() == "ams_change_filament") {
|
||||
if (jj.contains("errno")) {
|
||||
if (jj["errno"].is_number()) {
|
||||
@@ -3105,6 +3335,17 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
if (jj["print_error"].is_number())
|
||||
print_error = jj["print_error"].get<int>();
|
||||
}
|
||||
// Orca: keep the failure-snapshot id only while an error is active, so a stale
|
||||
// id can't leak into a later unrelated error dialog once the failure clears.
|
||||
if (print_error <= 0) {
|
||||
m_print_error_img_id.clear();
|
||||
}
|
||||
else if (jj.contains("err2") && jj["err2"].is_object()) {
|
||||
json err2 = jj["err2"];
|
||||
if (err2.contains("img_id") && err2["img_id"].is_string()) {
|
||||
m_print_error_img_id = err2["img_id"].get<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
DevStorage::ParseV1_0(jj, m_storage);
|
||||
|
||||
@@ -3126,6 +3367,9 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
int flag3 = jj["flag3"].get<int>();
|
||||
is_support_filament_setting_inprinting = get_flag_bits(flag3, 3);
|
||||
is_enable_ams_np = get_flag_bits(flag3, 9);
|
||||
is_support_fila_change_abort = get_flag_bits(flag3, 13); // filament-change Stop button
|
||||
is_support_ext_change_assist_old = get_flag_bits(flag3, 16); // A/P-series multi-color external change assist
|
||||
is_support_filament_32_colors = get_flag_bits(flag3, 17);
|
||||
}
|
||||
}
|
||||
if (!key_field_only) {
|
||||
@@ -3291,6 +3535,16 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
if (!key_field_only) {
|
||||
/* temperature */
|
||||
|
||||
// Orca: adopt DeviceCore split — populate DevAxis/DevChamber modules
|
||||
// alongside the inline handling (side-effect-free; inline stays authoritative).
|
||||
// Contained locally so a malformed field cannot abort the whole status parse.
|
||||
try {
|
||||
m_axis->ParseAxis(jj);
|
||||
m_chamber->ParseChamber(jj);
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "parse_json: DevAxis/DevChamber parse failed";
|
||||
}
|
||||
|
||||
DevBed::ParseV1_0(jj,m_bed);
|
||||
|
||||
if (jj.contains("frame_temper")) {
|
||||
@@ -3731,7 +3985,7 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
update_printer_preset_name();
|
||||
update_filament_list();
|
||||
if (jj.contains("ams")) {
|
||||
DevFilaSystemParser::ParseV1_0(jj, this, m_fila_system, key_field_only);
|
||||
DevFilaSystemParser::ParseV1_0(jj, this, m_fila_system.get(), key_field_only);
|
||||
}
|
||||
|
||||
/* vitrual tray*/
|
||||
@@ -4090,6 +4344,14 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
pa_calib_result.nozzle_volume_type = convert_to_nozzle_type((*it)["nozzle_id"].get<std::string>());
|
||||
}
|
||||
|
||||
if ((*it).contains("nozzle_pos")) {
|
||||
pa_calib_result.nozzle_pos_id = (*it)["nozzle_pos"].get<int>();
|
||||
}
|
||||
|
||||
if ((*it).contains("nozzle_sn")) {
|
||||
pa_calib_result.nozzle_sn = (*it)["nozzle_sn"].get<std::string>();
|
||||
}
|
||||
|
||||
if (jj["nozzle_diameter"].is_number_float()) {
|
||||
pa_calib_result.nozzle_diameter = jj["nozzle_diameter"].get<float>();
|
||||
} else if (jj["nozzle_diameter"].is_string()) {
|
||||
@@ -4187,6 +4449,14 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
pa_calib_result.nozzle_volume_type = NozzleVolumeType::nvtStandard;
|
||||
}
|
||||
|
||||
if (it->contains("nozzle_pos")) {
|
||||
pa_calib_result.nozzle_pos_id = (*it)["nozzle_pos"].get<int>();
|
||||
}
|
||||
|
||||
if (it->contains("nozzle_sn")) {
|
||||
pa_calib_result.nozzle_sn = (*it)["nozzle_sn"].get<std::string>();
|
||||
}
|
||||
|
||||
if ((*it)["k_value"].is_number_float())
|
||||
pa_calib_result.k_value = (*it)["k_value"].get<float>();
|
||||
else if ((*it)["k_value"].is_string())
|
||||
@@ -4283,6 +4553,17 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
this->camera_resolution = j["camera"]["resolution"].get<std::string>();
|
||||
BOOST_LOG_TRIVIAL(info) << "ack of resolution = " << camera_resolution;
|
||||
}
|
||||
} else if (j["camera"]["command"].get<std::string>() == "ipcam_get_media_info") {
|
||||
if (j["camera"].contains("sub_command") &&
|
||||
j["camera"]["sub_command"].get<std::string>() == "is_timelapse_storage_enough") {
|
||||
timelapse_storage_check_result = j["camera"].value("result", -1);
|
||||
timelapse_storage_is_enough = j["camera"].value("is_enough", true);
|
||||
timelapse_storage_file_count = j["camera"].value("file_count", 0);
|
||||
timelapse_storage_check_done = true;
|
||||
BOOST_LOG_TRIVIAL(info) << "timelapse storage check: result=" << timelapse_storage_check_result
|
||||
<< " is_enough=" << timelapse_storage_is_enough
|
||||
<< " file_count=" << timelapse_storage_file_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4374,6 +4655,40 @@ void MachineObject::set_ctt_dlg( wxString text){
|
||||
}
|
||||
}
|
||||
|
||||
void MachineObject::show_unsupported_dlg(int code)
|
||||
{
|
||||
// why: a dead control invites repeat clicks, and the frame is modeless - without the guard
|
||||
// every click stacks another one. Same shape as set_ctt_dlg above, including the reset on
|
||||
// both hide and close so a dismissed dialog can reappear on the next attempt.
|
||||
if (m_unsupported_dlg_shown) {
|
||||
return;
|
||||
}
|
||||
m_unsupported_dlg_shown = true;
|
||||
|
||||
// why: two codes so the user learns which kind of dead end this is - the slicer having no
|
||||
// translation for the command, or the printer's own config lacking the hardware to run it.
|
||||
const wxString text = (code == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE) ?
|
||||
_L("This printer is not configured with the hardware this control needs.") :
|
||||
_L("This control is not supported on this printer.");
|
||||
|
||||
// note: constructed directly rather than through CallAfter because every publish_json caller
|
||||
// is on the UI thread - clicks come from wx handlers, and the agent marshals its own push
|
||||
// callbacks back to main before parse_json runs. set_ctt_dlg relies on the same property.
|
||||
auto unsupported_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"),
|
||||
GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM);
|
||||
unsupported_dlg->update_text(text);
|
||||
unsupported_dlg->Bind(wxEVT_SHOW, [this](auto& e) {
|
||||
if (!e.IsShown()) {
|
||||
m_unsupported_dlg_shown = false;
|
||||
}
|
||||
});
|
||||
unsupported_dlg->Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {
|
||||
e.Skip();
|
||||
m_unsupported_dlg_shown = false;
|
||||
});
|
||||
unsupported_dlg->on_show();
|
||||
}
|
||||
|
||||
int MachineObject::publish_gcode(std::string gcode_str)
|
||||
{
|
||||
json j;
|
||||
@@ -4887,6 +5202,15 @@ bool MachineObject::check_enable_np(const json& print) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// Max filament color count for the send gate; 0 = no explicit upper bound.
|
||||
int MachineObject::get_max_filament_color_count() const
|
||||
{
|
||||
if (is_support_filament_32_colors) return 32;
|
||||
if (is_enable_ams_np && !is_series_x()) return 20;
|
||||
if (!is_series_x() && !is_series_o()) return 16;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MachineObject::parse_new_info(json print)
|
||||
{
|
||||
is_enable_np = check_enable_np(print);
|
||||
@@ -5012,6 +5336,7 @@ void MachineObject::parse_new_info(json print)
|
||||
is_support_user_preset = get_flag_bits(fun, 11);
|
||||
is_support_door_open_check = get_flag_bits(fun, 12);
|
||||
is_support_nozzle_blob_detection = get_flag_bits(fun, 13);
|
||||
m_nozzle_system->SetSupportNozzleRack(get_flag_bits(fun, 60)); // H2C hotend rack support (device-side gate for the sync dialog)
|
||||
is_support_upgrade_kit = get_flag_bits(fun, 14);
|
||||
is_support_internal_timelapse = get_flag_bits(fun, 28);
|
||||
m_support_mqtt_homing = get_flag_bits(fun, 32);
|
||||
@@ -5039,6 +5364,23 @@ void MachineObject::parse_new_info(json print)
|
||||
// fun2 may have infinite length, use get_flag_bits_no_border
|
||||
if (!fun2.empty()) {
|
||||
is_support_print_with_emmc = get_flag_bits_no_border(fun2, 0) == 1;
|
||||
is_support_pa_mode = (get_flag_bits_no_border(fun2, 3) == 1);
|
||||
is_support_remote_dry = (get_flag_bits_no_border(fun2, 5) == 1);
|
||||
is_support_check_track_switch_match_slice_printer = get_flag_bits_no_border(fun2, 19) == 1;
|
||||
|
||||
if (DevPrinterConfigUtil::support_print_check_firmware_for_tpu_left(printer_type)) {
|
||||
m_firmware_support_print_tpu_left = get_flag_bits_no_border(fun2, 7) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Per-filament-index AMS slot mapping reported by the printer (task-level state) */
|
||||
if (print.contains("mapping") && print["mapping"].is_array()) {
|
||||
std::vector<uint16_t> new_mapping;
|
||||
new_mapping.reserve(print["mapping"].size());
|
||||
for (const auto& v : print["mapping"]) {
|
||||
new_mapping.push_back(static_cast<uint16_t>(v.get<unsigned>()));
|
||||
}
|
||||
print_job_filament_mapping = std::move(new_mapping);
|
||||
}
|
||||
|
||||
/*aux*/
|
||||
@@ -5048,6 +5390,7 @@ void MachineObject::parse_new_info(json print)
|
||||
|
||||
if (!aux.empty()) {
|
||||
m_storage->set_sdcard_state(get_flag_bits(aux, 12, 2));
|
||||
m_has_timelapse_kit = (get_flag_bits(aux, 26, 1) == 1);
|
||||
}
|
||||
|
||||
/*stat*/
|
||||
@@ -5074,7 +5417,10 @@ void MachineObject::parse_new_info(json print)
|
||||
|
||||
DevBed::ParseV2_0(device,m_bed);
|
||||
|
||||
if (device.contains("nozzle")) { DevNozzleSystemParser::ParseV2_0(device["nozzle"], m_nozzle_system); }
|
||||
// Pass the whole device json: ParseV2_0 reads ext/rack nozzles from device["nozzle"] and the
|
||||
// hotend-rack state from device["holder"] (rack data lives outside device["nozzle"]). It is a
|
||||
// no-op for devices that report neither key, so non-rack machines are unaffected.
|
||||
DevNozzleSystemParser::ParseV2_0(device, m_nozzle_system);
|
||||
if (device.contains("extruder")) { ExtderSystemParser::ParseV2_0(device["extruder"], m_extder_system);}
|
||||
if (device.contains("ext_tool")) { DevExtensionToolParser::ParseV2_0(device["ext_tool"], m_extension_tool); }
|
||||
|
||||
@@ -5523,7 +5869,9 @@ wxString MachineObject::get_nozzle_replace_url() const
|
||||
return link_map["en"].get<wxString>();
|
||||
}/*retry with en*/
|
||||
|
||||
return "https://wiki.bambulab.com/en/h2/maintenance/replace-hotend";
|
||||
// Orca: no neutral wiki equivalent for this fallback — return empty so the caller hides the link
|
||||
// (PrinterPartsDialog::OnWikiClicked reports "No wiki link available" instead of opening a browser)
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
std::string MachineObject::get_error_code_str(int error_code)
|
||||
|
||||
Reference in New Issue
Block a user