new config implementation

This commit is contained in:
2026-06-01 16:55:53 +03:00
parent e199a73640
commit a984f77351
2 changed files with 129 additions and 6 deletions

View File

@@ -131,6 +131,17 @@ static auto Asibfm700MountConfigurationDefaults = std::make_tuple(
/* hardware-related */
// hardware polling period in millisecs (used in hardwareSetState method; see asibfm700_servocontroller.cpp)
make_config_record("hardwarePollingPeriod",
std::chrono::milliseconds{300},
{"hardware driver polling period in millisecs"}),
// hardware polling timeout in millisecs (used in hardwareSetState method; see asibfm700_servocontroller.cpp)
make_config_record("hardwarePollingTimeout",
std::chrono::milliseconds{30000},
{"hardware driver polling timeout in millisecs"}),
// hardware mode: 1 - model mode, otherwise real mode
make_config_record("RunModel", 0, {" hardware mode: 1 - model mode, otherwise real mode"}),
@@ -253,6 +264,9 @@ static auto Asibfm700MountConfigurationDefaults = std::make_tuple(
// slew process timeout in seconds
make_config_record("slewTimeout", std::chrono::seconds(3600), {" slew process timeout in seconds"}),
// coordinates difference in arcsecs to stop slewing
make_config_record("slewToleranceRadius", 5.0, {"coordinates difference in arcsecs to stop slewing"}),
// slewing trajectory filename (used for debugging purposes)
// if it is an empty - just skip saving
make_config_record("slewingPathFilename",
@@ -552,6 +566,12 @@ public:
hw_cfg.hwConfig = {};
hw_cfg.pollingInterval =
getValue<std::chrono::milliseconds>("hardwarePollingPeriod").value_or(std::chrono::milliseconds(300));
hw_cfg.pollingInterval =
getValue<std::chrono::milliseconds>("hardwarePollingTimeout").value_or(std::chrono::milliseconds(30000));
hw_cfg.MountDevPath = getValue<std::string>("MountDevPath").value_or(std::string{});
hw_cfg.EncoderDevPath = getValue<std::string>("EncoderDevPath").value_or(std::string{});
hw_cfg.EncoderXDevPath = getValue<std::string>("EncoderXDevPath").value_or(std::string{});
@@ -756,6 +776,54 @@ public:
}
details::movement_pars_t movingModelParams() const
{
details::movement_pars_t pars;
auto get_value = [this]<typename VT>(std::string_view name, VT& val) {
val = getValue<VT>(name).value_or(val);
};
pars.telemetryTimeout =
getValue<decltype(pars.telemetryTimeout)>("telemetryTimeout").value_or(pars.telemetryTimeout);
pars.minTimeToPZone = getValue<decltype(pars.minTimeToPZone)>("minTimeToPZone").value_or(pars.minTimeToPZone);
pars.slewToleranceRadius =
getValue<decltype(pars.slewToleranceRadius)>("slewToleranceRadius").value_or(pars.slewToleranceRadius) *
mcc::MCC_ARCSECS_TO_RADS;
get_value("slewingTelemetryInterval", pars.slewingTelemetryInterval);
pars.slewRateX = getValue<decltype(pars.slewRateX)>("hwMaxRateHA").value_or(pars.slewRateX);
pars.slewRateY = getValue<decltype(pars.slewRateY)>("hwMaxRateDEC").value_or(pars.slewRateY);
pars.adjustCoordDiff =
getValue<decltype(pars.adjustCoordDiff)>("adjustCoordDiff").value_or(pars.adjustCoordDiff) *
mcc::MCC_DEGRESS_TO_RADS;
pars.slewTimeout = getValue<decltype(pars.slewTimeout)>("slewTimeout").value_or(pars.slewTimeout);
pars.slewingPathFilename =
getValue<decltype(pars.slewingPathFilename)>("slewingPathFilename").value_or(std::string());
get_value("trackingTelemetryInterval", pars.trackingTelemetryInterval);
pars.trackingCycleInterval = getValue<decltype(pars.trackingCycleInterval)>("trackingCycleInterval")
.value_or(pars.trackingCycleInterval);
pars.trackingMaxCoordDiff =
getValue<decltype(pars.trackingMaxCoordDiff)>("trackingMaxCoordDiff").value_or(pars.trackingMaxCoordDiff) *
mcc::MCC_ARCSECS_TO_RADS;
pars.trackingPathFilename =
getValue<decltype(pars.trackingPathFilename)>("trackingPathFilename").value_or(std::string());
return pars;
}
private:
std::filesystem::path _lastConfigPath{};