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

Wrapper for motor drivers / firmware 1.0a9 #133

Open
GitHubUser598 opened this issue May 19, 2020 · 0 comments
Open

Wrapper for motor drivers / firmware 1.0a9 #133

GitHubUser598 opened this issue May 19, 2020 · 0 comments

Comments

@GitHubUser598
Copy link

In mower.cpp funktion void Mower::setActuator(char type, int value):
Although the drivers L298N and MC33926 can be defined as DRIVER_L298N/DRIVER_MC33926 in mower.h, only the function setMC33926() will be called in above function. Changes have to be done manually, if the L298Ns is used like in my Ardu Mini.
Since there are two different motors with eventually two different drivers in use it might make sense to leave above definitions and define a new one like DRIVER_MOWER_L298N or DRIVER_MOWER_MC33926.
With the above you could call wrapper-functions like that:
case ACT_MOTOR_LEFT: // genereller Aufruf der neuen Wrapper-Funktion -> drivers.cpp setMotorDriver(pinMotorLeftDir, pinMotorLeftPWM, value); break;
or setMowerDriver(...) for the mower motor

In driver.cpp:
void setMotorDriver(int pinDir,int pinPWM,int value){ #ifdef DRIVER_L298N setL298N(pinDir, pinPWM, value); #else #ifdef DRIVER_MC33926 setMC33926(pinDir, pinPWM, value); #endif #endif }
Other drivers could be easily implemented and nobody would puzzle why the motors change directions by installing a new firmware.

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

No branches or pull requests

1 participant