Merge branch 'main' into FullSpectrum_integration

This commit is contained in:
SoftFever
2026-05-03 20:05:27 +08:00
committed by GitHub
10 changed files with 38 additions and 28 deletions

View File

@@ -2562,6 +2562,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_max_layer_z = 0.f;
m_last_width = 0.f;
m_is_role_based_fan_on.fill(false);
m_role_based_fan_marker_layer.fill(-1);
m_fan_mover.release();
@@ -8554,11 +8555,14 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
assert(m_enable_cooling_markers);
if (fan_on) {
if (!m_is_role_based_fan_on[role]) {
// Orca: CoolingBuffer consumes role fan markers per layer, so continuing
// role-based fan regions need a fresh START marker on each new layer.
if (!m_is_role_based_fan_on[role] || m_role_based_fan_marker_layer[role] != m_layer_index) {
gcode += ";";
gcode += marker_prefix;
gcode += "_FAN_START\n";
m_is_role_based_fan_on[role] = true;
m_role_based_fan_marker_layer[role] = m_layer_index;
}
} else {
if (m_is_role_based_fan_on[role]) {
@@ -8566,6 +8570,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
gcode += marker_prefix;
gcode += "_FAN_END\n";
m_is_role_based_fan_on[role] = false;
m_role_based_fan_marker_layer[role] = -1;
}
}
};

View File

@@ -590,6 +590,7 @@ private:
std::string _encode_label_ids_to_base64(std::vector<size_t> ids);
// ORCA: Add support for role based fan speed control
std::array<bool, ExtrusionRole::erCount> m_is_role_based_fan_on;
std::array<int, ExtrusionRole::erCount> m_role_based_fan_marker_layer;
// Markers for the Pressure Equalizer to recognize the extrusion type.
// The Pressure Equalizer removes the markers from the final G-code.
bool m_enable_extrusion_role_markers;

View File

