Comments (12)
Sounds like we should just put an if
check if roombaState.capacity
is 0 so we don't divide by 0 (what @kaosrq said). Not sure if that will solve all of the problems in this thread but can't hurt.
from esp-roomba-mqtt.
Checking the serial monitor gives me this:
Exception (0):
epc1=0x4000dce5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
ctx: cont
sp: 3ffffc60 end: 3fffffd0 offset: 01a0
>>>stack>>>
3ffffe00: 4000066d 9d438d71 000026fe 00000098
3ffffe10: 00000041 9d438d71 00000020 fffffffe
3ffffe20: 00000066 3fffc6fc 2c448d71 00985297
3ffffe30: 00418937 002d1666 3ffeffd4 00000030
3ffffe40: 0000001f 40104bf5 3ffefa6c 4020b96c
3ffffe50: 00000000 3ffefa6c 3ffefa6c 40203c02
3ffffe60: 4000050c 00000000 0000001f 40104bf5
3ffffe70: 4020bdc8 3ffffe80 000000c8 00000008
3ffffe80: 3ffffe70 00000000 00000001 00000000
3ffffe90: 3fffdab0 00000000 3fffd9d0 3ffeffd4
3ffffea0: 00000000 00000000 00000001 3ffe862c
3ffffeb0: 00000000 3fffdad0 3ffeffd4 00000030
3ffffec0: 00000000 000026e5 3ffeffd4 00000030
3ffffed0: 00000000 00000000 00000001 3ffeffcc
3ffffee0: 00000000 3fffdad0 3ffeffd4 00000030
3ffffef0: 40201d55 3fffc6fc 3ffefd54 4020b808
3fffff00: 00000000 4bc6a7f0 00002711 402064d0
3fffff10: 00000000 00000000 4bc6a7f0 00000000
3fffff20: 3ffefccc 00000064 4010663a 00000000
3fffff30: 00000000 00000015 3ffefa6c 40204a1b
3fffff40: 00000000 4bc6a7f0 00002711 3ffeffd4
3fffff50: 00000000 00000000 4bc6a7f0 00000000
3fffff60: 3fffdad0 3ffeffd4 4010663a 051eb851
3fffff70: 00000000 00000064 3ffefa6c 3ffefd30
3fffff80: 00002711 3ffefa6c 3ffefd54 40203ee4
3fffff90: 00000000 00000000 00000000 4020b5a0
3fffffa0: 00000000 00000000 00000001 3ffeffd4
3fffffb0: 3fffdad0 00000000 3ffeffcc 4020987c
3fffffc0: feefeffe feefeffe 3ffe862c 40100721
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld
from esp-roomba-mqtt.
The problem seems to arise in the function void sendStatus()
. When assigning a fixed value to the line root["battery_level"] = (roombaState.charge * 100)/roombaState.capacity;
The crash does not happen. Probably at some point roombaState.capacity
is 0 and gives a division error by 0.
from esp-roomba-mqtt.
For now I'm using this "ghetto-fix":
I looked up the value for Capacity via telnet and substituted "roombaState.capacity;"
root["battery_level"] = (roombaState.charge * 100)/2696;
I know the capacity will change over time but for now, I can get an estimate till the problem is fixed...
from esp-roomba-mqtt.
I get the same issue. Any help?
from esp-roomba-mqtt.
my stack trace
0x4020382c: loop() at C:\Users\Leo\Desktop\esp-roomba-mqtt-master\src/src.ino line 417 0x4020382c: loop() at C:\Users\Leo\Desktop\esp-roomba-mqtt-master\src/src.ino line 417 0x40208c3c: WiFiClient::operator bool() at C:\Users\Leo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\libraries\ESP8266WiFi\src\WiFiClient.cpp line 350 0x401001c0: millis at C:\Users\Leo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\cores\esp8266\core_esp8266_wiring.c line 183 0x40206c78: RemoteDebug::handle() at C:\Users\Leo\Documents\Arduino\libraries\RemoteDebug\RemoteDebug.cpp line 317 0x40208d40: Roomba::pollSensors(unsigned char*, unsigned char, unsigned char*) at C:\Users\Leo\Documents\Arduino\libraries\Roomba\Roomba.cpp line 279 0x401001c0: millis at C:\Users\Leo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\cores\esp8266\core_esp8266_wiring.c line 183 0x402083f4: esp_yield() at C:\Users\Leo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\cores\esp8266\core_esp8266_main.cpp line 91 0x40201546: delay at C:\Users\Leo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\cores\esp8266\core_esp8266_wiring.c line 54 0x4020391c: loop() at C:\Users\Leo\Desktop\esp-roomba-mqtt-master\src/src.ino line 451 0x40202944: mqttCallback(char*, unsigned char*, unsigned int) at C:\Users\Leo\Desktop\esp-roomba-mqtt-master\src/src.ino line 136 0x40208ac4: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\leo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2/functional line 1934 0x40208aac: std::_Function_handler ::_M_invoke(std::_Any_data const&, char*, unsigned char*, unsigned int) at c:\users\leo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2/functional line 2069 0x402084a0: loop_wrapper() at C:\Users\Leo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\cores\esp8266\core_esp8266_main.cpp line 125
from esp-roomba-mqtt.
The problem seems to occur once you connect to the broker, loses the connection after showing this message:
Debug: Command recevied: p
* Show profiler: On
(D p:^3698ms) Reconnecting MQTT
(D p:^0000ms) Attempting MQTT connection...
(D p:^0105ms) MQTT connected
If wrong MQTT data is configured (preventing it from connecting) the crash does not occur.
from esp-roomba-mqtt.
I have exakt the same problem.
Had to delete the line to get it to work.
Now of course Home Assistant doesn't get a battery reading.
Using telnet to see the values, there are all there and stable.
Thinking about doing the math in Home Assistant to get the %.
EDIT: I think that's not possible since roombaState.charge and roombaState.capacity aren't available to HA.
from esp-roomba-mqtt.
At the moment I can not get the values of the roomba (all in 0). Then "solve" temporarily replacing:
root["battery_level"] = (roombaState.charge * 100)/roombaState.capacity;
with this
root["battery_level"] = roombaState.capacity > 0 ? (roombaState.charge * 100) / roombaState.capacity : (roombaState.charge * 100) / 2697;
from esp-roomba-mqtt.
Thanks for the post, this help me a bit further. Now my ESP (WeMos D1) is no longer rebooting.
But i only get empty values in my MQTT status. :
{"battery_level":0,"cleaning":false,"docked":false,"charging":false,"voltage":0,"current":0,"charge":0}
And it is only send once.
When i log into the ESP using Telnet, and set VERBOSE logging i get valid data:
(V t:84011ms) Got Packet of len=17! Distance:0mm ChargingState:4 Voltage:14416mV Current:-203mA Charge:2687mAh Capacity:2696mAh
Any help on how get the data send to MQTT broker?
Steffen
from esp-roomba-mqtt.
Problem Solvej: The MQTT string (when populated with values) was longer than the default setting of 128 In the MQTT library. When I changed the value to 256 I started getting MQTT statuses send to the broker.
Next challenge:
Battery was drained from testing, when I placed roomba in charger, it stopped responding and I could not ping itπ§. This project just wonβt let me move on....
Well guess itβs a Hardware problem, this I should be able to solve on my own...π
from esp-roomba-mqtt.
did you change MQTT_MAX_PACKET_SIZE
to fix this?
from esp-roomba-mqtt.
Related Issues (20)
- TX and BRC HOT 6
- Wiring Scmatics for ESP 01 HOT 1
- Not Working after Upload to D1 Mini HOT 2
- Warning: control reaches end of non-void function
- Roomba 770 Responds to clean message, but no others. HOT 1
- Roomba 521 HOT 1
- Debug mode keeps disconnecting HOT 1
- config of secrets.h file HOT 2
- build problem HOT 4
- Problems installing on ESP01
- Not Compatible with the newest hass.io integration
- Compiling using Arduino IDE (passing build_flags)
- howto rename Roomba HOT 2
- Disable default wifi hotspot HOT 3
- Readme.md Electronics picture, GPIO 15 wrong HOT 2
- Roomba 560 no control
- Using it with domoticz ?
- Strange Thing taking from Roomba HOT 2
- D1 Mini restarting every 11 seconds
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-roomba-mqtt.