From 6bec87d69f2b2a9b027c85fdff630164fe19d00a Mon Sep 17 00:00:00 2001 From: Aang23 Date: Thu, 20 Jul 2023 16:36:16 +0200 Subject: [PATCH] More tracking fixes --- src-interface/recorder/tracking_widget.cpp | 43 ++++++++++++++++--- src-interface/recorder/tracking_widget.h | 5 ++- .../recorder/tracking_widget_backend.cpp | 19 +++++++- 3 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src-interface/recorder/tracking_widget.cpp b/src-interface/recorder/tracking_widget.cpp index 0aa4f0e25..e8826bf93 100644 --- a/src-interface/recorder/tracking_widget.cpp +++ b/src-interface/recorder/tracking_widget.cpp @@ -167,6 +167,9 @@ namespace satdump bool update_global = false; + if (backend_needs_update) + style::beginDisabled(); + ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth()); if (horizons_mode) update_global = update_global || ImGui::Combo("###horizonsselectcombo", ¤t_horizons, horizonsoptionstr.c_str()); @@ -191,19 +194,25 @@ namespace satdump ImGui::EndTable(); } + if (backend_needs_update) + style::endDisabled(); + + if (update_global) + backend_needs_update = true; + if (ImGui::BeginTable("##trackingwidgettable", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("Azimuth"); ImGui::TableSetColumnIndex(1); - ImGui::Text("%.2f", current_az); + ImGui::Text("%.3f", current_az); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("Elevation"); ImGui::TableSetColumnIndex(1); - ImGui::Text("%.2f", current_el); + ImGui::Text("%.3f", current_el); if (next_aos_time != 0 && next_los_time != 0) { @@ -248,22 +257,44 @@ namespace satdump ImGui::EndTable(); } - backend_needs_update = update_global; - ImGui::Spacing(); ////////////////// ImGui::Separator(); + ImGui::Spacing(); + + if (ImGui::BeginTable("##trackingwidgettable", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) + { + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("Rot Az"); + ImGui::TableSetColumnIndex(1); + ImGui::Text("Rot El"); + + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::InputFloat("##Rot Az", ¤t_req_rotator_az); + ImGui::TableSetColumnIndex(1); + ImGui::InputFloat("##Rot El", ¤t_req_rotator_el); + + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("%.3f", current_rotator_az); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%.3f", current_rotator_el); + + ImGui::EndTable(); + } - ImGui::InputFloat("Rot Az", ¤t_req_rotator_az); - ImGui::InputFloat("Rot El", ¤t_req_rotator_el); ImGui::Checkbox("Engage", &rotator_engaged); ImGui::SameLine(); ImGui::Checkbox("Track", &rotator_tracking); ImGui::Separator(); + rotctld_client.render(); + ImGui::Spacing(); // tle_update_mutex.unlock(); diff --git a/src-interface/recorder/tracking_widget.h b/src-interface/recorder/tracking_widget.h index d27f15697..71ad251ee 100644 --- a/src-interface/recorder/tracking_widget.h +++ b/src-interface/recorder/tracking_widget.h @@ -25,7 +25,6 @@ namespace satdump predict_position satellite_orbit; predict_observer_t *observer_station; predict_observation observation_pos; - double next_aos_time, next_los_time; std::string satoptionstr; int current_satellite = 0; @@ -62,6 +61,10 @@ namespace satdump std::vector> upcoming_pass_points; void updateNextPass(); + double next_aos_time, next_los_time; + + float next_aos_az = 0, next_aos_el = 0; + private: // Rotator control bool rotator_engaged = false; bool rotator_tracking = false; diff --git a/src-interface/recorder/tracking_widget_backend.cpp b/src-interface/recorder/tracking_widget_backend.cpp index fb119e6ae..7be8393cf 100644 --- a/src-interface/recorder/tracking_widget_backend.cpp +++ b/src-interface/recorder/tracking_widget_backend.cpp @@ -122,6 +122,8 @@ namespace satdump if (horizons_data[i].el <= 0) { next_aos_time = horizons_data[i].timestamp; + next_aos_az = horizons_data[i].az; + next_aos_el = horizons_data[i].el; break; } } @@ -143,6 +145,8 @@ namespace satdump if (horizons_data[i].el > 0) { next_aos_time = horizons_data[i].timestamp; + next_aos_az = horizons_data[i].az; + next_aos_el = horizons_data[i].el; aos_iter = i; break; } @@ -200,6 +204,9 @@ namespace satdump next_los_time = predict_from_julian(next_los.time); next_aos_time = predict_from_julian(next_aos.time); + next_aos_az = next_aos.azimuth * RAD_TO_DEG; + next_aos_el = next_aos.elevation * RAD_TO_DEG; + // Calculate a few points during the pass predict_position satellite_orbit2; predict_observation observation_pos2; @@ -310,8 +317,16 @@ namespace satdump { if (rotator_tracking) { - current_req_rotator_az = current_az; - current_req_rotator_el = current_el; + if (current_el > 0) + { + current_req_rotator_az = current_az; + current_req_rotator_el = current_el; + } + else + { + current_req_rotator_az = next_aos_az; + current_req_rotator_el = next_aos_el; + } } if (current_req_rotator_el < 0)