1584 : DPIDialog(parent,
id,
_L(
"Cornering test"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
m_plater(
plater)
1585{
1586 SetBackgroundColour(*wxWHITE);
1587 SetForegroundColour(wxColour("#363636"));
1589
1590 wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
1591 SetSizer(v_sizer);
1592
1593
1594 auto labeled_box_model =
new LabeledStaticBox(
this,
_L(
"Test model"));
1595 auto model_box = new wxStaticBoxSizer(labeled_box_model, wxHORIZONTAL);
1596
1597 m_rbModel =
new RadioGroup(
this, {
_L(
"Ringing Tower"),
_L(
"Fast Tower"),
_L(
"SCV-V2") }, wxVERTICAL);
1598 model_box->Add(
m_rbModel, 0, wxALL | wxEXPAND, FromDIP(4));
1599 v_sizer->Add(model_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
1600
1601
1602 wxString start_jd_str =
_L(
"Start: ");
1603 wxString end_jd_str =
_L(
"End: ");
1604 int text_max =
GetTextMax(
this, std::vector<wxString>{start_jd_str, end_jd_str});
1605
1606 LabeledStaticBox* stb =
new LabeledStaticBox(
this,
_L(
"Cornering settings"));
1607 wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
1608
1609 settings_sizer->AddSpacer(FromDIP(5));
1610
1611
1612 const auto* preset_bundle = wxGetApp().preset_bundle;
1613 const auto* gcode_flavor_option = (preset_bundle != nullptr)
1614 ? preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")
1615 : nullptr;
1616
1617 wxString start_value_str;
1618 wxString end_value_str;
1619 wxString units_str;
1620
1621 if (gcode_flavor_option &&
1623 preset_bundle->printers.get_edited_preset().config.option<
ConfigOptionFloats>(
"machine_max_junction_deviation") &&
1624 !preset_bundle->printers.get_edited_preset().config.option<
ConfigOptionFloats>(
"machine_max_junction_deviation")->
values.empty() &&
1625 preset_bundle->printers.get_edited_preset().config.option<
ConfigOptionFloats>(
"machine_max_junction_deviation")->
values[0] > 0) {
1626
1627 start_value_str = wxString::Format("%.3f", 0.000);
1628 end_value_str = wxString::Format("%.3f", 0.250);
1629 units_str = "mm";
1630 } else {
1631
1632 start_value_str = wxString::Format("%.3f", 1.0);
1633 end_value_str = wxString::Format("%.3f", 15.0);
1634 units_str = "mm/s";
1635 }
1636
1637 auto st_size = wxSize(text_max, -1);
1638 auto ti_size = FromDIP(wxSize(120, -1));
1639
1640
1641 auto start_jd_sizer = new wxBoxSizer(wxHORIZONTAL);
1642 auto start_jd_text =
new wxStaticText(
this, wxID_ANY, start_jd_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
1643 m_tiJDStart =
new TextInput(
this, start_value_str, units_str,
"", wxDefaultPosition, ti_size);
1644 m_tiJDStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1645 start_jd_sizer->Add(start_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1646 start_jd_sizer->Add(
m_tiJDStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1647 settings_sizer->Add(start_jd_sizer, 0, wxLEFT, FromDIP(3));
1648
1649
1650 auto end_jd_sizer = new wxBoxSizer(wxHORIZONTAL);
1651 auto end_jd_text =
new wxStaticText(
this, wxID_ANY, end_jd_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
1652 m_tiJDEnd =
new TextInput(
this, end_value_str, units_str,
"", wxDefaultPosition, ti_size);
1653 m_tiJDEnd->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1654 end_jd_sizer->Add(end_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1655 end_jd_sizer->Add(
m_tiJDEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1656 settings_sizer->Add(end_jd_sizer, 0, wxLEFT, FromDIP(3));
1657
1658 settings_sizer->AddSpacer(FromDIP(5));
1659
1660
1661 wxString note_msg =
_L(
"Note: Lower values = sharper corners but slower speeds.");
1662 auto note_text =
new wxStaticText(
this, wxID_ANY, note_msg, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
1663 note_text->SetForegroundColour(wxColour(128, 128, 128));
1664 note_text->Wrap(FromDIP(300));
1665 settings_sizer->Add(note_text, 0, wxALL, FromDIP(5));
1666
1667 if (gcode_flavor_option) {
1668 wxString note_msg_2;
1669 switch (gcode_flavor_option->value) {
1671
1672 const auto* max_jd_option = preset_bundle->printers.get_edited_preset().config.option<
ConfigOptionFloats>(
"machine_max_junction_deviation");
1673 if (max_jd_option && !max_jd_option->values.empty() && max_jd_option->values[0] > 0) {
1674 note_msg_2 +=
_L(
"Marlin 2 Junction Deviation detected:\nTo test Classic Jerk, set 'Maximum Junction Deviation' in Motion ability to 0.");
1675 } else {
1676 note_msg_2 +=
_L(
"Marlin 2 Classic Jerk detected:\nTo test Junction Deviation, set 'Maximum Junction Deviation' in Motion ability to a value > 0.");
1677 }
1678 break;
1679 }
1681 note_msg_2 +=
_L(
"RepRap detected: Jerk in mm/s.\nOrcaSlicer will convert the values to mm/min when necessary.");
1682 break;
1683 default:
1684 break;
1685 }
1686 if(!note_msg_2.empty()){
1687 auto note_text_2 =
new wxStaticText(
this, wxID_ANY, note_msg_2, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
1688 note_text_2->SetForegroundColour(wxColour(128, 128, 128));
1689 note_text_2->Wrap(FromDIP(300));
1690 settings_sizer->Add(note_text_2, 0, wxALL, FromDIP(5));
1691 }
1692 }
1693
1694 v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
1695 v_sizer->AddSpacer(FromDIP(5));
1696
1697 auto dlg_btns = new DialogButtons(this, {"OK"});
1698
1699 auto bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
1700
1701 auto wiki_btn = new Button(this, "", "toolbar_wiki", 0, 15);
1702 auto wiki_url = "https://www.orcaslicer.com/wiki/cornering_calib";
1703 wiki_btn->SetToolTip(
_L(
"Wiki Guide") +
"\n" + wiki_url);
1705 wiki_btn->SetCanFocus(false);
1706 wiki_btn->Bind(wxEVT_LEFT_DOWN, ([wiki_url](auto& e) {wxLaunchDefaultBrowser(wiki_url);}));
1707
1708 bottom_sizer->Add(wiki_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(10));
1709 bottom_sizer->AddStretchSpacer();
1710 bottom_sizer->Add(dlg_btns, 0, wxEXPAND);
1711 v_sizer->Add(bottom_sizer, 0, wxEXPAND);
1712
1714
1715 wxGetApp().UpdateDlgDarkUI(this);
1716
1717 Layout();
1718 Fit();
1719 v_sizer->SetSizeHints(this);
1720}
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Body_14
Definition Label.hpp:53
std::vector< double > values
Definition Config.hpp:418
virtual void on_start(wxCommandEvent &event)
Definition calib_dlg.cpp:1726
TextInput * m_tiJDEnd
Definition calib_dlg.hpp:190
TextInput * m_tiJDStart
Definition calib_dlg.hpp:189
Plater * m_plater
Definition calib_dlg.hpp:191
RadioGroup * m_rbModel
Definition calib_dlg.hpp:188
int GetTextMax(wxWindow *parent, const std::vector< wxString > &labels)
Definition calib_dlg.cpp:59
static Plater * plater()
Definition GUI_Factories.cpp:400
@ gcfMarlinFirmware
Definition PrintConfig.hpp:56
@ gcfRepRapFirmware
Definition PrintConfig.hpp:54
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:1015