saving profile added
This commit is contained in:
@@ -148,6 +148,11 @@ class SweepControls(QGroupBox):
|
||||
self._minimum = minimum
|
||||
self._maximum = maximum
|
||||
self._step = step
|
||||
# Keep min <= max so every input state is a valid sweep, both when applied and when saved to a profile.
|
||||
minimum.valueChanged.connect(maximum.setMinimum)
|
||||
maximum.valueChanged.connect(minimum.setMaximum)
|
||||
maximum.setMinimum(minimum.value())
|
||||
minimum.setMaximum(maximum.value())
|
||||
self._step_period_us = _int_spinbox(
|
||||
SWEEP_STEP_PERIOD_MIN_US,
|
||||
SWEEP_STEP_PERIOD_MAX_US,
|
||||
|
||||
@@ -776,9 +776,24 @@ class MainWindow(QMainWindow):
|
||||
"",
|
||||
f"ds1809_apply={'true' if self._ds1809_profile_apply.isChecked() else 'false'}",
|
||||
f"ds1809_position_from_min={self._ds1809_profile_position.value()}",
|
||||
"",
|
||||
*self._build_sweep_profile_lines("laser2_current_sweep", self._laser2_sweep.settings()),
|
||||
"",
|
||||
*self._build_sweep_profile_lines("stm32_dac_sweep", self._stm32_dac_sweep.settings()),
|
||||
]
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
@staticmethod
|
||||
def _build_sweep_profile_lines(prefix: str, settings: SweepSettings) -> list[str]:
|
||||
return [
|
||||
f"{prefix}_enable={1 if settings.enabled else 0}",
|
||||
f"{prefix}_min_code={settings.min_code}",
|
||||
f"{prefix}_max_code={settings.max_code}",
|
||||
f"{prefix}_step_code={settings.step_code}",
|
||||
f"{prefix}_step_period_us={settings.step_period_us}",
|
||||
f"{prefix}_pause_ms={settings.pause_ms}",
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def _build_waveform_text(samples: list[int]) -> str:
|
||||
return "\n".join(str(sample) for sample in samples) + "\n"
|
||||
|
||||
Reference in New Issue
Block a user