Skip to content

Commit

Permalink
Use consistent config load variables for both input and output interf…
Browse files Browse the repository at this point in the history
…aces
  • Loading branch information
knro committed Jan 22, 2025
1 parent 6500b91 commit 1722955
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libs/indibase/indiinputinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ InputInterface::~InputInterface()
void InputInterface::initProperties(const char *groupName, uint8_t digital, uint8_t analog,
const std::string &digitalPrefix, const std::string &analogPrefix)
{
m_DigitalLabelConfig = false;
m_AnalogLabelConfig = false;
m_DigitalInputLabelsConfig = false;
m_AnalogInputLabelsConfig = false;
DigitalInputLabelsTP.resize(0);
// Digital labels
for (size_t i = 0; i < digital; i++)
Expand All @@ -64,7 +64,7 @@ void InputInterface::initProperties(const char *groupName, uint8_t digital, uint
DigitalInputLabelsTP.fill(m_defaultDevice->getDeviceName(), "DIGITAL_INPUT_LABELS", "Digital Labels", groupName, IP_RW, 60,
IPS_IDLE);
DigitalInputLabelsTP.shrink_to_fit();
m_DigitalLabelConfig = DigitalInputLabelsTP.load();
m_DigitalInputLabelsConfig = DigitalInputLabelsTP.load();
}

// Analog labels
Expand All @@ -84,7 +84,7 @@ void InputInterface::initProperties(const char *groupName, uint8_t digital, uint
AnalogInputLabelsTP.fill(m_defaultDevice->getDeviceName(), "ANALOG_INPUT_LABELS", "Analog Labels", groupName, IP_RW, 60,
IPS_IDLE);
AnalogInputLabelsTP.shrink_to_fit();
m_AnalogLabelConfig = AnalogInputLabelsTP.load();
m_AnalogInputLabelsConfig = AnalogInputLabelsTP.load();
}

// Analog inputs
Expand Down
2 changes: 1 addition & 1 deletion libs/indibase/indiinputinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class InputInterface

// Indicates whether we loaded the labels from configuration file successfully.
// If loaded from config file, then we do not need to overwrite.
bool m_DigitalLabelConfig {false}, m_AnalogLabelConfig {false};
bool m_DigitalInputLabelsConfig {false}, m_AnalogInputLabelsConfig {false};

DefaultDevice *m_defaultDevice { nullptr };
};
Expand Down
3 changes: 2 additions & 1 deletion libs/indibase/indioutputinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ OutputInterface::~OutputInterface()
/////////////////////////////////////////////////////////////////////////////////////////////
void OutputInterface::initProperties(const char *groupName, uint8_t Outputs, const std::string &prefix)
{
m_DigitalOutputLabelsConfig = false;
DigitalOutputLabelsTP.resize(0);

// Initialize labels
Expand All @@ -61,7 +62,7 @@ void OutputInterface::initProperties(const char *groupName, uint8_t Outputs, con
IPS_IDLE);
DigitalOutputLabelsTP.shrink_to_fit();
if (Outputs > 0)
DigitalOutputLabelsTP.load();
m_DigitalOutputLabelsConfig = DigitalOutputLabelsTP.load();

DigitalOutputsSP.reserve(Outputs);
// Initialize switches, use labels if loaded.
Expand Down
4 changes: 4 additions & 0 deletions libs/indibase/indioutputinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class OutputInterface
// Output Labels
INDI::PropertyText DigitalOutputLabelsTP {0};

// Indicates whether we loaded the labels from configuration file successfully.
// If loaded from config file, then we do not need to overwrite.
bool m_DigitalOutputLabelsConfig {false};

DefaultDevice *m_defaultDevice { nullptr };
};
}

0 comments on commit 1722955

Please sign in to comment.