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

Power-Panic Service #1657

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Power-Panic Service #1657

wants to merge 7 commits into from

Conversation

paudar
Copy link
Contributor

@paudar paudar commented Mar 2, 2025

Why? What?

Implementation of an service, that provides auditive Feedback when the battery of the NAO runs out.

ToDo / Known Issues

The service still needs to be added to the meta-nao repository so that it becomes part of the image.
You may can argue about the time-interval of the sound. Right now it is played every charge in % in seconds.

Ideas for Next Iterations (Not This PR)

In the next iteration you think of a possibility to mute the alarm.

How to Test

After creating the binary of the service with ./pepsi build power-panic
you will find the binary in ~/worktree/hulk/services/power-panic/target/debug.
Copy the binary to a NAO e. g. using rsync power-panic [email protected]:~/hulk/bin/
and execute it by connecting to the robot e. g. with ./pepsi shell x

paudar added 6 commits March 1, 2025 12:16
add rodio to toplevel toml

implement first iteration of dbus communiton (get battery)

add loop in main function

move power-panic from tools/ to services/

adapt Cargo.toml to new project structure

add crosscompilation flag to Cargo.toml

fix errorhandling
@paudar paudar changed the title Power panic Power-Panic Service Mar 2, 2025
Copy link
Contributor

@oleflb oleflb left a comment

Choose a reason for hiding this comment

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

Just some minor remarks, nice work 👍

@oleflb oleflb self-assigned this Mar 2, 2025
reorder imports

refactor if statement

use imports instead of qualifiers

remove one unnecessary println!
Copy link
Contributor

@oleflb oleflb left a comment

Choose a reason for hiding this comment

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

Looks really good, just one more request :)

let battery = get_battery_info().await?;
println!("Battery: {:?}", battery);

let mut time_to_sleep = 60;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please try to use sophisticated types, in this case Duration for representing time. When coding your time as an integer, it is not clear whether you mean seconds, minutes, etc. . You can read more about it here: https://refactoring.guru/smells/primitive-obsession

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Request for Review
Development

Successfully merging this pull request may close these issues.

2 participants