Skip to content

Conversation

@molliewhaley
Copy link
Contributor

Changed


speed = constrain(speed, 0, 127);

int address = 130;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldnt be a hardcoded value

@klastine klastine linked an issue Nov 8, 2024 that may be closed by this pull request
@ethanholter ethanholter linked an issue Nov 14, 2024 that may be closed by this pull request
byte command;

if (motor != 0 || motor != 1) {
printf("invalid motor");
Copy link
Member

@ethanholter ethanholter Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

this->baudrate = baudrate;
this->serial->begin(baudrate);

serial->write(0b10101010);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quite mysterious line of code without immediate access to the datasheet. A short explanation would help a lot here

return;
}

this->serial = serial;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Successfully merging this pull request may close these issues.

Sabertooth packetized serial support

3 participants