...
This commit is contained in:
parent
d69ea51b0c
commit
8a202bd38c
@ -67,6 +67,9 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount()
|
||||
{
|
||||
std::lock_guard lock{*_mountConfigMutex};
|
||||
|
||||
logInfo("Stop telemetry data updating");
|
||||
stopInternalTelemetryDataUpdating();
|
||||
|
||||
logInfo("Init AstroSib FM-700 mount with configuration:");
|
||||
logInfo(" site latitude: {}", _mountConfig.siteLatitude().sexagesimal());
|
||||
logInfo(" site longitude: {}", _mountConfig.siteLongitude().sexagesimal());
|
||||
@ -189,6 +192,16 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount()
|
||||
|
||||
setStateERFA(std::move(ccte_state));
|
||||
|
||||
startInternalTelemetryDataUpdating();
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
bool ok = isInternalTelemetryDataUpdating();
|
||||
if (ok) {
|
||||
logInfo("Start updating telemetry data");
|
||||
} else {
|
||||
logError("Cannot update telemetry data!");
|
||||
}
|
||||
|
||||
return mcc::MccGenericMountErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
@ -143,7 +143,11 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareGetState(har
|
||||
using secs_t = std::chrono::duration<double>;
|
||||
|
||||
secs_t secs = secs_t{mdata.encXposition.t};
|
||||
state->time_point = tp_t{std::chrono::duration_cast<tp_t::duration>(secs)};
|
||||
if (mcc::utils::isEqual(secs.count(), 0.0)) { // model mode?
|
||||
state->time_point = decltype(state->time_point)::clock::now();
|
||||
} else {
|
||||
state->time_point = tp_t{std::chrono::duration_cast<tp_t::duration>(secs)};
|
||||
}
|
||||
|
||||
// according to "SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
||||
state->X = mdata.encYposition.val;
|
||||
|
||||
@ -589,8 +589,8 @@ static constexpr MccCoordPairKind MccCoordStrToPairKind(R&& spair)
|
||||
return hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_RADEC_ICRS_STR) ? MccCoordPairKind::COORDS_KIND_RADEC_ICRS
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_RADEC_APP_STR) ? MccCoordPairKind::COORDS_KIND_RADEC_APP
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_HADEC_APP_STR) ? MccCoordPairKind::COORDS_KIND_HADEC_APP
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_AZALT_STR) ? MccCoordPairKind::COORDS_KIND_AZZD
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_AZZD_STR) ? MccCoordPairKind::COORDS_KIND_AZALT
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_AZALT_STR) ? MccCoordPairKind::COORDS_KIND_AZALT
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_AZZD_STR) ? MccCoordPairKind::COORDS_KIND_AZZD
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_XY_STR) ? MccCoordPairKind::COORDS_KIND_XY
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_LATLON_STR) ? MccCoordPairKind::COORDS_KIND_LATLON
|
||||
: hash == mcc::utils::FNV1aHash(MCC_COORDPAIR_KIND_GENERIC_STR) ? MccCoordPairKind::COORDS_KIND_GENERIC
|
||||
|
||||
@ -1026,7 +1026,7 @@ protected:
|
||||
err = coordsFromTelemetryData(*mount_ptr, true, cp);
|
||||
if (!err) {
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, MCC_COMMPROTO_KEYWORD_TARGET_STR,
|
||||
cp);
|
||||
_coordFormat, _coordPrec, cp);
|
||||
}
|
||||
} else { // invalid command!!!
|
||||
err = vp.error();
|
||||
@ -1050,7 +1050,8 @@ protected:
|
||||
cp.pair_kind = vp.value();
|
||||
err = coordsFromTelemetryData(*mount_ptr, false, cp);
|
||||
if (!err) {
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, MCC_COMMPROTO_KEYWORD_MOUNT_STR, cp);
|
||||
output_msg.construct(MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR, MCC_COMMPROTO_KEYWORD_MOUNT_STR,
|
||||
_coordFormat, _coordPrec, cp);
|
||||
}
|
||||
} else { // invalid command!!!
|
||||
err = vp.error();
|
||||
|
||||
@ -411,7 +411,7 @@ protected:
|
||||
|
||||
sr(value, bytes);
|
||||
} else if constexpr (mcc_celestial_point_c<T>) {
|
||||
MccCelestialPointSerializer sr;
|
||||
static MccCelestialPointSerializer sr;
|
||||
|
||||
sr.setDelimiter(MCC_COMMPROTO_RANGEPARAM_DELIM_SEQ);
|
||||
sr.setFormat(_coordFmt);
|
||||
@ -779,7 +779,8 @@ protected:
|
||||
{
|
||||
if constexpr (std::derived_from<std::remove_cvref_t<SerFuncT>, DefaultSerializer>) {
|
||||
if constexpr (std::same_as<T, MccCoordinateSerializer::SerializedCoordFormat>) {
|
||||
_defaultSerializer._coordFmt = par;
|
||||
// _defaultSerializer._coordFmt = par;
|
||||
ser_func._coordFmt = par;
|
||||
} else if constexpr (std::same_as<T, MccCoordinateSerializer::SexagesimalCoordPrec>) {
|
||||
_defaultSerializer._coordPrec = par;
|
||||
} else {
|
||||
|
||||
@ -521,12 +521,15 @@ public:
|
||||
{
|
||||
using intv_t = std::remove_cvref_t<decltype(_currentUpdateInterval)>;
|
||||
|
||||
_internalUpdatingStopSource = std::stop_source{}; // reset state
|
||||
|
||||
*_internalUpdating = true;
|
||||
|
||||
_internalUpdatingFuture = std::async(
|
||||
std::launch::async,
|
||||
[this](std::stop_token stop_token) -> error_t {
|
||||
while (!stop_token.stop_requested()) {
|
||||
// while (!stop_token.stop_requested()) {
|
||||
while (true) {
|
||||
_lastUpdateError = updateTelemetryData(defaultInternalUpdateTimeout);
|
||||
if (_lastUpdateError) {
|
||||
*_internalUpdating = false;
|
||||
@ -593,7 +596,9 @@ public:
|
||||
|
||||
*_isDataUpdated = false;
|
||||
|
||||
std::future<error_t> update_ft = std::async(std::launch::async, _updateFunc, stop_source.get_token());
|
||||
// std::future<error_t> update_ft = std::async(std::launch::async, _updateFunc, stop_source.get_token());
|
||||
std::future<error_t> update_ft =
|
||||
std::async(std::launch::async, _updateFunc, _internalUpdatingStopSource.get_token());
|
||||
auto status = update_ft.wait_for(timeout);
|
||||
|
||||
if (status == std::future_status::ready) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user