Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MS5837 and BMP280 functionality for inches water #21377

Draft
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

vtHydroponics
Copy link
Contributor

Description: Added compatibility with MS5837 and BMP280 to calculate inches of water

Related issue (if applicable): fixes #

Checklist:

  • [X ] The pull request is done against the latest development branch
  • [X ] Only relevant files were touched
  • [X ] Only one feature/fix was added per PR and the code change compiles without warnings
  • [X ] The code change is tested and works with Tasmota core ESP8266 V.2.7.6
  • [X ] The code change is tested and works with Tasmota core ESP32 V.3.0.0
  • [X ] I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

Copy link
Collaborator

@s-hadinger s-hadinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Multiple changes are needed

@@ -168,6 +168,7 @@
//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code)
//#define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+1k8 code)
//#define USE_GDK101 // [I2cDriver79] Enable GDK101 sensor (I2C addresses 0x18 - 0x1B) (+1k2 code)
#define USE_MS5837
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change default configuraiont

@@ -476,6 +476,7 @@
//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code)
//#define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+1k8 code)
//#define USE_GDK101 // [I2cDriver79] Enable GDK101 sensor (I2C addresses 0x18 - 0x1B) (+1k2 code)
#define USE_MS5837
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -718,6 +718,7 @@
// #define USE_PCA9557 // [I2cDriver81] Enable PCA9557 8-bit I/O Expander (I2C addresses 0x18 - 0x1F) (+2k5 code)
// #define USE_MAX17043 // [I2cDriver83] Enable MAX17043 fuel-gauge systems Lipo batteries sensor (I2C address 0x36) (+0k9 code)
// #define MAX17043_ALERT_THRESHOLD 32 // [I2cDriver83] Define the alert threshold for low battery level percentage 1-32
#define USE_MS5837
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please disable by default (just add // before it)

@@ -337,6 +337,8 @@ void Bme280Read(uint8_t bmp_idx) {
p = ((p + var1 + var2) >> 8) + (((int64_t)Bme280CalibrationData[bmp_idx].dig_P7) << 4);
bmp_sensors[bmp_idx].bmp_pressure = (float)p / 25600.0f;

AddLog(LOG_LEVEL_DEBUG, PSTR("BMP_data{pressure:%f,temperature:%f,bmp_idx:%d}"), bmp_sensors[bmp_idx].bmp_pressure, bmp_sensors[bmp_idx].bmp_temperature, bmp_idx);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this? Please remove, the syntax is not consistent with log format in Tasmota

char inchesWater_str[8];
dtostrf(inches_water, sizeof(inchesWater_str)-1, 3, inchesWater_str);
if (json) {
// consolidate to one line
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

float MS5837::altitude() {
return (1-pow((pressure()/1013.25),.190284))*145366.45*.3048;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use float literals


#define MS5837_ADDR 0x76

#define XSNS_128 128
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 115 instead of 128

#define MS5837_ADDR 0x76

#define XSNS_128 128
#define XI2C_98 98 // See I2CDEVICES.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use next free value, which looks to be 88

@@ -406,7 +406,15 @@ const uint8_t kI2cList[] = {
#endif

#ifdef XI2C_96
XI2C_96
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert and use 88

@@ -246,7 +246,7 @@
"USE_INA219","USE_SHT3X","USE_MHZ19","USE_TSL2561",
"USE_SENSEAIR","USE_PMS5003","USE_MGS","USE_NOVA_SDS",
"USE_SGP30","USE_SR04","USE_SDM120","USE_SI1145",
"USE_SDM630","USE_LM75AD","USE_APDS9960","USE_TM1638"
"USE_SDM630","USE_LM75AD","USE_APDS9960","USE_TM1638","USE_MS5837"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this is going to work since it was not added to the feature map

#ifdef XSNS_128
&Xsns128
#endif

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NEVER CHANGE ANYTHING IN xsns_interface.ino !!!

This will break sensor enable/disable.

As suggested, use the next free slot.

#ifdef XSNS_128
XSNS_128
#endif

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto !!!

#endif

#ifdef XI2C_98
XI2C_98
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAME HERE. DO NOT CHANGE xx2c_interface.ino !!!

This breaks I2CDriver command

@arendst
Copy link
Owner

arendst commented May 7, 2024

The goal of a PR is to add functionality with touching as few files as possible.

You're touching files with adding spaces and irrelevant logs. There is even a TSL file change not related to your initial addition.

Pls revisit your PR and make as few changes as possible using the above suggestions.

@arendst arendst added the on hold by dev team Result - Feature request put on hold by member of development team label May 7, 2024
@Jason2866 Jason2866 marked this pull request as draft May 7, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold by dev team Result - Feature request put on hold by member of development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants