Skip to content

Commit

Permalink
Persist settings that had to be adjusted for out-of-range values
Browse files Browse the repository at this point in the history
  • Loading branch information
daleghent committed Oct 31, 2024
1 parent 5eb56f4 commit 45f159f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cam_qhy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ bool Camera_QHY::SetQhyGain(int gainPercent)
{
double gain = m_gainMin + gainPercent * (m_gainMax - m_gainMin) / 100.0;

if (gain != 0.)
if (gain != 0)
gain = floor(gain / m_gainStep) * m_gainStep;

uint32_t rv = SetQHYCCDParam(m_camhandle, CONTROL_GAIN, gain);
Expand Down Expand Up @@ -1120,6 +1120,9 @@ bool Camera_QHY::SetQhyOffset(int offset)
if (offset != 0)
offset = floor(offset / m_offsetStep) * m_offsetStep;

if (offset != m_offset)
pConfig->Profile.SetInt(CONFIG_PATH_QHY_OFFSET, offset);

uint32_t rv = SetQHYCCDParam(m_camhandle, CONTROL_OFFSET, (double)offset);

if (rv != QHYCCD_SUCCESS)
Expand Down Expand Up @@ -1150,6 +1153,9 @@ bool Camera_QHY::SetQhyUsbTraffic(int usbTraffic)
if (usbTraffic != 0)
usbTraffic = floor(usbTraffic / m_usbTrafficStep) * m_usbTrafficStep;

if (usbTraffic != m_usbTraffic)
pConfig->Profile.SetInt(CONFIG_PATH_QHY_USBTRAFFIC, usbTraffic);

uint32_t rv = SetQHYCCDParam(m_camhandle, CONTROL_USBTRAFFIC, (double)usbTraffic);

if (rv != QHYCCD_SUCCESS)
Expand Down

0 comments on commit 45f159f

Please sign in to comment.