mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-15 08:59:39 -07:00
PA Calib Values check (#11493)
* Add input validation for acceleration and speed values Added a check to ensure that acceleration values are greater than speed values in the PA calibration dialog. Displays a warning message and prevents calibration if the inputs are invalid to guard against swapped or incorrect user entries. * Add input validation for calibration parameters
This commit is contained in:
parent
f9d5519294
commit
c126aae902
1 changed files with 13 additions and 0 deletions
|
|
@ -284,6 +284,19 @@ void PA_Calibration_Dlg::on_start(wxCommandEvent& event) {
|
|||
ParseStringValues(m_tiBMAccels->GetTextCtrl()->GetValue().ToStdString(), m_params.accelerations);
|
||||
ParseStringValues(m_tiBMSpeeds->GetTextCtrl()->GetValue().ToStdString(), m_params.speeds);
|
||||
|
||||
if (!m_params.accelerations.empty() && !m_params.speeds.empty()) {
|
||||
// Guard against swapped inputs by ensuring acceleration magnitudes exceed speeds.
|
||||
const double min_accel = *std::min_element(m_params.accelerations.begin(), m_params.accelerations.end());
|
||||
const double max_speed = *std::max_element(m_params.speeds.begin(), m_params.speeds.end());
|
||||
if (min_accel <= max_speed) {
|
||||
MessageDialog msg_dlg(nullptr,
|
||||
_L("Acceleration values must be greater than speed values.\nPlease verify the inputs."),
|
||||
wxEmptyString, wxICON_WARNING | wxOK);
|
||||
msg_dlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_plater->calib_pa(m_params);
|
||||
EndModal(wxID_OK);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue