BUG: BME680 get_report_time_delta incorrect

BME680 is using BME280 module, which returns REPORT_TIME=.8 as the report time. However, in the code BME680 callback is delayed by REPORT_TIME * 4, so it should be returning REPORT_TIME * 4.

Unfortunately we only know if it’s a BME680 or other BMxx80 after _init_bmxx80 gets called, so before then any calls to get_report_time_delta can’t be correct for BME680 and other BMxx80.

Possible solution: make BME680 a separate sensor, with corrected report time. This is a breaking change for people using BME680 though.

Another possibility is adding a BME680 sensor, but allowing BME280 to still use BME680 sensors. This does not break peoples’ currently working configs, but allows BME680 sensors on BME280 config to continue returning incorrect report time.

Did you read Add a BME280 report time config option to reduce mcu load by Blinker73 · Pull Request #5756 · Klipper3d/klipper · GitHub?

Good luck, hcet14

Yeah I’m aware of i2c sensors updating slowly on slow host devices. This is a different issue. The report time returned in the code is inconsistent with the scheduled callback delay.

This doesn’t affect normal BME280s. It’s just the BME680.

Kind ping @Arksine - think its your domain

I don’t have a BME680 myself, however this is a relatively straight forward fix. I created a pull request that should address the issue. If someone with a BME680 wants to test the branch and report feedback it would be helpful.

So this is the

Unfortunately we only know if it’s a BME680 or other BMxx80 after _init_bmxx80 gets called, so before then any calls to get_report_time_delta can’t be correct for BME680 and other BMxx80.

solution. It only becomes correct after initialization, so there’s a period of time where it’s not correct. Unfortunately, due to initialization order, this results in some bugs where modules (the case I’m aware of is heater.py) query get_report_time_delta at initialization (before the sensor is fully initialized), then just save that value.

One alternate approach is to just make sure all accesses to get_report_time_delta don’t save it, I guess. This doesn’t require any changes to peoples’ configs, but I’m not sure what the behavior looks like, since there’s still going to be some operations going on using the pre-initialization incorrect value.