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

add new battery mappings #253

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

add new battery mappings #253

wants to merge 4 commits into from

Conversation

sctanf
Copy link
Member

@sctanf sctanf commented Jun 23, 2023

measure an actual existing battery and use those values for mapping instead of some random internet graph
maybe this is better?

@Eirenliel Eirenliel requested a review from Vyolex July 20, 2023 08:18
@unlogisch04
Copy link
Contributor

Hi
I'm missing documentation.
In what case do i have to set what option, for what reason?
REG_BUCK
REG_LDO
REG_LEGACY

@sctanf
Copy link
Member Author

sctanf commented Aug 1, 2023

Hi I'm missing documentation. In what case do i have to set what option, for what reason? REG_BUCK REG_LDO REG_LEGACY

reg -> regulator, basically what did the board have for power regulation
official slimevr has a buck converter circuit, basically all diy slimes have a linear ldo regulator (like d1 mini)
setting buck or ldo uses the appropriate voltage mapping for either regulator type, and legacy is just the old behavior

@unlogisch04
Copy link
Contributor

Ok, thanks.
This should go into the Code too. Imho
Also how did you get this Values?
Im asking, because to me this are numbers i have no clue how to reproduce.

Im not sure if that would need to go into the Code, but if someone needs to make a change, the numbers could be reproduce. (For different circuit)

@sctanf
Copy link
Member Author

sctanf commented Aug 2, 2023

Ok, thanks.
This should go into the Code too. Imho
Also how did you get this Values?
Im asking, because to me this are numbers i have no clue how to reproduce.

Im not sure if that would need to go into the Code, but if someone needs to make a change, the numbers could be reproduce. (For different circuit)

im a little confused, i did add a few comments that i thought should explain it

all (new) values are derived from logging a battery over time as it discharged if that is what you are asking?

Copy link
Member

@Vyolex Vyolex left a comment

Choose a reason for hiding this comment

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

Code looks good to me, just some minor nitpicks.

@@ -54,6 +54,10 @@
#define BATTERY_SHIELD_R2 220.0
#endif

#ifndef BATTERY_REGULATOR
#define BATTERY_REGULATOR REG_LDO
Copy link
Member

Choose a reason for hiding this comment

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

To keep backwards compatibility the fallback should be legacy behavior imo.

Suggested change
#define BATTERY_REGULATOR REG_LDO
#define BATTERY_REGULATOR REG_LEGACY

Copy link
Member Author

Choose a reason for hiding this comment

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

the legacy mapping is not based on anything, though, what other reason would be to not use the new mapping as default/fallback?

Copy link
Member

Choose a reason for hiding this comment

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

I mean fair, but then why even keep it around in the first place. At the very least it should be official slime option as default then imo. I'll be setting up a test today.

Copy link
Member Author

Choose a reason for hiding this comment

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

official slime uses a buck regulator, which will draw roughly constant power, the discharge characteristic is different than most diy boards which have a linear ldo regulator, which will draw roughly constant current

Copy link
Member

Choose a reason for hiding this comment

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

Will verify the curves with a test, in theory they look correct.

Copy link
Member

Choose a reason for hiding this comment

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

looks like i messed up the test a bit so charging the slime and will try again tomorrow

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you ever get a chance to test this?

Copy link
Member

Choose a reason for hiding this comment

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

Didn't get to doing this, had some stuff come up when I was doing it, never finished and forgot about it.

Copy link
Member

@ButterscotchV ButterscotchV left a comment

Choose a reason for hiding this comment

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

Looks fine, I have absolutely no way to test this, so I don't have much useful input besides that it should work. Why no REG_BUCK for legacy SlimeVR design? I don't really know anything about that board so I'm not sure if it's needed.

@sctanf
Copy link
Member Author

sctanf commented Jan 12, 2024

Looks fine, I have absolutely no way to test this, so I don't have much useful input besides that it should work. Why no REG_BUCK for legacy SlimeVR design? I don't really know anything about that board so I'm not sure if it's needed.

It would be helpful if someone was able to test i think
The curve obtained should be better but I could make no tests with specificity esp hardware

I'm not sure what the regulator is on legacy/dev board but it probably isn't too important, if it has a buck regulator then it can be added then

@Vyolex
Copy link
Member

Vyolex commented Jan 31, 2024

It would be helpful if someone was able to test i think
The curve obtained should be better but I could make no tests with specificity esp hardware

I have some time again and I can run a test soon to see if the curve looks good. Wanted to test something else along with this either way. @sctanf could you update the branch and then I'll run some tests this weekend orso on the official hardware.

@Vyolex
Copy link
Member

Vyolex commented Feb 9, 2024

Ok thank you, will test next weekend 😃

@Vyolex
Copy link
Member

Vyolex commented Feb 19, 2024

Wanted to run a test, but this firmware currently doesn't work and crashes the slime. Confirmed working on main so I'm guessing the merge is to blame (there were battery changes on main too for the esp32).

Can try to debug later or test again when fixed.

@Vyolex Vyolex self-requested a review February 19, 2024 11:38
@Vyolex
Copy link
Member

Vyolex commented Apr 30, 2024

@ImUrX @sctanf is this still something we want to work on? Now that Uriel got the proper measurements.

@sctanf
Copy link
Member Author

sctanf commented Apr 30, 2024

it should be updated with new measurements for official trackers, then keep legacy mapping for now because new one was not tested for diy

@unlogisch04
Copy link
Contributor

I think we could map it to the Board. So if the board is SlimeVR then use the mapping from SlimeVR and else the legacy one?

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.

4 participants