From 9bbf00e0d1b6bd9661c9721dbf4f26bbabd83778 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Mon, 29 Jan 2024 15:51:25 +0300 Subject: [PATCH] Do not save config while config is in the loading phase --- libs/indibase/defaultdevice.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/indibase/defaultdevice.cpp b/libs/indibase/defaultdevice.cpp index 6b723e0d09..68dbe95b01 100644 --- a/libs/indibase/defaultdevice.cpp +++ b/libs/indibase/defaultdevice.cpp @@ -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}; @@ -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(d->connections.size())) @@ -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)) {