Switch to highest preset on charging

Hi again,

I would like to have a preset change when charging is detected.
This should be in the props file, to be fully configurable.

bool charging = !digitalRead(chargeDetectPin);

Should get the state, but how can I jump to the last preset?
The PropBase Object has no function to count or jump to the last.
My Preset sets have different length, depending what blade is used.
Best option were to jump to a preset name like “Charging”.
I don’t want to modilfy the source, it should be in the propfile.

any Ideas??

thx

SetPreset(0) then subtract 1?
No that’s not right.
I’m driving right now but look at RotatePresets().
Something in there should give you a clue as to how to do it.

The charging pin is a bit flaky, so it may not work the way you want.
Jumping to the last preset can be done with:

  SetPreset(-1, true);