ENH: filament map params switch to global param

1.Add more filament map modes
2.Filament map and mode are set as project config
3.Plate filament map is only valid when plate filament mode is
manual

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I33b2f853e0b77b9d605be1f2f1172b44df43da15
(cherry picked from commit e45f8c6dc2146e1e31a1c21e8aaada540af112d0)
This commit is contained in:
xun.zhang
2024-12-19 14:53:42 +08:00
committed by Noisyfox
parent a7956a841d
commit f5a8c96924
20 changed files with 218 additions and 115 deletions

View File

@@ -4436,7 +4436,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
if (msg_dlg.ShowModal() == wxID_OK) {
PartPlateList &partplate_list = wxGetApp().plater()->get_partplate_list();
PartPlate *plate = partplate_list.get_curr_plate();
plate->set_filament_map_mode(FilamentMapMode::fmmAuto);
plate->set_filament_map_mode(FilamentMapMode::fmmAutoForFlush);
Plater *plater = wxGetApp().plater();
wxPostEvent(plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
}
@@ -4449,9 +4449,9 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
auto config = wxGetApp().plater()->get_partplate_list().get_current_fff_print().config();
auto stats_by_extruder = wxGetApp().plater()->get_partplate_list().get_current_fff_print().statistics_by_extruder();
auto filament_map_mode = config.filament_map_mode.value;
auto is_auto = filament_map_mode == FilamentMapMode::fmmAuto;
auto is_auto = filament_map_mode < FilamentMapMode::fmmManual;
bool has_tips = true;
if (filament_map_mode == FilamentMapMode::fmmAuto) {
if (is_auto) {
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
if (!(saved_flush_weight > EPSILON || saved_filament_changed_time > 0)) has_tips = false;
@@ -4528,7 +4528,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
}
return static_cast<int>(num);
};
if (filament_map_mode == fmmAuto) {
if (filament_map_mode < fmmManual) {
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
if (saved_flush_weight > EPSILON || saved_filament_changed_time > 0) {