Revert sabertooth init to STACK, direct call (fix encoder lag)
Even though the object was created in STACK using alloca apparently the method call via pointer in lambda function still takes quite long since the encoder in MENU started to lag again It gets initialized before main() now this fixed the lag
This commit is contained in:
parent
021a3660e1
commit
cba084580a
@ -45,7 +45,11 @@ extern "C"
|
||||
controlledMotor *motorLeft;
|
||||
controlledMotor *motorRight;
|
||||
|
||||
sabertooth2x60a *sabertoothDriver;
|
||||
// TODO initialize driver in createOjects like everything else
|
||||
// (as in 6e9b3d96d96947c53188be1dec421bd7ff87478e)
|
||||
// issue with laggy encoder wenn calling methods via pointer though
|
||||
//sabertooth2x60a *sabertoothDriver;
|
||||
sabertooth2x60a sabertoothDriver(sabertoothConfig);
|
||||
|
||||
evaluatedJoystick *joystick;
|
||||
|
||||
@ -69,11 +73,12 @@ cControlledRest *backRest;
|
||||
//-> makes it possible to easily use different motor drivers
|
||||
motorSetCommandFunc_t setLeftFunc = [&sabertoothDriver](motorCommand_t cmd)
|
||||
{
|
||||
sabertoothDriver->setLeft(cmd); //<= note: still using pointer to method in here (but stored in STACK)
|
||||
//TODO why encoder lag when call via pointer?
|
||||
sabertoothDriver.setLeft(cmd);
|
||||
};
|
||||
motorSetCommandFunc_t setRightFunc = [&sabertoothDriver](motorCommand_t cmd)
|
||||
{
|
||||
sabertoothDriver->setRight(cmd); //<= note: still using pointer to method in here (but stored in STACK)
|
||||
sabertoothDriver.setRight(cmd);
|
||||
};
|
||||
|
||||
//--- lambda function http-joystick ---
|
||||
|
Loading…
x
Reference in New Issue
Block a user