@@ -67,7 +67,7 @@ LayerPtrs new_layers(
}
if (zaa_active) {
slice_z = lo + z_offset;
if (slice_z < lo || slice_z > hi) {
if ((slice_z < lo && !is_approx(slice_z, lo)) || (slice_z > hi && !is_approx(slice_z, hi))) {
throw RuntimeError("Bad min Z value");
}
}

View File

@@ -913,12 +913,13 @@ namespace Slic3r
}
// do some refresh
if (Slic3r::GUI::wxGetApp().is_user_login(Slic3r::GUI::wxGetApp().get_printer_cloud_provider()))
const auto cloud_provider = Slic3r::GUI::wxGetApp().get_printer_cloud_provider();
if (Slic3r::GUI::wxGetApp().is_user_login(cloud_provider))
{
m_manager->check_pushing();
try
{
agent->refresh_connection();
agent->refresh_connection(cloud_provider);
}
catch (...)
{

View File

@@ -116,7 +116,7 @@ public:
class DeviceManagerRefresher : public wxObject
{
wxTimer* m_timer{ nullptr };
int m_timer_interval_msec = 1000;
int m_timer_interval_msec = 5000;
DeviceManager* m_manager{ nullptr };

View File

@@ -1175,8 +1175,8 @@ void PlaterPresetComboBox::update()
}
bool single_bar = false;
wxString name = preset.name;
preset_aliases[name] = get_preset_name(preset).ToStdString(); // ORCA
wxString name = from_u8(preset.name);
preset_aliases[name] = get_preset_name(preset).utf8_string(); // ORCA
// Track bundle names for bundled presets
if (preset.is_from_bundle()) {
@@ -1232,7 +1232,7 @@ void PlaterPresetComboBox::update()
name = from_u8(is_selected && preset.is_dirty ? Preset::suffix_modified() + printer_model : printer_model);
if (system_printer_models.count(printer_model) == 0) {
preset_aliases[name] = name.ToStdString(); // ORCA
preset_aliases[name] = name.utf8_string(); // ORCA
system_presets.emplace(name, bmp);
system_printer_models.insert(printer_model);
}
@@ -1676,8 +1676,8 @@ void TabPresetComboBox::update()
wxBitmap* bmp = get_bmp(preset);
assert(bmp);
const wxString name = preset.name;
preset_aliases[name] = get_preset_name(preset).ToStdString();
const wxString name = from_u8(preset.name);
preset_aliases[name] = get_preset_name(preset).utf8_string();
if (preset.is_system)
preset_descriptions.emplace(name, from_u8(preset.description));

View File

@@ -4366,14 +4366,7 @@ void TabFilament::toggle_options()
toggle_line("pellet_flow_coefficient", is_pellet_printer);
toggle_line("filament_diameter", !is_pellet_printer);
bool support_chamber_temp_control = printer_cfg.opt_bool("support_chamber_temp_control");
toggle_line("activate_chamber_temp_control", support_chamber_temp_control);
toggle_line("chamber_temperature", support_chamber_temp_control);
if (support_chamber_temp_control) {
bool activate_chamber_temp_control = m_config->opt_bool("activate_chamber_temp_control", 0);
toggle_option("chamber_temperature", activate_chamber_temp_control);
}
toggle_line("activate_chamber_temp_control", printer_cfg.opt_bool("support_chamber_temp_control"));
std::string volumetric_speed_cos = m_config->opt_string("volumetric_speed_coefficients", 0u);
bool enable_fit = volumetric_speed_cos != "0 0 0 0 0 0";
@@ -6914,10 +6907,10 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
// Collect and set indices of depending_presets marked as compatible.
wxArrayInt selections;
auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(m_config->option(deps.key_list));
if (compatible_printers != nullptr || !compatible_printers->values.empty())
if (compatible_printers != nullptr && !compatible_printers->values.empty())
for (auto preset_name : compatible_printers->values)
for (size_t idx = 0; idx < presets.GetCount(); ++idx)
if (presets[idx] == preset_name) {
if (presets[idx] == from_u8(preset_name)) {
selections.Add(idx);
break;
}

View File

@@ -340,9 +340,17 @@ bool NetworkAgent::is_server_connected(const std::string& provider)
return false;
}
int NetworkAgent::refresh_connection()
int NetworkAgent::refresh_connection(const std::string& provider)
{
return invoke_on_all_cloud_agents(m_cloud_agents, [](ICloudServiceAgent& cloud_agent) { return cloud_agent.refresh_connection(); });
if(provider.empty())
return invoke_on_all_cloud_agents(m_cloud_agents, [](ICloudServiceAgent& cloud_agent) { return cloud_agent.refresh_connection(); });
else {
const auto cloud_agent = get_cloud_agent(provider);
if (cloud_agent)
return cloud_agent->refresh_connection();
return -1;
}
}
void NetworkAgent::enable_multi_machine(bool enable, const std::string& provider)

View File

@@ -71,7 +71,7 @@ public:
int set_on_http_error_fn(AppOnHttpErrorFn fn);
int set_get_country_code_fn(GetCountryCodeFn fn);
int connect_server();
int refresh_connection();
int refresh_connection(const std::string& provider = "");
int change_user(std::string user_info, const std::string& provider = ORCA_CLOUD_PROVIDER);
bool is_user_login(const std::string& provider = ORCA_CLOUD_PROVIDER);

View File

@@ -74,19 +74,21 @@ constexpr const char* SECRET_STORE_SERVICE = "OrcaSlicer/Auth";
constexpr const char* SECRET_STORE_USER = "orca_refresh_token";
constexpr std::chrono::seconds TOKEN_REFRESH_SKEW{900}; // 15 minutes
std::string generate_uuid_for_setting_id(const std::string& name = "")
std::string generate_uuid_for_setting_id(const std::string& name, const std::string& user_id = "")
{
if (name.empty()) {
return "";
}
// Use a fixed namespace UUID for OrcaSlicer profiles
// This ensures the same name always generates the same UUID
// Mix user_id into the hashed input so two different users generating a setting_id
// for an identically-named preset get distinct UUIDs. Without this, the cloud's ID
// space collides across accounts and the second user's create gets HTTP 409 with
// server_profile=null on every sync (the foreign owner's record is not exposed).
static const boost::uuids::uuid orca_namespace =
boost::uuids::string_generator()("f47ac10b-58cc-4372-a567-0e02b2c3d479");
boost::uuids::name_generator_sha1 gen(orca_namespace);
boost::uuids::uuid id = gen(name);
boost::uuids::uuid id = user_id.empty() ? gen(name) : gen(user_id + "/" + name);
return boost::uuids::to_string(id);
}
@@ -904,7 +906,7 @@ int OrcaCloudServiceAgent::get_user_presets(std::map<std::string, std::map<std::
std::string OrcaCloudServiceAgent::request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code)
{
std::string new_id = generate_uuid_for_setting_id(name);
std::string new_id = generate_uuid_for_setting_id(name, get_user_id());
if (new_id.empty()) {
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: request_setting_id failed - name is empty";
return "";