...
This commit is contained in:
@@ -104,8 +104,10 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(har
|
|||||||
{
|
{
|
||||||
std::lock_guard lock{*_setStateMutex};
|
std::lock_guard lock{*_setStateMutex};
|
||||||
|
|
||||||
|
error_t err;
|
||||||
|
|
||||||
if (state.movementState == hardware_movement_state_t::HW_MOVE_STOPPING) { // stop!
|
if (state.movementState == hardware_movement_state_t::HW_MOVE_STOPPING) { // stop!
|
||||||
error_t err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.stop());
|
err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.stop());
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -136,37 +138,30 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(har
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static thread_local coordval_pair_t cvalpair{.X{0.0, 0.0}, .Y{0.0, 0.0}};
|
|
||||||
// static thread_local coordpair_t cpair{.X = 0.0, .Y = 0.0};
|
|
||||||
|
|
||||||
// cvalpair.X = {.val = state.Y, .t = tp};
|
|
||||||
// cvalpair.Y = {.val = state.X, .t = tp};
|
|
||||||
|
|
||||||
// cpair.X = state.tagY;
|
|
||||||
// cpair.Y = state.tagX;
|
|
||||||
|
|
||||||
// time point from sidservo library is 'double' number represented UNIXTIME with
|
|
||||||
// microseconds/nanoseconds precision
|
|
||||||
// double tp = std::chrono::duration<double>(state.time_point.time_since_epoch()).count();
|
|
||||||
|
|
||||||
|
|
||||||
// 2025-12-04: coordval_pair_t.X.t is now of type struct timespec
|
|
||||||
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(state.XY.epoch().UTC().time_since_epoch());
|
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(state.XY.epoch().UTC().time_since_epoch());
|
||||||
auto secs = std::chrono::floor<std::chrono::seconds>(ns);
|
auto secs = std::chrono::floor<std::chrono::seconds>(ns);
|
||||||
ns -= secs;
|
ns -= secs;
|
||||||
std::timespec tp{.tv_sec = secs.count(), .tv_nsec = ns.count()};
|
std::timespec tp{.tv_sec = secs.count(), .tv_nsec = ns.count()};
|
||||||
|
|
||||||
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
|
||||||
coordval_pair_t cvalpair{.X{.val = state.XY.y(), .t = tp}, .Y{.val = state.XY.x(), .t = tp}};
|
|
||||||
|
|
||||||
coordpair_t cp{.X = state.XY.y(), .Y = state.XY.x()};
|
if (state.movementState == hardware_movement_state_t::HW_MOVE_SLEWING) {
|
||||||
|
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
||||||
|
coordpair_t cp{.X = state.XY.y(), .Y = state.XY.x()};
|
||||||
|
|
||||||
// correctTo is asynchronous function!!!
|
err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.moveTo(&cp));
|
||||||
//
|
} else if (state.movementState == hardware_movement_state_t::HW_MOVE_ADJUSTING ||
|
||||||
// according to the Eddy's implementation of the LibSidServo library it is safe
|
state.movementState == hardware_movement_state_t::HW_MOVE_TRACKING ||
|
||||||
// to pass the addresses of 'cvalpair' and 'cpair' automatic variables
|
state.movementState == hardware_movement_state_t::HW_MOVE_GUIDING) {
|
||||||
auto err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.moveTo(&cp));
|
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
||||||
// auto err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.correctTo(&cvalpair));
|
coordval_pair_t cvalpair{.X{.val = state.XY.y(), .t = tp}, .Y{.val = state.XY.x(), .t = tp}};
|
||||||
|
|
||||||
|
// correctTo is asynchronous function!!!
|
||||||
|
//
|
||||||
|
// according to the Eddy's implementation of the LibSidServo library it is safe
|
||||||
|
// to pass the addresses of 'cvalpair' and 'cpair' automatic variables
|
||||||
|
err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.correctTo(&cvalpair));
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user