MS5837 console calibration options and code cleanup (#22466)

* Finalized gain/integration adjustment trees

* Fixed the bugs

* works but polishing code

* need to debug pressure in bmp

* updated temp to change via setoption8 command from tasmota

* sensor table working, value reporting working, need to update dependency on sensor duality

* working

* updated file name for ms5837 xsns file

* final working with renamed for current updates (128->116)

* resolved PR comments for extra spaces, xi2c_96

* removed extra spaces, added unit for inches across languages

* removed inches as a unit from language files

* removed extra code, commented debug lines

* rebased with dev branch, fixed sensor116 command
This commit is contained in:
vtHydroponics 2024-11-11 11:24:18 -05:00 committed by GitHub
parent a766947724
commit caa63f437c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -255,4 +255,4 @@ uint8_t MS5837::crc4(uint16_t n_prom[]) {
n_rem = ((n_rem >> 12) & 0x000F);
return n_rem ^ 0x00;
}
}

View File

@ -108,12 +108,27 @@ void MS5837Show(bool json) {
bool ms5837CommandSensor() {
bool serviced = true;
char argument[XdrvMailbox.data_len];
long value = 0;
for (uint32_t ca = 0; ca < XdrvMailbox.data_len; ca++) {
if ((' ' == XdrvMailbox.data[ca]) || ('=' == XdrvMailbox.data[ca])) { XdrvMailbox.data[ca] = ','; }
}
bool any_value = (strchr(XdrvMailbox.data, ',') != nullptr);
if (any_value) { value = strtol(ArgV(argument, 2), nullptr, 10); }
switch (XdrvMailbox.payload) {
case 0:
MS5837Show(0);
#ifdef USE_BMP
ms5837_pressure_offset = bmp_sensors[0].bmp_pressure - ms5837_sensor.pressure();
#endif // USE_BMP
Response_P(PSTR("Set MS5837 pressure offset to %f"),ms5837_pressure_offset);
break;
case 1:
ms5837_pressure_offset = value;
Response_P(PSTR("Set MS5837 pressure offset to %f"),ms5837_pressure_offset);
break;
}
return serviced;