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

Make safe readTemperature #37

Open
annndruha opened this issue Jun 12, 2024 · 0 comments
Open

Make safe readTemperature #37

annndruha opened this issue Jun 12, 2024 · 0 comments

Comments

@annndruha
Copy link

annndruha commented Jun 12, 2024

  • Adafruit-BMP085-Library v1.2.4
  • NodeMCUv2
  • BPM180

Hello! While i use BPM180 with ESP8266WebServer sometimes one a month server stop to response. I figured out that problem at error with method readTemperature. Probably wires lost connect. But instead of some NaN return from readTemperature it was crash all code.

Below a Decoded stacktrace:

ESP Exception Decoder
Sketch: NodeMCU_BPM180_DHT11 FQBN: esp8266:esp8266:nodemcuv2

Exception (6):
epc1=0x402057ac epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffe40 end: 3fffffd0 offset: 0150
3fffff90:  3fffdad0 00000004 3ffee964 402059cc  
3fffffa0:  3fffdad0 00000000 3ffeeaec 40203cdd  
3fffffb0:  3fffdad0 00000000 3ffeeb64 40207f30  
3fffffc0:  feefeffe feefeffe 3fffdab0 40101095  
<<<stack<<<

Exception 6: IntegerDivideByZero: QUOS, QUOU, REMS, or REMU divisor operand is zero
PC: 0x402057ac: Adafruit_BMP085::computeB5(int) at ...\libraries\Adafruit_BMP085_Library\Adafruit_BMP085.cpp:101
EXCVADDR: 0x00000000

Decoding stack results
0x402059cc: Adafruit_BMP085::readTemperature() at ...\libraries\Adafruit_BMP085_Library\Adafruit_BMP085.cpp:266
0x40203cdd: loop() at ...\NodeMCU_BPM180_DHT11\NodeMCU_BPM180_DHT11.ino:55
0x40207f30: loop_wrapper() at ...

which says that some IntegerDivideByZero happens in line 101

I think it's code error and ask to make some safe processing for this. For example return NaN from readTemperature for this case.

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

No branches or pull requests

1 participant