Skip to content

Conversation

quantenzitrone
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Other: Replace this with a description of the type of this PR

Description

implements temperature in Kelvin for the temperature module

Related Issues & Documents

implements idea #2774

Documentation (check all applicable)

  • This PR requires changes to the Wiki documentation (describe the changes)
    • just 2 lines for the formatting options of internal/temperature, I can do that, if you want
  • This PR requires changes to the documentation inside the git repo (please add them to the PR).
  • Does not require documentation changes

@quantenzitrone
Copy link
Contributor Author

I tested my changes on Linux Mint, and it works perfectly.

My main distro is NixOS, but I haven't figured out how to build stuff there yet.

@codecov
Copy link

codecov bot commented Aug 21, 2022

Codecov Report

Merging #2784 (7641569) into master (b5764c8) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #2784      +/-   ##
==========================================
- Coverage   13.52%   13.51%   -0.01%     
==========================================
  Files         152      152              
  Lines       11396    11401       +5     
==========================================
  Hits         1541     1541              
- Misses       9855     9860       +5     
Flag Coverage Δ
unittests 13.51% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/modules/temperature.cpp 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@quantenzitrone
Copy link
Contributor Author

ok i have no idea what this means lol

@patrick96
Copy link
Member

ok i have no idea what this means lol

What what means?

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
@quantenzitrone
Copy link
Contributor Author

ok i have no idea what this means lol

What what means?

the codecov thingy

it now uses float as a initial value and makes m_temp temp_k and temp_f by converting and rounding with std::round
@quantenzitrone quantenzitrone changed the title added kelvin option for module internal/temperature Kelvin option for module internal/temperature and more accurate calculation of the temperature in °F Aug 21, 2022
@patrick96
Copy link
Member

the codecov thingy

I see. That reports how this PR affects our code coverage. Doesn't really matter here since we don't have any tests for module behavior yet.

@@ -51,22 +51,27 @@ namespace modules {
}

bool temperature_module::update() {
m_temp = std::strtol(file_util::contents(m_path).c_str(), nullptr, 10) / 1000.0f + 0.5f;
int temp_f = floor(((1.8 * m_temp) + 32) + 0.5);
float temp = float(std::strtol(file_util::contents(m_path).c_str(), nullptr, 10)) / 1000.0;
Copy link
Member

Choose a reason for hiding this comment

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

Nice. Computations on floats make much more sense here :)

@patrick96 patrick96 merged commit 708bd9c into polybar:master Aug 21, 2022
@quantenzitrone
Copy link
Contributor Author

thanks :)

@patrick96
Copy link
Member

Thank your for contributing and also cleaning up some of our code ;)

@patrick96 patrick96 mentioned this pull request Nov 5, 2023
24 tasks
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