Skip to content

Commit

Permalink
Add flags loading configuration for inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Jul 26, 2024
1 parent 572f76c commit 49ad189
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libs/indibase/indiinputinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +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;
DigitalInputLabelsTP.reserve(digital);
// Digital labels
for (size_t i = 0; i < digital; i++)
Expand All @@ -62,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();
DigitalInputLabelsTP.load();
m_DigitalLabelConfig = DigitalInputLabelsTP.load();
}

// Analog labels
Expand All @@ -82,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();
AnalogInputLabelsTP.load();
m_AnalogLabelConfig = AnalogInputLabelsTP.load();
}

// Analog inputs
Expand Down
4 changes: 4 additions & 0 deletions libs/indibase/indiinputinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class InputInterface
// Analog Input Labels
INDI::PropertyText AnalogInputLabelsTP {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_DigitalLabelConfig {false}, m_AnalogLabelConfig {false};

DefaultDevice *m_defaultDevice { nullptr };
};
}

0 comments on commit 49ad189

Please sign in to comment.