From d7a9b7364f41be644d794bfb61cb4b84193b30d5 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Fri, 27 Feb 2026 18:02:41 +0300 Subject: [PATCH] ... --- asibfm700_configfile.h | 7 ++++--- asibfm700_mount.cpp | 16 ++++++++++++++-- asibfm700_servocontroller.cpp | 9 +++++++++ asibfm700_servocontroller.h | 2 ++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/asibfm700_configfile.h b/asibfm700_configfile.h index 8eb6b0b..10ff142 100644 --- a/asibfm700_configfile.h +++ b/asibfm700_configfile.h @@ -145,8 +145,8 @@ static auto Asibfm700MountConfigDefaults = std::make_tuple( // target-mount coordinate difference in arcsecs to start adjusting of slewing simple_config_record_t{"adjustCoordDiff", - 50.0, - {"target-mount coordinate difference in arcsecs to start adjusting of slewing"}}, + 5.5, + {"target-mount coordinate difference in degress to start adjusting of slewing"}}, // minimum time in millisecs between two successive adjustments simple_config_record_t{"adjustCycleInterval", @@ -612,7 +612,8 @@ public: pars.slewRateY = getValue("hwMaxRateDEC").value_or(pars.slewRateY); pars.adjustCoordDiff = - getValue("adjustCoordDiff").value_or(pars.adjustCoordDiff) * arcsecs2rad; + getValue("adjustCoordDiff").value_or(pars.adjustCoordDiff) * + mcc::MCC_DEGRESS_TO_RADS; pars.adjustCycleInterval = getValue("adjustCycleInterval").value_or(pars.adjustCycleInterval); diff --git a/asibfm700_mount.cpp b/asibfm700_mount.cpp index 2e0c347..5ff4d9e 100644 --- a/asibfm700_mount.cpp +++ b/asibfm700_mount.cpp @@ -33,9 +33,12 @@ Asibfm700Mount::Asibfm700Mount(Asibfm700MountConfig const& config, std::shared_p Asibfm700Mount::~Asibfm700Mount() { - stoppingImpl(); + *_lastMountError = stoppingImpl(); + if (_lastMountError->load()) { + errorLogging("an error occured while stopping mount: ", _lastMountError->load()); + } - Mount.quit(); + _servolController.hardwareShutdown(); logDebug("Delete Asibfm700Mount class instance ({})", this->getThreadId()); } @@ -490,6 +493,8 @@ Asibfm700Mount::error_t Asibfm700Mount::slewingImpl(bool slew_and_stop) } } + *_stopMovementRequest = false; + _pathFile.clearPath(); _enteredBackupCoordinates = telemetry_t::getPointingTarget(); @@ -747,6 +752,8 @@ Asibfm700Mount::error_t Asibfm700Mount::trackingImpl() return mcc::impl::MccGenericMovementControlsErrorCode::ERROR_OK; } + *_stopMovementRequest = false; + *_mountStatus = mount_status_t::MOUNT_STATUS_TRACKING; _pathFile.clearPath(); @@ -877,6 +884,8 @@ Asibfm700Mount::error_t Asibfm700Mount::trackingImpl() Asibfm700Mount::error_t Asibfm700Mount::stoppingImpl() { + logInfo("Stop mount requested"); + *_stopMovementRequest = true; typename AsibFM700ServoController::hardware_state_t hw_state; @@ -892,6 +901,8 @@ Asibfm700Mount::error_t Asibfm700Mount::stoppingImpl() *_lastMountError = _servolController.hardwareGetState(&hw_state); + logDebug(" wait for mount stopping (timeout is {} seconds) ...", + _mountConfig.getValue("stopTimeout").value().count()); while (hw_state.movementState != AsibFM700ServoController::hardware_movement_state_t::HW_MOVE_STOPPED && !_lastMountError->load()) { if ((std::chrono::steady_clock::now() - start_tp) > @@ -909,6 +920,7 @@ Asibfm700Mount::error_t Asibfm700Mount::stoppingImpl() if (!_lastMountError->load()) { *_mountStatus = mount_status_t::MOUNT_STATUS_IDLE; *_lastMountError = mcc::impl::MccGenericMovementControlsErrorCode::ERROR_OK; + logInfo("The mount is stopped!"); } else { *_mountStatus = mount_status_t::MOUNT_STATUS_ERROR; errorLogging("An error occured while stoppping mount: ", _lastMountError->load()); diff --git a/asibfm700_servocontroller.cpp b/asibfm700_servocontroller.cpp index 7ed192f..3b8c530 100644 --- a/asibfm700_servocontroller.cpp +++ b/asibfm700_servocontroller.cpp @@ -100,6 +100,15 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareInit() } +AsibFM700ServoController::error_t AsibFM700ServoController::hardwareShutdown() +{ + Mount.quit(); + + return AsibFM700ServoControllerErrorCode::ERROR_OK; +} + + + AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(hardware_state_t const& state) { std::lock_guard lock{*_setStateMutex}; diff --git a/asibfm700_servocontroller.h b/asibfm700_servocontroller.h index eb9aa6d..67ff75f 100644 --- a/asibfm700_servocontroller.h +++ b/asibfm700_servocontroller.h @@ -123,6 +123,8 @@ public: error_t hardwareInit(); + error_t hardwareShutdown(); + void hardwareUpdateConfig(conf_t cfg); // save config to EEPROM