Small Fix for Helper Functions
This commit is contained in:
parent
054f27ebee
commit
c63132ebe0
4 changed files with 8 additions and 4 deletions
|
@ -51,6 +51,10 @@ class AttSensor {
|
|||
payload[startbyte] = (value) & 0XFF;
|
||||
payload[startbyte+1] = (value >> 8) & 0XFF;
|
||||
}
|
||||
static void uint16ToPayload(uint16_t value, char *payload, uint8_t startbyte) {
|
||||
payload[startbyte] = (value) & 0XFF;
|
||||
payload[startbyte+1] = (value >> 8) & 0XFF;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -51,7 +51,7 @@ uint8_t MHZ19C::getSensorData(char * payload, uint8_t startbyte) {
|
|||
if (readBytes > 0) {
|
||||
switch(buffer[1]) {
|
||||
case 0x86:
|
||||
int16ToPayload((buffer[2]*256) + buffer[3], payload, startbyte);
|
||||
uint16ToPayload((buffer[2]*256) + buffer[3], payload, startbyte);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ uint8_t SENSAIRS8::getSensorData(char *payload, uint8_t startbyte) {
|
|||
payload[startbyte] = 0x00;
|
||||
payload[startbyte+1] = 0x00;
|
||||
if (readBytes > 0) {
|
||||
int16ToPayload((buffer[3]*256) + buffer[4], payload, startbyte);
|
||||
uint16ToPayload((buffer[3]*256) + buffer[4], payload, startbyte);
|
||||
}
|
||||
return startbyte+2;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ uint8_t SG112A::getSensorData(char *payload, uint8_t startbyte) {
|
|||
if (readBytes > 0) {
|
||||
switch(buffer[2]) {
|
||||
case 0x15:
|
||||
int16ToPayload((buffer[3]*256) + buffer[4], payload, startbyte);
|
||||
uint16ToPayload((buffer[3]*256) + buffer[4], payload, startbyte);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue