IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.6k stars 490 forks source link

fixed conversion of gas data (hex numbers, not decimal numbers) #341

Closed cdaller closed 4 years ago

cdaller commented 5 years ago

The gas numbers sent by my thingy are encoded in hex, not in decimal, so a conversion is needed to get the correct values for eCO2 and TVOC.

This is also done in the nodejs library of Nordic (https://github.com/NordicPlayground/Nordic-Thingy52-Nodejs/blob/master/lib/thingy.js)

Thingy.prototype.onGasNotif = function(data) {
    var gas = {
        eco2 : data.readUInt16LE(0),
        tvoc : data.readUInt16LE(2)
    }

    this.emit('gasNotif', gas);
};
IanHarvey commented 4 years ago

Thanks for the fix - as it happens this was also included in #335, which I've just merged.