1158 : DPIDialog(parent,
id,
_L(
"Input shaping Frequency test"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
m_plater(
plater)
1159{
1160 SetBackgroundColour(*wxWHITE);
1161 SetForegroundColour(wxColour("#363636"));
1163
1164 const auto* preset_bundle = wxGetApp().preset_bundle;
1165 const auto* gcode_flavor_option = (preset_bundle != nullptr)
1166 ? preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")
1167 : nullptr;
1169
1170 wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
1171 SetSizer(v_sizer);
1172
1173
1174 auto labeled_box_model =
new LabeledStaticBox(
this,
_L(
"Test model"));
1175 auto model_box = new wxStaticBoxSizer(labeled_box_model, wxHORIZONTAL);
1176
1177 m_rbModel =
new RadioGroup(
this, {
_L(
"Ringing Tower"),
_L(
"Fast Tower") }, wxVERTICAL);
1178 model_box->Add(
m_rbModel, 0, wxALL | wxEXPAND, FromDIP(4));
1179 v_sizer->Add(model_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
1180
1181
1182 auto labeled_box_type =
new LabeledStaticBox(
this,
_L(
"Input shaper type"));
1183 auto type_box = new wxStaticBoxSizer(labeled_box_type, wxVERTICAL);
1185 m_rbType =
new RadioGroup(
this, type_labels, wxVERTICAL, 3);
1186 type_box->Add(
m_rbType, 0, wxALL | wxEXPAND, FromDIP(4));
1188
1189
1190 wxString firmware_note =
_L(
"Please ensure the selected type is compatible with your firmware version.");
1191 if (gcode_flavor_option) {
1192 switch (gcode_flavor_option->value) {
1195 firmware_note =
_L(
"Marlin version => 2.1.2\nFixed-Time motion not yet implemented.");
1196 break;
1198 firmware_note =
_L(
"Klipper version => 0.9.0");
1199 break;
1201 firmware_note =
_L(
"RepRap firmware version => 3.4.0\nCheck your firmware documentation for supported shaper types.");
1202 break;
1203 default:
1204 break;
1205 }
1206 }
1207
1208 auto type_note =
new wxStaticText(
this, wxID_ANY, firmware_note, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
1209 type_note->SetForegroundColour(wxColour(128, 128, 128));
1210 type_box->Add(type_note, 0, wxALL, FromDIP(5));
1211
1212 v_sizer->Add(type_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
1213
1214
1215 wxString x_axis_str = reprap_firmware ?
_L(
"Frequency (Start / End): ") :
_L(
"X Start / End: ");
1216 wxString y_axis_str =
_L(
"Y Start / End: ");
1217 int text_max =
GetTextMax(
this, std::vector<wxString>{x_axis_str, y_axis_str});
1218
1219 auto st_size = wxSize(text_max, -1);
1220 auto ti_size = FromDIP(wxSize(120, -1));
1221
1222 LabeledStaticBox* stb =
new LabeledStaticBox(
this,
_L(
"Frequency settings"));
1223 wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
1224
1225 settings_sizer->AddSpacer(FromDIP(5));
1226
1227
1228 auto x_freq_sizer = new wxBoxSizer(wxHORIZONTAL);
1229 auto start_x_text =
new wxStaticText(
this, wxID_ANY, x_axis_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
1230 m_tiFreqStartX =
new TextInput(
this, std::to_string(15) ,
_L(
"Hz"),
"", wxDefaultPosition, ti_size);
1231 m_tiFreqStartX->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1232 m_tiFreqEndX =
new TextInput(
this, std::to_string(110),
_L(
"Hz"),
"", wxDefaultPosition, ti_size);
1233 m_tiFreqEndX->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1234
1235 x_freq_sizer->Add(start_x_text , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1236 x_freq_sizer->Add(
m_tiFreqStartX, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1237 x_freq_sizer->Add(
m_tiFreqEndX , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1238 settings_sizer->Add(x_freq_sizer, 0, wxLEFT, FromDIP(3));
1239
1240
1241 auto y_freq_sizer = new wxBoxSizer(wxHORIZONTAL);
1242 auto start_y_text =
new wxStaticText(
this, wxID_ANY, y_axis_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
1243 m_tiFreqStartY =
new TextInput(
this, std::to_string(15) ,
_L(
"Hz"),
"", wxDefaultPosition, ti_size);
1244 m_tiFreqStartY->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1245 m_tiFreqEndY =
new TextInput(
this, std::to_string(110),
_L(
"Hz"),
"", wxDefaultPosition, ti_size);
1246 m_tiFreqEndY->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1247
1248 y_freq_sizer->Add(start_y_text , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1249 y_freq_sizer->Add(
m_tiFreqStartY, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1250 y_freq_sizer->Add(
m_tiFreqEndY , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1251 settings_sizer->Add(y_freq_sizer, 0, wxLEFT, FromDIP(3));
1252
1253 if (reprap_firmware) {
1256 start_y_text->Hide();
1259 settings_sizer->Hide(y_freq_sizer);
1260 start_x_text->SetLabel(
_L(
"Frequency (Start / End): "));
1261 m_tiFreqStartX->GetTextCtrl()->SetToolTip(
_L(
"RepRap firmware uses the same frequency range for both axes."));
1262 m_tiFreqEndX->GetTextCtrl()->SetToolTip(
_L(
"RepRap firmware uses the same frequency range for both axes."));
1263 }
1264
1265
1266 wxString damping_factor_str =
_L(
"Damp: ");
1267 auto damping_factor_sizer = new wxBoxSizer(wxHORIZONTAL);
1268 auto damping_factor_text =
new wxStaticText(
this, wxID_ANY, damping_factor_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
1269 m_tiDampingFactor =
new TextInput(
this, wxString::Format(
"%.3f", 0.15),
"",
"", wxDefaultPosition, ti_size);
1270 m_tiDampingFactor->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
1271
1272 damping_factor_sizer->Add(damping_factor_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1273 damping_factor_sizer->Add(
m_tiDampingFactor , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
1274 settings_sizer->Add(damping_factor_sizer, 0, wxLEFT, FromDIP(3));
1275
1276 settings_sizer->AddSpacer(FromDIP(5));
1277
1278 auto note_text =
new wxStaticText(
this, wxID_ANY,
_L(
"Recommended: Set Damp to 0.\nThis will use the printer's default or saved value."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
1279 note_text->SetForegroundColour(wxColour(128, 128, 128));
1280 note_text->Wrap(FromDIP(350));
1281 settings_sizer->Add(note_text, 0, wxALL, FromDIP(5));
1282
1283 settings_sizer->AddSpacer(FromDIP(5));
1284
1285 v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
1286 v_sizer->AddSpacer(FromDIP(5));
1287
1288 auto dlg_btns = new DialogButtons(this, {"OK"});
1289
1290 auto bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
1291
1292 auto wiki_btn = new Button(this, "", "toolbar_wiki", 0, 15);
1293 auto wiki_url = "https://www.orcaslicer.com/wiki/input_shaping_calib";
1294 wiki_btn->SetToolTip(
_L(
"Wiki Guide") +
"\n" + wiki_url);
1296 wiki_btn->SetCanFocus(false);
1297 wiki_btn->Bind(wxEVT_LEFT_DOWN, ([wiki_url](auto& e) {wxLaunchDefaultBrowser(wiki_url);}));
1298
1299 bottom_sizer->Add(wiki_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(10));
1300 bottom_sizer->AddStretchSpacer();
1301 bottom_sizer->Add(dlg_btns, 0, wxEXPAND);
1302 v_sizer->Add(bottom_sizer, 0, wxEXPAND);
1303
1305
1306 wxGetApp().UpdateDlgDarkUI(this);
1307
1308 Layout();
1309 Fit();
1310 v_sizer->SetSizeHints(this);
1311}
#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< wxString > make_shaper_type_labels()
Definition calib_dlg.cpp:115
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
@ gcfKlipper
Definition PrintConfig.hpp:53
@ gcfRepRapFirmware
Definition PrintConfig.hpp:54
@ gcfMarlinLegacy
Definition PrintConfig.hpp:52