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

@@ -9,7 +9,7 @@
#include <mcc/mcc_pcm_fit.h>
#include "asibfm700_config.h"
#include "asibfm700_configfile.h"
// #include "asibfm700_configfile.h"
// static constexpr mcc::MccMountType MOUNT_TYPE{mcc::MccMountType::CROSSAXIS_TYPE};
@@ -37,13 +37,14 @@ int main(int argc, char* argv[])
mcc::impl::MccPCMFitter<asibfm700::asibfm700MountType> pcm_fitter;
mcc::impl::MccPCMFitter<asibfm700::asibfm700MountType>::compute_params_t comp_pars;
asibfm700::Asibfm700MountConfig mount_cfg;
asibfm700::Asibfm700MountConfiguration cfg;
// asibfm700::Asibfm700MountConfig mount_cfg;
asibfm700::Asibfm700MountConfiguration mount_cfg;
// asibfm700::Asibfm700MountConfiguration cfg;
cfg.dumpDefaultsToFile("eecc.cfg");
// cfg.dumpDefaultsToFile("eecc.cfg");
cfg.load("eecc.cfg");
cfg.save("eecc.cfg1");
// cfg.load("eecc.cfg");
// cfg.save("eecc.cfg1");
try {
auto opt_result = options.parse(argc, argv);
@@ -289,6 +290,60 @@ int main(int argc, char* argv[])
return 200;
}
// change corresponded mount config items
if (comp_result.pcm_type == mcc::impl::MccDefaultPCMType::PCM_TYPE_GEOMETRY_BSPLINE
#ifdef USE_BSPLINE_PCM
|| comp_result.pcm_type == mcc::impl::MccDefaultPCMType::PCM_TYPE_GEOMETRY)
#endif
{
auto err = mount_cfg.setValue("pcmGeomCoeffs", pcm_data.geomCoefficients);
if (err) {
std::println("Unexpected error while setting geometric coefficiens to mount configuration! (err = {})",
err.message());
return 300;
}
#ifdef USE_BSPLINE_PCM
} else if (comp_result.pcm_type == mcc::impl::MccDefaultPCMType::PCM_TYPE_GEOMETRY_BSPLINE ||
comp_result.pcm_type == mcc::impl::MccDefaultPCMType::PCM_TYPE_BSPLINE) {
auto err = mount_cfg.setValue("pcmBsplineXcoeffs", pcm_data.bspline.coeffsX);
if (err) {
std::println(
"Unexpected error while setting B-spline HA-coefficiens to mount configuration! (err = {})",
err.message());
return 300;
}
err = mount_cfg.setValue("pcmBsplineYcoeffs", pcm_data.bspline.coeffsY);
if (err) {
std::println(
"Unexpected error while setting B-spline DEC-coefficiens to mount configuration! (err = {})",
err.message());
return 300;
}
if (comp_result.pcm_type == mcc::impl::MccDefaultPCMType::PCM_TYPE_BSPLINE) {
err = mount_cfg.setValue("pcmInverseBsplineXcoeffs", pcm_data.bspline.inverseCoeffsX);
if (err) {
std::println(
"Unexpected error while setting inverse B-spline HA-coefficiens to mount configuration! (err = "
"{})",
err.message());
return 300;
}
err = mount_cfg.setValue("pcmInverseBsplineYcoeffs", pcm_data.bspline.inverseCoeffsY);
if (err) {
std::println(
"Unexpected error while setting inverse B-spline DEC-coefficiens to mount configuration! (err "
"= {})",
err.message());
return 300;
}
}
#endif
}
mount_cfg.save(); // NOTE: THE SAME FILENAME!
auto tab = pcm_fitter.getPCMTable();
std::ofstream ofst;