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

Adjust voltage read percentage formula #4

Closed
joshua255 opened this issue Aug 30, 2019 · 4 comments
Closed

Adjust voltage read percentage formula #4

joshua255 opened this issue Aug 30, 2019 · 4 comments

Comments

@joshua255
Copy link
Member

I think you are currently using this code for getting a "percentage charged" value
int batteryCharge(int voltage) => (voltage / 255 * 100).round();

At about 8v, a current percentage value of 62%, or a voltage value of about 157 out of 255, URSA stops working because of the low voltage, and that should be displayed as 0% remaining. (A computer battery at" 0%" still has quite a bit of voltage)

In URSA's code, line 133 of ursa.ino reads the voltage and scales it. You could change the scaling there so a 0 corresponds to right below the lowest functioning voltage if you would rather fix it in the robot code than here. Also, the voltage read in the robot still needs to be calibrated by adjusting DACUnitsPerVolt; I found a rough value but it wasn't ever checked carefully.

@andrewda
Copy link
Member

Good idea! I'm also planning on averaging the battery voltage over the past 5 seconds or so because it's very jumpy right now.

@joshua255
Copy link
Member Author

Can the icon fill by percent, and is voltage or percent shown next to the icon?

@andrewda
Copy link
Member

Percentage is shown right now, and yeah I can try to get it to fill!

@joshua255
Copy link
Member Author

Would voltage be more useful? That's how it is forthe FRC driverstation

@andrewda andrewda changed the title adjust voltage read percentage formula Adjust voltage read percentage formula Jul 3, 2023
@andrewda andrewda removed their assignment Jul 3, 2023
@andrewda andrewda closed this as completed Jul 4, 2024
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

No branches or pull requests

2 participants