...
This commit is contained in:
parent
90acf1ee8c
commit
08ad1e665b
@ -53,6 +53,8 @@ protected:
|
||||
|
||||
void enter(MccGenericFsmMountErrorEvent& event)
|
||||
{
|
||||
enterLog(event);
|
||||
|
||||
// event.mount()->logWarn("The mount already in error state!");
|
||||
auto err = event.eventData();
|
||||
event.mount()->logError("An error occured: {} [{} {}]", err.message(), err.value(), err.category().name());
|
||||
|
||||
@ -44,7 +44,8 @@ int main(int argc, char* argv[])
|
||||
options.positional_help("[endpoint0] [enpoint1] ... [endpointN]");
|
||||
options.parse_positional({"endpoints"});
|
||||
|
||||
asio::io_context ctx(2);
|
||||
// asio::io_context ctx(2);
|
||||
asio::io_context ctx;
|
||||
|
||||
|
||||
try {
|
||||
@ -153,7 +154,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
|
||||
asio::thread_pool pool(3);
|
||||
asio::thread_pool pool(5);
|
||||
|
||||
asio::post(pool, [&ctx]() { ctx.run(); });
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ public:
|
||||
_enteredTargetCoordiniates.pair_kind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
||||
xstr = MccAngle(_enteredTargetCoordiniates.X).sexagesimal(true);
|
||||
} else {
|
||||
MccAngle(_enteredTargetCoordiniates.X).sexagesimal();
|
||||
xstr = MccAngle(_enteredTargetCoordiniates.X).sexagesimal();
|
||||
}
|
||||
|
||||
logInfo(std::format("Set entered target coordinates to: {} {} {}", xstr,
|
||||
@ -598,6 +598,7 @@ protected:
|
||||
|
||||
using transition_t = fsm::fsm_transition_table_t<
|
||||
std::pair<MccGenericFsmMountIdleEvent, MccGenericFsmMountIdleState<ERROR_STATE_T>>,
|
||||
std::pair<MccGenericFsmMountStopEvent, MccGenericFsmMountStopState<ERROR_STATE_T>>,
|
||||
std::pair<MccGenericFsmMountErrorEvent, ERROR_STATE_T>,
|
||||
std::pair<MccGenericFsmMountTrackEvent, MccGenericFsmMountTrackState<ERROR_STATE_T>>,
|
||||
std::pair<MccGenericFsmMountSlewEvent, MccGenericFsmMountSlewState>>;
|
||||
@ -664,6 +665,7 @@ protected:
|
||||
|
||||
using transition_t = fsm::fsm_transition_table_t<
|
||||
std::pair<MccGenericFsmMountIdleEvent, MccGenericFsmMountIdleState<ERROR_STATE_T>>,
|
||||
std::pair<MccGenericFsmMountStopEvent, MccGenericFsmMountStopState<ERROR_STATE_T>>,
|
||||
std::pair<MccGenericFsmMountErrorEvent, ERROR_STATE_T>,
|
||||
std::pair<MccGenericFsmMountTrackEvent, MccGenericFsmMountTrackState>>;
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ public:
|
||||
return mcc_deduce_error_code(hw_err, MccSimpleSlewingModelErrorCode::ERROR_HW_SETSTATE);
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::time_point start_slewing_tp, last_adjust_tp;
|
||||
// std::chrono::steady_clock::time_point start_slewing_tp, last_adjust_tp;
|
||||
// mcc_tp2tp(hw_state.time_point, start_slewing_tp); // not compiled!!
|
||||
|
||||
// double dist, dx, dy, sinY, rate2, xrate;
|
||||
@ -210,6 +210,10 @@ public:
|
||||
bool adjust_mode = false;
|
||||
static constexpr auto sideral_rate2 = slewing_params_t::sideralRate * slewing_params_t::sideralRate;
|
||||
|
||||
std::chrono::steady_clock::time_point start_slewing_tp, last_adjust_tp;
|
||||
start_slewing_tp = std::chrono::steady_clock::now();
|
||||
last_adjust_tp = start_slewing_tp;
|
||||
|
||||
while (true) {
|
||||
// wait for updated telemetry data
|
||||
{
|
||||
@ -231,10 +235,10 @@ public:
|
||||
// and check them for getting into the prohibited zones
|
||||
if constexpr (mccIsEquatorialMount(CONTROLS_T::mountType)) {
|
||||
cpt.X = tdata.HA + tdata.speedX * min_time_to_pzone_in_secs;
|
||||
cpt.X = tdata.DEC_APP + tdata.speedY * min_time_to_pzone_in_secs;
|
||||
cpt.Y = tdata.DEC_APP + tdata.speedY * min_time_to_pzone_in_secs;
|
||||
} else if constexpr (mccIsAltAzMount(CONTROLS_T::mountType)) {
|
||||
cpt.X = tdata.AZ + tdata.speedX * min_time_to_pzone_in_secs;
|
||||
cpt.X = tdata.ZD + tdata.speedY * min_time_to_pzone_in_secs;
|
||||
cpt.Y = tdata.ZD + tdata.speedY * min_time_to_pzone_in_secs;
|
||||
}
|
||||
mcc_tp2tp(tdata.time_point, cpt.time_point);
|
||||
|
||||
|
||||
@ -598,15 +598,20 @@ 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, _internalUpdatingStopSource.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) {
|
||||
*_isDataUpdated = true;
|
||||
_lastUpdateError = update_ft.get();
|
||||
} else {
|
||||
} else if (status == std::future_status::deferred) { // std::async was invoked in this thread, get result
|
||||
_lastUpdateError = update_ft.get();
|
||||
if (!_lastUpdateError) {
|
||||
*_isDataUpdated = true;
|
||||
}
|
||||
} else { // timeout
|
||||
stop_source.request_stop();
|
||||
_lastUpdateError = MccTelemetryErrorCode::ERROR_DATA_TIMEOUT;
|
||||
}
|
||||
@ -631,7 +636,7 @@ public:
|
||||
return MccTelemetryErrorCode::ERROR_DATA_TIMEOUT;
|
||||
}
|
||||
|
||||
std::lock_guard thread_lock{*_updateMutex};
|
||||
// std::lock_guard thread_lock{*_updateMutex};
|
||||
|
||||
if (!_lastUpdateError) {
|
||||
mcc_copy_telemetry_data(_data, tdata);
|
||||
|
||||
@ -254,8 +254,10 @@ public:
|
||||
|
||||
|
||||
std::chrono::steady_clock::time_point last_corr_tp, last_ipzone_update_tp;
|
||||
last_corr_tp = std::chrono::steady_clock::now();
|
||||
last_ipzone_update_tp = last_corr_tp;
|
||||
|
||||
while (*_stopTracking) {
|
||||
while (!*_stopTracking) {
|
||||
// wait for updated telemetry data
|
||||
{
|
||||
std::lock_guard lock{*_currentParamsMutex};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user