Implement methods for getting overcurrent status. (#57)

This commit is contained in:
Daniel Smith 2020-11-01 20:42:57 -05:00 committed by GitHub
parent ccf6d0cdc0
commit 850b011a55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 13 deletions

View file

@ -1036,6 +1036,36 @@ namespace create {
}
}
bool Create::isSideBrushOvercurrent() const {
if (data->isValidPacketID(ID_OVERCURRENTS)) {
return (GET_DATA(ID_OVERCURRENTS) & 0x01) != 0;
}
else {
CERR("[create::Create] ", "Overcurrent sensor not supported!");
return false;
}
}
bool Create::isMainBrushOvercurrent() const {
if (data->isValidPacketID(ID_OVERCURRENTS)) {
return (GET_DATA(ID_OVERCURRENTS) & 0x04) != 0;
}
else {
CERR("[create::Create] ", "Overcurrent sensor not supported!");
return false;
}
}
bool Create::isWheelOvercurrent() const {
if (data->isValidPacketID(ID_OVERCURRENTS)) {
return (GET_DATA(ID_OVERCURRENTS) & 0x18) != 0;
}
else {
CERR("[create::Create] ", "Overcurrent sensor not supported!");
return false;
}
}
float Create::getLeftWheelDistance() const {
return totalLeftDist;
}