fix compilation with GCC version<15

This commit is contained in:
Timur A. Fatkhullin 2025-11-02 11:59:23 +03:00
parent 511956531e
commit c0f274cec0
6 changed files with 35 additions and 65 deletions

View File

@ -74,8 +74,7 @@ target_link_libraries(${ASIBFM700_LIB} PUBLIC mcc ASIO::ASIO spdlog ERFA_LIB bsp
set(ASIBFM700_NETSERVER_APP asibfm700_netserver)
add_executable(${ASIBFM700_NETSERVER_APP} asibfm700_netserver_main.cpp)
# target_link_libraries(${ASIBFM700_NETSERVER_APP} PRIVATE mcc spdlog ${ASIBFM700_LIB})
target_link_libraries(${ASIBFM700_NETSERVER_APP} PRIVATE cxxopts ${ASIBFM700_LIB})
target_link_libraries(${ASIBFM700_NETSERVER_APP} PRIVATE cxxopts::cxxopts ${ASIBFM700_LIB})
option(WITH_TESTS "Build tests" ON)

View File

@ -437,54 +437,54 @@ public:
hw_cfg.hwConfig = {};
hw_cfg.MountDevPath = getValue<std::string>("MountDevPath").value_or({});
hw_cfg.EncoderDevPath = getValue<std::string>("EncoderDevPath").value_or({});
hw_cfg.EncoderXDevPath = getValue<std::string>("EncoderXDevPath").value_or({});
hw_cfg.EncoderYDevPath = getValue<std::string>("EncoderYDevPath").value_or({});
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{});
hw_cfg.EncoderYDevPath = getValue<std::string>("EncoderYDevPath").value_or(std::string{});
hw_cfg.devConfig.MountDevPath = hw_cfg.MountDevPath.data();
hw_cfg.devConfig.EncoderDevPath = hw_cfg.EncoderDevPath.data();
hw_cfg.devConfig.EncoderXDevPath = hw_cfg.EncoderXDevPath.data();
hw_cfg.devConfig.EncoderYDevPath = hw_cfg.EncoderYDevPath.data();
hw_cfg.devConfig.RunModel = getValue<int>("RunModel").value_or({});
hw_cfg.devConfig.MountDevSpeed = getValue<int>("MountDevSpeed").value_or({});
hw_cfg.devConfig.EncoderDevSpeed = getValue<int>("EncoderDevSpeed").value_or({});
hw_cfg.devConfig.SepEncoder = getValue<int>("SepEncoder").value_or({});
hw_cfg.devConfig.RunModel = getValue<int>("RunModel").value_or(int{});
hw_cfg.devConfig.MountDevSpeed = getValue<int>("MountDevSpeed").value_or(int{});
hw_cfg.devConfig.EncoderDevSpeed = getValue<int>("EncoderDevSpeed").value_or(int{});
hw_cfg.devConfig.SepEncoder = getValue<int>("SepEncoder").value_or(int{});
std::chrono::duration<double> secs; // seconds as floating-point
secs = getValue<std::chrono::milliseconds>("MountReqInterval").value_or({});
secs = getValue<std::chrono::milliseconds>("MountReqInterval").value_or(std::chrono::milliseconds{});
hw_cfg.devConfig.MountReqInterval = secs.count();
secs = getValue<std::chrono::milliseconds>("EncoderReqInterval").value_or({});
secs = getValue<std::chrono::milliseconds>("EncoderReqInterval").value_or(std::chrono::milliseconds{});
hw_cfg.devConfig.EncoderReqInterval = secs.count();
secs = getValue<std::chrono::milliseconds>("EncoderSpeedInterval").value_or({});
secs = getValue<std::chrono::milliseconds>("EncoderSpeedInterval").value_or(std::chrono::milliseconds{});
hw_cfg.devConfig.EncoderSpeedInterval = secs.count();
std::vector<double> pid = getValue<std::vector<double>>("XPIDC").value_or({});
std::vector<double> pid = getValue<std::vector<double>>("XPIDC").value_or(std::vector<double>{});
if (pid.size() > 2) {
hw_cfg.devConfig.XPIDC.P = pid[0];
hw_cfg.devConfig.XPIDC.I = pid[1];
hw_cfg.devConfig.XPIDC.D = pid[2];
}
pid = getValue<std::vector<double>>("XPIDV").value_or({});
pid = getValue<std::vector<double>>("XPIDV").value_or(std::vector<double>{});
if (pid.size() > 2) {
hw_cfg.devConfig.XPIDV.P = pid[0];
hw_cfg.devConfig.XPIDV.I = pid[1];
hw_cfg.devConfig.XPIDV.D = pid[2];
}
pid = getValue<std::vector<double>>("YPIDC").value_or({});
pid = getValue<std::vector<double>>("YPIDC").value_or(std::vector<double>{});
if (pid.size() > 2) {
hw_cfg.devConfig.YPIDC.P = pid[0];
hw_cfg.devConfig.YPIDC.I = pid[1];
hw_cfg.devConfig.YPIDC.D = pid[2];
}
pid = getValue<std::vector<double>>("YPIDV").value_or({});
pid = getValue<std::vector<double>>("YPIDV").value_or(std::vector<double>{});
if (pid.size() > 2) {
hw_cfg.devConfig.YPIDV.P = pid[0];
hw_cfg.devConfig.YPIDV.I = pid[1];
@ -657,19 +657,19 @@ public:
fname = mcc::utils::trimSpaces(val);
setValue("bulletinAFilename", fname);
val = getValue<std::string>("MountDevPath").value_or({});
val = getValue<std::string>("MountDevPath").value_or(std::string{});
fname = mcc::utils::trimSpaces(val);
setValue("MountDevPath", fname);
val = getValue<std::string>("EncoderDevPath").value_or({});
val = getValue<std::string>("EncoderDevPath").value_or(std::string{});
fname = mcc::utils::trimSpaces(val);
setValue("EncoderDevPath", fname);
val = getValue<std::string>("EncoderXDevPath").value_or({});
val = getValue<std::string>("EncoderXDevPath").value_or(std::string{});
fname = mcc::utils::trimSpaces(val);
setValue("EncoderXDevPath", fname);
val = getValue<std::string>("EncoderYDevPath").value_or({});
val = getValue<std::string>("EncoderYDevPath").value_or(std::string{});
fname = mcc::utils::trimSpaces(val);
setValue("EncoderYDevPath", fname);
}

