Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radar site threshold #319

Merged
merged 6 commits into from
Dec 26, 2024
Merged

Conversation

AdenKoperczak
Copy link
Contributor

Another quality of life feature for looking at nationwide radar/placefiles.

Settings

  1. Setting to zero disables threshold, but maybe a checkbox or tooltip should be added to make that clear.
  2. Units. Currently uses nautical miles for constancy with placefiles. Could be changed to following distance units settings like alert radius.

Linting

  1. Magic numbers for settings default/min/max. I think adding constants for each would generally decrease readability. I think we should add NOLINTBEGIN(readability-magic-numbers)/NOLINTEND + comment to avoid this in the future if you agree.
  2. [[nodiscard]]. This should probably be fixed for all settings in one pull or commit.
    I can make a separate pull request for these if you think that would be best.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -95,6 +96,8 @@ class GeneralSettings::Impl
loopTime_.SetMaximum(1440);
nmeaBaudRate_.SetMinimum(1);
nmeaBaudRate_.SetMaximum(999999999);
radarSiteThreshold_.SetMinimum(-10000);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 10000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

      radarSiteThreshold_.SetMinimum(-10000);
                                      ^

@@ -95,6 +96,8 @@
loopTime_.SetMaximum(1440);
nmeaBaudRate_.SetMinimum(1);
nmeaBaudRate_.SetMaximum(999999999);
radarSiteThreshold_.SetMinimum(-10000);
radarSiteThreshold_.SetMaximum(10000);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 10000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

      radarSiteThreshold_.SetMaximum(10000);
                                     ^

@@ -54,6 +54,7 @@ class GeneralSettings : public SettingsCategory
SettingsVariable<bool>& update_notifications_enabled() const;
SettingsVariable<std::string>& warnings_provider() const;
SettingsVariable<bool>& cursor_icon_always_on() const;
SettingsVariable<double>& radar_site_threshold() const;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'radar_site_threshold' should be marked [[nodiscard]] [modernize-use-nodiscard]

Suggested change
SettingsVariable<double>& radar_site_threshold() const;
[[nodiscard]] SettingsVariable<double>& radar_site_threshold() const;

@dpaulat
Copy link
Owner

dpaulat commented Dec 12, 2024

Another quality of life feature for looking at nationwide radar/placefiles.

Settings

  1. Setting to zero disables threshold, but maybe a checkbox or tooltip should be added to make that clear.

I agree a tooltip would be appropriate here. A checkbox and second setting could be used too, but I don't think it's necessary. I do think 0 to disable is fine, but with placefiles, >= 999 also disables (at least in the shader, although placefile text doesn't respect this).

  1. Units. Currently uses nautical miles for constancy with placefiles. Could be changed to following distance units settings like alert radius.

I agree following the distance units option for consistency is best. Most users don't deal directly with placefile contents, so I don't think consistency there is necessary.

Linting

  1. Magic numbers for settings default/min/max. I think adding constants for each would generally decrease readability. I think we should add NOLINTBEGIN(readability-magic-numbers)/NOLINTEND + comment to avoid this in the future if you agree.
  2. [[nodiscard]]. This should probably be fixed for all settings in one pull or commit.
    I can make a separate pull request for these if you think that would be best.

I agree with both linting suggestions, and that both can be taken care of in another PR.

@AdenKoperczak
Copy link
Contributor Author

I added tooltip to this and alert radius, and changed the units to match with alert radius.
Just a thought, but if we wanted some consistency with placefiles, we could add nautical miles as an additional distance unit.
I found that the 999NM threshold was about where I wanted it for my setup, but it felt like it could be a little close in depending your setup, so I figured giving more of a range would be good.

@dpaulat dpaulat merged commit 41a134e into dpaulat:develop Dec 26, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants