Skip to content

ev3dev-powerinfo script to display battery status - #7

Closed
tcwan wants to merge 1 commit into
ev3dev:ev3dev-stretchfrom
tcwan:patch-1
Closed

tcwan wants to merge 1 commit into
ev3dev:ev3dev-stretchfrom
tcwan:patch-1

Conversation

@tcwan

@tcwan tcwan commented Jul 10, 2018 •

Copy link
Copy Markdown
Contributor

Pull request to add ev3dev-powerinfo script to repository.

Referenced ev3dev issue #1035

Pull request to add ev3dev-powerinfo script to repository.

[Reference](ev3dev/ev3dev#1035)
printf "%-20s: %3d.%03d V\n" "Voltage" $intVolts $decmiliVolts


uAmps=`cat $pwr_supply/current_now`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only EV3 can measure current. This will cause an error on other devices.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops. I didn't know that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Given this limitation, is it better that I just close the pull request?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess it is up to you if you want to fix it or not. 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is easy enough to wrap this section in:

if [ -e "$pwr_supply/current_now" ]; then
    ...
fi

printf "\n"
print_val "/sys/class/power_supply info"
for pwr_supply in /sys/class/power_supply/*; do
cat $pwr_supply/uevent

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this a bit redundant?

@tcwan tcwan Jul 10, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure that my unit conversion algorithm was correct when I first wrote it. In addition, I thought some of the raw info may be relevant but was too lazy to convert it to a human readable format.

@dlech dlech Jul 10, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe we just keep it super simple and make the whole script something like this:

for pwr_supply in /sys/class/power_supply/*; do
    cat $pwr_supply/uevent
    echo
done

@tcwan

tcwan commented Jul 11, 2018

Copy link
Copy Markdown
Contributor Author

I'm closing this since this patch has too many issues. Please see pull request #8

@tcwan tcwan closed this Jul 11, 2018
@tcwan
tcwan deleted the patch-1 branch July 12, 2018 06:44
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