...
This commit is contained in:
@@ -187,6 +187,7 @@ public:
|
||||
protected:
|
||||
std::atomic_bool _stopRequested{false};
|
||||
std::function<error_t(const slew_point_t&)> _slewFunc{};
|
||||
std::mutex _updateMutex{};
|
||||
|
||||
void init(auto& mount_controls)
|
||||
{
|
||||
@@ -345,7 +346,7 @@ protected:
|
||||
}
|
||||
|
||||
if (i_adj_cycle == slew_point.maxAdjustingCycleNumber) {
|
||||
// res_err = max iter namber was exceeded
|
||||
// res_err = max iter number was exceeded
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -371,14 +372,33 @@ protected:
|
||||
|
||||
|
||||
auto start_poll_tm = std::chrono::steady_clock::now();
|
||||
// auto timeout_point = std::chrono::steady_clock::now() + slew_point.slewTimeout;
|
||||
auto wait_timeout = slew_point.slewTimeout / 5;
|
||||
if (wait_timeout < std::chrono::seconds(1)) {
|
||||
wait_timeout = std::chrono::seconds(1);
|
||||
}
|
||||
|
||||
// NOTE: TARGET COORDINATES WILL BE UPDATED FOR CURRENT TIME-POINT IN TELEMETRY-CLASS!!!
|
||||
|
||||
auto iter = telemetry.addCallbackFunc(cycle_func);
|
||||
|
||||
|
||||
while (true) {
|
||||
t_err = telemetry.data(t_data);
|
||||
t_err = telemetry.waitForUpdatedData(t_data, wait_timeout);
|
||||
|
||||
if (t_err) {
|
||||
std::string err_str = "An error occured while waiting for updated telemetry";
|
||||
logError(std::format("An error occured while waiting for updated telemetry: {}", t_err));
|
||||
if constexpr (std::same_as<decltype(t_err), error_t>) {
|
||||
std::format_to(std::back_inserter(err_str), ": code = {} ({})", t_err.value(), t_err.message());
|
||||
logError(err_str);
|
||||
return t_err;
|
||||
} else {
|
||||
if constexpr (traits::mcc_formattable<decltype(t_err)>) {
|
||||
std::format_to(std::back_inserter(err_str), ": code = {}", t_err.value());
|
||||
}
|
||||
logError(err_str);
|
||||
return MccSimpleSlewModelErrorCode::ERROR_TELEMETRY_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
cycle_func(t_data);
|
||||
|
||||
if ((std::chrono::steady_clock::now() - start_poll_tm) > slew_point.slewTimeout) {
|
||||
|
||||
Reference in New Issue
Block a user