mysensors / NodeManager

Plugin for a rapid development of battery-powered sensors
132 stars 82 forks source link

BH1750 reporting -10924 #520

Open user2684 opened 4 years ago

Bottesford commented 3 years ago

This is due to the use of INT in the SensorBH1750 class. When values are too high they go negative. I fixed mine by changing : new Child(this,INT,nodeManager.getAvailableChildId(child_id),S_LIGHT_LEVEL,V_LEVEL,_name); to: new Child(this,FLOAT,nodeManager.getAvailableChildId(child_id),S_LIGHT_LEVEL,V_LEVEL,_name);

and: int value = _lightSensor->readLightLevel(); to: float value = _lightSensor->readLightLevel();

user2684 commented 3 years ago

Thanks a lot for the advice, will apply the same approach in the fix!