Skip to content

Commit

Permalink
Merge branch 'OK9UWU-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Aang23 committed Apr 10, 2024
2 parents b1087fc + 41fdf34 commit bed6955
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src-core/common/tracking/obj_tracker/object_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
43 changes: 41 additions & 2 deletions src-core/common/tracking/obj_tracker/object_tracker_rotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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()
Expand All @@ -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;
}

Expand All @@ -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);
}
}

0 comments on commit bed6955

Please sign in to comment.