Fix sign error on returned 'current' and 'temperature'

This commit is contained in:
jacobperron 2016-03-25 16:06:12 -07:00
parent 047dd9d6bc
commit cdc6927e76
2 changed files with 7 additions and 6 deletions

View file

@ -307,14 +307,15 @@ namespace create {
uint16_t getVoltage() const;
/* Get current flowing in/out of battery.
* A positive current implies Create is charging.
* \return value in milliamps
*/
uint16_t getCurrent() const;
int16_t getCurrent() const;
/* Get the temperature of battery.
* \return value in Celsius
*/
uint8_t getTemperature() const;
int8_t getTemperature() const;
/* Get battery's remaining charge.
* \return value in milliamp-hours

View file

@ -577,9 +577,9 @@ namespace create {
}
}
uint16_t Create::getCurrent() const {
int16_t Create::getCurrent() const {
if (data->isValidPacketID(ID_VOLTAGE)) {
return GET_DATA(ID_CURRENT);
return (int16_t) GET_DATA(ID_CURRENT);
}
else {
CERR("[create::Create] ", "Current sensor not supported!");
@ -587,9 +587,9 @@ namespace create {
}
}
uint8_t Create::getTemperature() const {
int8_t Create::getTemperature() const {
if (data->isValidPacketID(ID_TEMP)) {
return GET_DATA(ID_TEMP);
return (int8_t) GET_DATA(ID_TEMP);
}
else {
CERR("[create::Create] ", "Temperature sensor not supported!");