FIX: modify the flushing volume of transparent material

The transparent material is regarded as the white material to calculate the flushing volume

Change-Id: I922ff55ede62acb7040d6f7cdc6b14bcf6e31274
This commit is contained in:
zhimin.zeng 2023-05-12 14:32:24 +08:00 committed by Lane.Wei
parent 01e556a038
commit ab17e418cf
2 changed files with 12 additions and 2 deletions

View file

@ -1374,7 +1374,7 @@ void Sidebar::load_ams_list(std::string const &device, std::map<std::string, Ams
ams.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id}); ams.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id});
ams.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type}); ams.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type});
ams.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)}); ams.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)});
ams.set_key_value("filament_colour", new ConfigOptionStrings{"#" + tray.second->color.substr(0, 6)}); ams.set_key_value("filament_colour", new ConfigOptionStrings{"#" + tray.second->color.substr(0, 8)});
filament_ams_list.emplace_back(std::move(ams)); filament_ams_list.emplace_back(std::move(ams));
} }
} }

View file

@ -493,8 +493,18 @@ static float calc_triangle_3rd_edge(float edge_a, float edge_b, float degree_ab)
return std::sqrt(edge_a * edge_a + edge_b * edge_b - 2 * edge_a * edge_b * std::cos(to_radians(degree_ab))); return std::sqrt(edge_a * edge_a + edge_b * edge_b - 2 * edge_a * edge_b * std::cos(to_radians(degree_ab)));
} }
int WipingPanel::calc_flushing_volume(const wxColour& from, const wxColour& to) int WipingPanel::calc_flushing_volume(const wxColour& from_, const wxColour& to_)
{ {
wxColour from = from_;
wxColour to = to_;
// BBS: Transparent materials are treated as white materials
if (from.Alpha() == 0) {
from.Set(255, 255, 255);
}
if (to.Alpha() == 0) {
to.Set(255, 255, 255);
}
float from_hsv_h, from_hsv_s, from_hsv_v; float from_hsv_h, from_hsv_s, from_hsv_v;
float to_hsv_h, to_hsv_s, to_hsv_v; float to_hsv_h, to_hsv_s, to_hsv_v;