mirror of https://github.com/arendst/Tasmota.git
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:
parent
a766947724
commit
caa63f437c
|
@ -255,4 +255,4 @@ uint8_t MS5837::crc4(uint16_t n_prom[]) {
|
||||||
n_rem = ((n_rem >> 12) & 0x000F);
|
n_rem = ((n_rem >> 12) & 0x000F);
|
||||||
|
|
||||||
return n_rem ^ 0x00;
|
return n_rem ^ 0x00;
|
||||||
}
|
}
|
|
@ -108,12 +108,27 @@ void MS5837Show(bool json) {
|
||||||
|
|
||||||
bool ms5837CommandSensor() {
|
bool ms5837CommandSensor() {
|
||||||
bool serviced = true;
|
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) {
|
switch (XdrvMailbox.payload) {
|
||||||
case 0:
|
case 0:
|
||||||
MS5837Show(0);
|
MS5837Show(0);
|
||||||
#ifdef USE_BMP
|
#ifdef USE_BMP
|
||||||
ms5837_pressure_offset = bmp_sensors[0].bmp_pressure - ms5837_sensor.pressure();
|
ms5837_pressure_offset = bmp_sensors[0].bmp_pressure - ms5837_sensor.pressure();
|
||||||
#endif // USE_BMP
|
#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;
|
break;
|
||||||
}
|
}
|
||||||
return serviced;
|
return serviced;
|
||||||
|
|
Loading…
Reference in New Issue