diff --git a/src-core/common/tracking/obj_tracker/object_tracker.h b/src-core/common/tracking/obj_tracker/object_tracker.h index 0c4d15997..d07bd6fc1 100644 --- a/src-core/common/tracking/obj_tracker/object_tracker.h +++ b/src-core/common/tracking/obj_tracker/object_tracker.h @@ -131,6 +131,9 @@ namespace satdump double rotator_update_period = 1; bool rotator_park_while_idle = false; + bool rotator_rounding = false; + int rotator_decimal_multiplier = 1000; + int rotator_decimal_precision = 3; SatAzEl rotator_park_position; double rotator_unpark_at_minus = 60; diff --git a/src-core/common/tracking/obj_tracker/object_tracker_rotator.cpp b/src-core/common/tracking/obj_tracker/object_tracker_rotator.cpp index 345eee4d5..d6d4575b9 100644 --- a/src-core/common/tracking/obj_tracker/object_tracker_rotator.cpp +++ b/src-core/common/tracking/obj_tracker/object_tracker_rotator.cpp @@ -27,8 +27,16 @@ namespace satdump { if (sat_current_pos.el > 0) { - rot_current_req_pos.az = sat_current_pos.az; - rot_current_req_pos.el = sat_current_pos.el; + if (!rotator_rounding) + { + rot_current_req_pos.az = sat_current_pos.az; + rot_current_req_pos.el = sat_current_pos.el; + } + else + { + rot_current_req_pos.az = (round(sat_current_pos.az * rotator_decimal_multiplier)) / rotator_decimal_multiplier; + rot_current_req_pos.el = (round(sat_current_pos.el * rotator_decimal_multiplier)) / rotator_decimal_multiplier; + } } else if (rotator_park_while_idle) { @@ -115,12 +123,39 @@ namespace satdump ImGui::Spacing(); ImGui::Checkbox("Park while idle", &rotator_park_while_idle); + if (rotator_park_while_idle) { ImGui::InputFloat("Park Az##Rot Az", &rotator_park_position.az); ImGui::InputFloat("Park El##Rot El", &rotator_park_position.el); ImGui::InputDouble("Unpark Time##Rot Unpark Time", &rotator_unpark_at_minus); } + + ImGui::Checkbox("AZ EL Decimal rounding", &rotator_rounding); + + if (rotator_rounding && ImGui::InputInt("Decimal Place Precision", &rotator_decimal_precision, 1, 3)) + { + if (rotator_decimal_precision > 3) + { + rotator_decimal_precision = 3; + } + else if (rotator_decimal_precision == 0) + { + rotator_decimal_precision = 1; + } + switch (rotator_decimal_precision) + { + case 1: + rotator_decimal_multiplier = 10; + break; + case 2: + rotator_decimal_multiplier = 100; + break; + case 3: + rotator_decimal_multiplier = 1000; + break; + } + } } nlohmann::json ObjectTracker::getRotatorConfig() @@ -130,6 +165,8 @@ namespace satdump v["park_while_idle"] = rotator_park_while_idle; v["park_position"] = rotator_park_position; v["unpark_at_minus"] = rotator_unpark_at_minus; + v["rounding"] = rotator_rounding; + v["rounding_decimal_places"] = rotator_decimal_precision; return v; } @@ -139,5 +176,7 @@ namespace satdump rotator_park_while_idle = getValueOrDefault(v["park_while_idle"], rotator_park_while_idle); rotator_park_position = getValueOrDefault(v["park_position"], rotator_park_position); rotator_unpark_at_minus = getValueOrDefault(v["unpark_at_minus"], rotator_unpark_at_minus); + rotator_rounding = getValueOrDefault(v["rounding"], rotator_rounding); + rotator_decimal_precision = getValueOrDefault(v["rotator_decimal_places"], rotator_decimal_precision); } }