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

Adds support for SPL06_007 Temperature & Pressure I2C (+10k2 code) #21185

Merged
merged 5 commits into from
Apr 18, 2024

Conversation

rai68
Copy link
Contributor

@rai68 rai68 commented Apr 15, 2024

Description:

Related issue (if applicable): fixes N/A

Checklist:

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

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

@s-hadinger
Copy link
Collaborator

+10K seems a lot for this sensor. Can you find ways to reduce it?

@rai68
Copy link
Contributor Author

rai68 commented Apr 15, 2024

I can only get it down to roughly 10k for the library its self, the device has an odd amount of calibration values required, seems to be for accuracy and its speed at reading

@s-hadinger
Copy link
Collaborator

I think that the main problem is using double instead of float. This causes the linkage of the huge double libraries that we have avoided until now

@rai68
Copy link
Contributor Author

rai68 commented Apr 16, 2024

Maybe im counting the size wrong? I was just adding up the size of the files in my file explorer, I don't see how changing a double to float could change the size that much, perhaps a different method is used?

@s-hadinger
Copy link
Collaborator

I tried on ESP8266, I only see 2.7KB increase.

However you should still move to float. Espressif chips don't have any hardware FPU, so all floating point operations are done in software. double operations library are significantly larger than float and generated code is also significantly larger.

See https://tasmota.github.io/docs/Sensor-API/#floats-not-doubles

We have been chasing down almost all double calculation to replace with float. I'm convinced that you can move to float without any impact.

For example: avoid k = 524288.0d; and prefer k = 524288.0f;

@s-hadinger
Copy link
Collaborator

s-hadinger commented Apr 16, 2024

I changed blindly all double to float and it went down to 2.5KB. I expect it to be acceptable then.

Can you please do those changes?

@arendst
Copy link
Owner

arendst commented Apr 17, 2024

Thx. In order to merge please change chosen sensor index 126 to it's final destination 25

@arendst arendst merged commit 13cbf26 into arendst:development Apr 18, 2024
60 checks passed
@sfromis
Copy link
Contributor

sfromis commented Apr 22, 2024

Noticed an inconsistency in what feature flag bit is used. While decode-status.py has the expected addition of USE_SPL06_007 as the current last non-empty name in the table, support_features.ino looks off.

According to the position, the expected bit should be 0x00000020 (the 5th bit in the last block of bits), but the code is actually using 0x10000000 (skipping the expected bit). Also, 0x10000000 is indicated as free at the end of the feature bits. Should most probably be corrected to 0x00000020.

sfromis added a commit to sfromis/Tasmota that referenced this pull request Apr 27, 2024
Obvious "typo" in setting the feature bit for this recently added sensor. Already mentioned in arendst#21185 (comment)
s-hadinger pushed a commit that referenced this pull request Apr 27, 2024
Obvious "typo" in setting the feature bit for this recently added sensor. Already mentioned in #21185 (comment)
hawa-lc4 pushed a commit to hawa-lc4/Tasmota-dev that referenced this pull request May 7, 2024
…rendst#21185)

* Adds support for SPL06_007 (+10k2 code)

* removes not so used methods.

Removes -2kb

* change doubles to floats

* fixes a name

* change sns idx to 25
hawa-lc4 pushed a commit to hawa-lc4/Tasmota-dev that referenced this pull request May 7, 2024
hawa-lc4 pushed a commit to hawa-lc4/Tasmota-dev that referenced this pull request May 7, 2024
Obvious "typo" in setting the feature bit for this recently added sensor. Already mentioned in arendst#21185 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants