Conversation
fix mollies mistake
include/Sabertooth.hpp
Outdated
|
|
||
| speed = constrain(speed, 0, 127); | ||
|
|
||
| int address = 130; |
There was a problem hiding this comment.
this shouldnt be a hardcoded value
include/Sabertooth.hpp
Outdated
| byte command; | ||
|
|
||
| if (motor != 0 || motor != 1) { | ||
| printf("invalid motor"); |
There was a problem hiding this comment.
As of now, debug statements are completely ignored by the Raspberry Pi and if we do implement logging it will have to be a custom solution (we will have to make our own print function, not printf). For now you can remove the print statement and simply do nothing if the function receives bad input data. Definitely still perform the validation though
include/Sabertooth.hpp
Outdated
| this->baudrate = baudrate; | ||
| this->serial->begin(baudrate); | ||
|
|
||
| serial->write(0b10101010); |
There was a problem hiding this comment.
This is a quite mysterious line of code without immediate access to the datasheet. A short explanation would help a lot here
| @@ -32,15 +32,45 @@ class Sabertooth { | |||
| this->serial = serial; | |||
There was a problem hiding this comment.
Instead of beginning the serial port when the Sabertooth object is created, add an init function which does this stuff. This is mainly cleanup for my previous mistakes but should be included in this review anyways
There was a problem hiding this comment.
Rename this class to SabertoothDriver. This is much more clear about what the purpose of the class is. Again, cleanup for my mistakes but is relevant to this review
Changed