Skip to content

Commit

Permalink
Do not save config while config is in the loading phase
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Jan 29, 2024
1 parent 8e24b43 commit 9bbf00e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libs/indibase/defaultdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ bool DefaultDevice::saveConfig(INDI::Property &property)
bool DefaultDevice::saveConfig(bool silent, const char *property)
{
D_PTR(DefaultDevice);
if (d->isConfigLoading)
return false;
silent = false;
char errmsg[MAXRBUF] = {0};

Expand Down Expand Up @@ -864,7 +866,8 @@ bool DefaultDevice::initProperties()
snprintf(interfaceStr, 16, "%d", getDriverInterface());

// Connection Mode
d->ConnectionModeSP.onUpdate([d](){
d->ConnectionModeSP.onUpdate([d]()
{
int activeConnectionMode = d->ConnectionModeSP.findOnSwitchIndex();

if (activeConnectionMode >= 0 && activeConnectionMode < static_cast<int>(d->connections.size()))
Expand Down Expand Up @@ -893,7 +896,7 @@ bool DefaultDevice::initProperties()
d->ConnectionSP[INDI_ENABLED ].fill("CONNECT", "Connect", ISS_OFF);
d->ConnectionSP[INDI_DISABLED].fill("DISCONNECT", "Disconnect", ISS_ON);
d->ConnectionSP.fill(getDeviceName(), INDI::SP::CONNECTION, "Connection", "Main Control", IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
d->ConnectionSP.onNewValues([this](const INDI::PropertySwitch::NewValues &values)
d->ConnectionSP.onNewValues([this](const INDI::PropertySwitch::NewValues & values)
{
if (values.contains("CONNECT", ISS_ON))
{
Expand Down

0 comments on commit 9bbf00e

Please sign in to comment.