syssi / esphome-jk-bms

ESPHome component to monitor and control a Jikong Battery Management System (JK-BMS) via UART-TTL or BLE
Apache License 2.0
442 stars 148 forks source link

How to increase the stack size? #303

Closed rfenouil closed 1 year ago

rfenouil commented 1 year ago

Thank you for this work, this library is awesome !

I am using the 'esp32-ble-multiple' template to connect to 2 BMS (ebike batteries), and when I add too many sensors I get into the boot loop problem.

I tried increasing the stack size as you suggested here, but it did not help:

esphome:
  name: ${name}
  platformio_options:
    build_flags:
       - -DCONFIG_ARDUINO_LOOP_STACK_SIZE=65535
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

I also tried to set DARDUINO_LOOP_STACK_SIZE as I found a reference to this name during my search but it did not help either.

Can you spot something wrong with my declaration above ?

Thank you for your help !

My esphome version (docker): 2023.3.2

rfenouil commented 1 year ago

Sorry for the naive questions, I am not familiar with esphome/arduino ecosystem... Should I reset the flash with esptool when changing such options, or is everything overwritten ayway ?

Just in case I also clean the ".esphome" folder from time to time... Not sure if that has any impact though :)

syssi commented 1 year ago

I don't know the answer of your question. It's possible the define doesn't work because it's for the Arduino framework only. May be the setting is different for ESP-IDF. Could you ask for help at the ESPHome discord channel and share the solution here?

rfenouil commented 1 year ago

Ok, I'll try to get some info and report back. Thank you.

kev300 commented 1 year ago

Sorry to hijack this thread by maybe my question fits here and I don't need to open another issue. 😬 Why are you using the framework setting esp-idf for this esphome component and why doesn't it work with the default (arduino)?

I tried it out of curiosity. It compiled but the esp did not react after the flash anymore so I had to reflash it via USB. ;)

syssi commented 1 year ago

In the past the Arduino framework wasn't able to handle the 300 bytes BLE notifications from the JK-BMS. It did crash on the first received message. Some people reported it does work in general now. The Arduino framework is an additional abstraction layer on top of ESP-IDF. I try to avoid additional/unnecessary layers if possible.