Skip to content

Commit

Permalink
pressure offset retained between resets
Browse files Browse the repository at this point in the history
  • Loading branch information
vtHydroponics committed Nov 13, 2024
1 parent 7013258 commit ddfcc87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tasmota/tasmota_xsns_sensor/xsns_116_ms5837.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ void MS5837init(void) {
ms5837_sensor.setModel(ms5837_sensor.MS5837_02BA);
ms5837_sensor.setFluidDensity(997); // kg/m^3 (freshwater, 1029 for seawater)
ms5837_start = true;
if(!isnan(Settings->ms5837_pressure_offset)) {
ms5837_pressure_offset = Settings->ms5837_pressure_offset;
}
I2cSetActiveFound(MS5837_ADDR, "MS5837");
}
}
Expand Down Expand Up @@ -124,10 +127,12 @@ bool ms5837CommandSensor() {
#ifdef USE_BMP
ms5837_pressure_offset = bmp_sensors[0].bmp_pressure - ms5837_sensor.pressure();
#endif // USE_BMP
Settings->ms5837_pressure_offset = ms5837_pressure_offset;
Response_P(PSTR("Set MS5837 pressure offset to %f"),ms5837_pressure_offset);
break;
case 1:
ms5837_pressure_offset = value;
Settings->ms5837_pressure_offset = ms5837_pressure_offset;
Response_P(PSTR("Set MS5837 pressure offset to %f"),ms5837_pressure_offset);
break;
}
Expand Down

0 comments on commit ddfcc87

Please sign in to comment.