Skip to content

Fix BME280#962

Merged
1technophile merged 12 commits into1technophile:developmentfrom
spacemanspiff2007:patch-1
May 30, 2021
Merged

Fix BME280#962
1technophile merged 12 commits into1technophile:developmentfrom
spacemanspiff2007:patch-1

Conversation

@spacemanspiff2007
Copy link
Contributor

Fix log output, since %H never prints anything

Fix log output, since %H never prints anything
@spacemanspiff2007
Copy link
Contributor Author

#963

@spacemanspiff2007 spacemanspiff2007 changed the title Fix log output Fix BME280 May 28, 2021
@spacemanspiff2007
Copy link
Contributor Author

Initialized BME280, otherwise it will not work

@1technophile 1technophile added this to the v0.9.7 milestone May 29, 2021
@spacemanspiff2007
Copy link
Contributor Author

I've updated the files so lint should pass now.
The other check seems to fail because of some unrelated reason but I am not sure.

@h2zero
Copy link
Collaborator

h2zero commented May 29, 2021

Build error notes:

error: no matching function for call to 'TwoWire::begin(int&, int&)'
framework-arduino-avr\libraries\Wire\src/Wire.h:53:10: note: candidate: void TwoWire::begin()
framework-arduino-avr\libraries\Wire\src/Wire.h:54:10: note: candidate: void TwoWire::begin(uint8_t)
framework-arduino-avr\libraries\Wire\src/Wire.h:55:10: note: candidate: void TwoWire::begin(int)

AVR wire library does not accept pins for parameters in the call to begin()

I recommend using a conditional check such as:

#Ifdef ESP32
  Wire.setPins(BME280_PIN_SDA, BME280_PIN_SCL);
#endif

Instead of the Wire.begin call that was added.

@spacemanspiff2007
Copy link
Contributor Author

@h2zero
Thank you for your quick analysis! Do you think it makes sense to just disable this for the AVRs?
I think the esp8266 supports it, too.
What would be the def for that?

@h2zero
Copy link
Collaborator

h2zero commented May 29, 2021

@spacemanspiff2007

Do you think it makes sense to just disable this for the AVRs?
I think the esp8266 supports it, too.
What would be the def for that?

I do not have the means to test the functionality but you could add the check as:

#if defined (ESP8266) || defined(ESP32)
  Wire.setPins(BME280_PIN_SDA, BME280_PIN_SCL);
#endif

That should at least compile and I don't see any reason for it to affect the function of all involved.

@spacemanspiff2007
Copy link
Contributor Author

I've done exactly that!
Thank you very much for you help!

@h2zero
Copy link
Collaborator

h2zero commented May 29, 2021

No worries 😄 lets hope it works out.

@h2zero
Copy link
Collaborator

h2zero commented May 29, 2021

@spacemanspiff2007, sorry I guess 8266 does not have setPins().

You'll need to change the check to this:

#  if defined(ESP8266) || defined(ESP32)
  Wire.begin(BME280_PIN_SDA, BME280_PIN_SCL);
#  else
  Wire.begin();
#  endif

@1technophile
Copy link
Owner

Thanks for the PR, for the code format you can take a look below:
So as to format automaticaly your document you have to add the "clang-Format" extension to VSCode, once done, you can format the code by doing a right click into the code file window and clicking "Format document".

@1technophile 1technophile linked an issue May 30, 2021 that may be closed by this pull request
removed empty line
@spacemanspiff2007
Copy link
Contributor Author

@1technophile
Thanks for the hint - I'll do this the next time from the beginning.

@1technophile 1technophile merged commit cd09476 into 1technophile:development May 30, 2021
JeroenWiersma pushed a commit to JeroenWiersma/OpenMQTTGateway that referenced this pull request Oct 18, 2025
Fix log output, since %H never prints anything
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.

Sensor BME280 is not working

3 participants