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

Feature : Get CPU temperature over the RPC #139

Closed
wants to merge 9 commits into from

Conversation

elielnfinic
Copy link
Contributor

@elielnfinic elielnfinic commented Apr 22, 2024

Addresses : #138.

Description:

This pull request introduces the implementation of the get_cpu_temps method, which retrieves the CPU temperature for use in the dashboard. This feature leverages the systemstat library.

The get_cpu_temps method is located in /src/rpc_server.rs to facilitate its use via the RPC server.

It's important to note that the systemstat library does not support CPU temperature retrieval on Silicon Macs, as Apple has disabled this feature. Consequently, the associated test is designed to expect a None result when running on macOS.

As in /src/bin/dashboard_src/overview_screen.rs, cpu_temperature is a Option, I converted the f32 we get from systemstat into f64.

@elielnfinic elielnfinic marked this pull request as ready for review April 22, 2024 20:05
@Sword-Smith
Copy link
Member

Thanks for adding a test. PRs that introduce new tests make me happy :)

Your PR introduces a compiler warning. Can you fix that? I personally run make all to check that there are no bugs/compiler warnings but if you don't have a powerful machine, maybe you just want to run cargo clippy --all-targets and cargo fmt --all --check instead.

warning: unused variable: `state_lock`
    --> src/rpc_server.rs:1114:26
     |
1114 |         let (rpc_server, state_lock) =
     |                          ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_state_lock`
     |
     = note: `#[warn(unused_variables)]` on by default

@Sword-Smith Sword-Smith self-requested a review April 22, 2024 21:50
@elielnfinic
Copy link
Contributor Author

Thanks @Sword-Smith for your review.
I will fix that quickly.

src/rpc_server.rs Outdated Show resolved Hide resolved
@elielnfinic elielnfinic requested a review from dan-da April 24, 2024 16:51
Copy link
Collaborator

@dan-da dan-da left a comment

Choose a reason for hiding this comment

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

a couple minor nits but otherwise lgtm. thx for the pr!

src/rpc_server.rs Show resolved Hide resolved
src/rpc_server.rs Outdated Show resolved Hide resolved
@Sword-Smith
Copy link
Member

Thank you for your contribution, @elielnfinic. The PR was merged manually through CLI by me. You have of course been credited :)

@Sword-Smith
Copy link
Member

Merged through CLI.

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.

3 participants