Motor.rotor.encoder_state - read-only?


#1

It seems the encoder state variable is read-only (&motors[0].rotor.encoder_state, // ro), is there a good reason this can not/should not be read-write?

Writing the encoder position would allow me to save/re-load position on power cycle from within my software.


#2

The rotor.encoder_state variable actually shadows the encoder counter hardware register. So you would have to make a special function to update the hardware register when you write to change the encoder state. It can be done, but is more complicated than just letting you write to rotor.encoder_state.


#3

Ok that makes sense. Thanks.

I created a feature request in github if anyone is interested in this.