ok, perhaps I got now the idea behind this...
is it true that normally encoder readings are supposed to be untrustful and vague?
So as one cannot trust the values one will have to read also an error code additionally to confirm that the reading was successful and then one can trust the value, is that correct?
So finally this latter method would be then the only valid way - because of which worth is an untrustful and vague value supposed to be?
How often does this false encoder reading happen statistically?
is this mostly due to SPI data transmission errors?
as I am no C++ programmer at all, just ANSI C...:
is it possible to pass something like
this. or this::
instead of BP as a function parameter?
is so incredible long, with a "this" one could more easily make a wrapper around it,
especially extremely precious when having multiple instances for multiple stacked shields:
#define resetEnc(p) offset_motor_encoder(p, this::get_motor_encoder(p))
#define setEnc(p,v) offset_motor_encoder(p, this::get_motor_encoder(p)+v)
=> that would provide now:
BP.resetEnc(PORT_A); // resets enc to a new 0 (zero) value
BP.setEnc(PORT_A, 180); // sets enc to a new arbitrary encoder value of 180°