nielsonm236 / NetMod-ServerApp

Reprogramming the Web_Relay_Con V2.0 HW-584 Network Module
72 stars 23 forks source link

BME280 build: When Altitude is entered in meters the IOControl display shows altitude "meters entered -1" #205

Closed nielsonm236 closed 11 months ago

nielsonm236 commented 12 months ago

In the BME280 build the altitude entry made via the REST command /81 always shows up in the IOControl display as 1 meter less than what was entered. I've looked into this and it is the result of value truncation due to use of integers instead of floats, and the use of "feet" in all internal calculations in the BME280 driver. The use of feet in the driver was a matter of the source code copied from Bosch. So, when a user enters altitude in meters it is converted to feet and stored in EEPROM for use by the driver. This conversion results in the first truncation, then later when the altitude value is displayed in the IOControl page it is converted from feet back to meters, resulting in another truncation. These "truncation errors" do not result in any significant error in the calculation of barometric pressure, It only causes a little confusion for the user when altitude is not reflected in the display as entered. It is a fairly simple fix, so I'll take care of it in the next release.

nielsonm236 commented 11 months ago

Addressed in release 20231009 1022