This commit is contained in:
2026-02-26 12:13:39 +03:00
parent d9cb52f755
commit 8aa58b727b
2 changed files with 30 additions and 6 deletions

View File

@@ -147,9 +147,9 @@ public:
std::tuple<MoveCntrCtorTs...> move_cntrl_ctor_ars,
std::tuple<LoggerCtorTs...> logger_ctor_args)
: TELEMETRY_T(std::make_from_tuple<TELEMETRY_T>(std::move(telemetry_ctor_args))),
PZONE_CONT_T(std::make_from_tuple<PZONE_CONT_T>(pzone_cont_ctor_ars)),
MOVE_CNTRL_T(std::make_from_tuple<MOVE_CNTRL_T>(move_cntrl_ctor_ars)),
LOGGER_T(std::make_from_tuple<LOGGER_T>(logger_ctor_args))
PZONE_CONT_T(std::make_from_tuple<PZONE_CONT_T>(std::move(pzone_cont_ctor_ars))),
MOVE_CNTRL_T(std::make_from_tuple<MOVE_CNTRL_T>(std::move(move_cntrl_ctor_ars))),
LOGGER_T(std::make_from_tuple<LOGGER_T>(std::move(logger_ctor_args)))
{
// logDebug(std::format("Create MccGenericMount class instance (thread: {})", std::this_thread::get_id()));
logDebug("Create MccGenericMount class instance (thread: {})", std::this_thread::get_id());
@@ -194,7 +194,7 @@ public:
error_t initMount()
{
logInfo(std::format("Start MccGenericMount class initialization (thread: {}) ...", std::this_thread::get_id()));
logInfo("Start MccGenericMount class initialization (thread: {}) ...", std::this_thread::get_id());
*_mountStatus = mount_status_t::MOUNT_STATUS_IDLE;

View File

@@ -21,10 +21,15 @@
namespace mcc::impl
{
// mount movement-related generic errors
enum class MccGenericMovementControlsErrorCode : int {
ERROR_OK,
ERROR_IN_PZONE,
ERRROR_NEAR_PZONE,
ERROR_NEAR_PZONE,
ERROR_SLEW_TIMEOUT,
ERROR_STOP_TIMEOUT,
ERROR_HARDWARE,
ERROR_TELEMETRY_TIMEOUT
};
} // namespace mcc::impl
@@ -56,8 +61,14 @@ struct MccGenericMovementControlsErrorCategory : std::error_category {
return "OK";
case MccGenericMovementControlsErrorCode::ERROR_IN_PZONE:
return "target is in zone";
case MccGenericMovementControlsErrorCode::ERRROR_NEAR_PZONE:
case MccGenericMovementControlsErrorCode::ERROR_NEAR_PZONE:
return "mount is near zone";
case MccGenericMovementControlsErrorCode::ERROR_SLEW_TIMEOUT:
return "a timeout occured while slewing";
case MccGenericMovementControlsErrorCode::ERROR_STOP_TIMEOUT:
return "a timeout occured while mount stopping";
case MccGenericMovementControlsErrorCode::ERROR_HARDWARE:
return "a hardware error occured";
case MccGenericMovementControlsErrorCode::ERROR_TELEMETRY_TIMEOUT:
return "telemetry data timeout";
default:
@@ -139,6 +150,15 @@ struct MccMovementPathFile {
}
}
// comment corresponded to addToPath(mcc_telemetry_data_c auto const& tdata)
void addDefaultComment()
{
addComment("Format (time is in milliseconds, coordinates are in degrees):");
addComment(
" <UNIXTIME> <mount X> <mount Y> <target X> <target Y> <dX_{mount-target}> "
"<dY_{mount-target}> <mount-to-target-distance> <moving state>");
}
// general purpose method
// template <std::formattable<char>... ArgTs>
// void addToPath(std::format_string<ArgTs...> fmt, ArgTs&&... args)
@@ -187,6 +207,10 @@ struct MccMovementPathFile {
bool saveToFile(std::string const& filename, std::ios_base::openmode mode = std::ios_base::trunc)
{
if (filename.empty()) {
return true;
}
std::ofstream fst(filename, mode);
if (fst.is_open()) {