View File

@ -5,7 +5,7 @@ namespace asibfm700
const char* AsibFM700ServoControllerErrorCategory::name() const noexcept
{
return "ASIBFM700-ERROR-CATEGORY";
return "ASIBFM700-SERVOCONTROLLER-ERROR-CATEGORY";
}
std::string AsibFM700ServoControllerErrorCategory::message(int ec) const
@ -149,7 +149,7 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareGetState(har
state->time_point = tp_t{std::chrono::duration_cast<tp_t::duration>(secs)};
}
// WARNING: TEMPORARY (WAIT FOR Eddy fix its implementation of LibSidServo)!!!
state->time_point = decltype(state->time_point)::clock::now();
// state->time_point = decltype(state->time_point)::clock::now();
// according to "SiTech protocol notes" X is DEC-axis and Y is HA-axis
state->X = mdata.encYposition.val;

View File

@ -57,7 +57,7 @@ int main()
} else {
auto v3 = kvh.getValue<std::vector<int>>("E");
std::cout << "[";
for (auto& el : v3.value_or({0, 0, 0})) {
for (auto& el : v3.value_or(std::vector<int>{0, 0, 0})) {
std::cout << el << " ";
}
std::cout << "]\n";

View File

@ -35,10 +35,7 @@ struct MccJulianDay {
MccJulianDay(double jd) : mjd(jd - MJD0) {}
constexpr operator double() const
{
return MccJulianDay::MJD0 + mjd;
}
constexpr operator double() const { return MccJulianDay::MJD0 + mjd; }
MccJulianDay& operator=(double jd)
{
@ -47,17 +44,11 @@ struct MccJulianDay {
return *this;
}
double MJD() const
{
return mjd;
}
double MJD() const { return mjd; }
constexpr auto operator<=>(const MccJulianDay&) const = default;
constexpr auto operator<=>(double v) const
{
return v <=> (MccJulianDay::MJD0 + mjd);
};
constexpr auto operator<=>(double v) const { return v <=> (MccJulianDay::MJD0 + mjd); };
protected:
double mjd{51544.5}; // J2000.0
@ -229,10 +220,7 @@ public:
return _MJD;
}
double MJD() const
{
return _MJD;
}
double MJD() const { return _MJD; }
template <typename DT>
std::chrono::sys_time<DT> UTC() const
@ -240,10 +228,7 @@ public:
return std::chrono::time_point_cast<DT>(_UTC);
}
std::chrono::system_clock::time_point UTC() const
{
return _UTC;
}
std::chrono::system_clock::time_point UTC() const { return _UTC; }
template <traits::mcc_output_char_range R>
@ -268,20 +253,11 @@ public:
return r;
}
std::string JEpoch(uint8_t prec = 0) const
{
return JEpoch<std::string>(prec);
}
std::string JEpoch(uint8_t prec = 0) const { return JEpoch<std::string>(prec); }
auto operator<=>(const MccCelestialCoordEpoch& rhs) const
{
return _UTC <=> rhs._UTC;
}
auto operator<=>(const MccCelestialCoordEpoch& rhs) const { return _UTC <=> rhs._UTC; }
auto operator==(const MccCelestialCoordEpoch& rhs) const
{
return _UTC == rhs._UTC;
}
auto operator==(const MccCelestialCoordEpoch& rhs) const { return _UTC == rhs._UTC; }
protected:
std::chrono::system_clock::time_point _UTC;
@ -635,15 +611,9 @@ public:
virtual ~MccCoordinateSerializer() = default;
void setFormat(SerializedCoordFormat fmt)
{
_currentFormat = fmt;
}
void setFormat(SerializedCoordFormat fmt) { _currentFormat = fmt; }
void setPrecision(SexagesimalCoordPrec prec)
{
_currentPrec = std::move(prec);
}
void setPrecision(SexagesimalCoordPrec prec) { _currentPrec = std::move(prec); }
template <traits::mcc_input_char_range R>
void setDelimiter(R&& delim)
@ -744,6 +714,7 @@ public:
toSexagesimalDeg(bytes, value.Y);
}
std::format_to(std::back_inserter(bytes), "{}", _delimiter);
serializePairKindTimePoint(value, bytes);
}
};

View File

@ -34,7 +34,7 @@ int main()
std::cout << "msg.par[2] = <" << msg2.param(2) << ">\n";
auto p2 = msg2.paramValue<std::chrono::seconds>(2);
std::cout << "msg.par[2] = <" << p2.value_or({}) << ">\n";
std::cout << "msg.par[2] = <" << p2.value_or(std::chrono::seconds{}) << ">\n";
std::cout << "msg.par[3] = <";
auto p3 = msg2.paramValue<decltype(vd)>(3);