OpenMQTTGateway icon indicating copy to clipboard operation
OpenMQTTGateway copied to clipboard

Enable BLE and 433 for Boards like the LilyGo

Open Andyriod opened this issue 1 year ago • 5 comments

The lilygo-rtl_433 has both BLE and 433 on board. After the PR from @SmittyHalibut there is no compile problem anymore, but I tried to enable both in environments.ini and it doesn't work. It only publishes BT-Deveices and is in some kind of bootloop.

Here is what I did:

[env:lilygo-rtl_433]
platform = ${com.esp32_platform}
board = ttgo-lora32-v21
; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager32}
  ${libraries.ssd1306}
  ${libraries.rtl_433_ESP}
  ${libraries.ble}
  ${libraries.decoder}
build_flags =
  ${com-esp.build_flags}
; *** OpenMQTTGateway Config ***
  ;'-UZmqttDiscovery'          ; disables MQTT Discovery
  '-DvalueAsATopic=true'    ; MQTT topic includes model and device
  '-DGateway_Name="OpenMQTTGateway_lilygo_rtl_433_ESP"'
; *** OpenMQTTGateway Modules ***
  '-DZgatewayRTL_433="rtl_433"'
  '-DZradioSX127x="SX127x"'
  '-DZgatewayBT="BT"'
; *** ssd1306 Display Options ***
  '-DZdisplaySSD1306="LilyGo_SSD1306"'
;  '-DLOG_TO_OLED=true'         ; Enable log to OLED
;  '-DJSON_TO_OLED=true'
;  '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
;  '-DDISPLAY_IDLE_LOGO=false'
;  '-DDISPLAY_BRIGHTNESS=80'
;  '-DDISPLAY_METRIC=false'
custom_description = For ESP32, Gateway using RTL_433_ESP and RadioLib
custom_hardware = ESP32 LILYGO LoRa32 V2.1

Andyriod avatar Mar 13 '23 20:03 Andyriod

We are working on it below: https://github.com/1technophile/OpenMQTTGateway/tree/heltec-bt-rtl-env

Not finished yet

1technophile avatar Mar 13 '23 20:03 1technophile

I think what you're seeing is https://github.com/NorthernMan54/rtl_433_ESP/issues/61 with associated pull request https://github.com/NorthernMan54/rtl_433_ESP/pull/62

tl,dr: rtl_433_ESP is inspecific which type of memory to calloc() and it appears the ESP core is pulling from one that's very limited. Enabling both rtl_433_ESP and BT at the same time exhausts this memory pool, and rtl_433_ESP runs out of available heap. My PR has it pull from the larger "INTERNAL" heap pool, which is what is reported on using the ESP "How much memory is available?" calls.

You can use my branch by applying this change to OpenMQTTGateway. Do this, and try again, tell me if its still happening.

[13:49:08] mark@crossthread:~/src/OpenMQTTGateway$ git diff
diff --git a/platformio.ini b/platformio.ini
index 7b99171..b48c222 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -145,7 +145,8 @@ smartrc-cc1101-driver-lib = [email protected]
 stl = https://github.com/mike-matera/ArduinoSTL.git#7411816
 shtc3 = https://github.com/sparkfun/SparkFun_SHTC3_Arduino_Library
 [email protected]
-rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.1.6
+;rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.1.6
+rtl_433_ESP = https://github.com/SmittyHalibut/rtl_433_ESP.git
 emodbus =  miq19/[email protected]
 gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1
 decoder = https://github.com/theengs/decoder.git
[13:49:11] mark@crossthread:~/src/OpenMQTTGateway$ 

NOTE: This is only a temporary change until rtl_433_ESP accepts my PR, and OpenMQTTGateway pulls in a new version of rtp_433_ESP that has my change.

Also: I will NOT be working to keep my branch up-to-date with upstream (at least, not reliably), so this is most definitely a compromise. (Having said that, I did just merge in one upstream commit just now, so it is up to date right now.)

Hopefully my PR to rtl_433_ESP will be accepted soon, and OpenMQTTGateway will bump to the new version of rtl_433_ESP soon after that.

SmittyHalibut avatar Mar 13 '23 20:03 SmittyHalibut

Thanks to @NorthernMan54 it looks like https://github.com/NorthernMan54/rtl_433_ESP/pull/62 has been accepted and will be released soon. 🥳

SmittyHalibut avatar Mar 13 '23 23:03 SmittyHalibut

Possibly getting a bit off-topic, but are there plans to combine ["RF","RF2","BT","rtl_433"] in an official package for ESP. This setup is working fine for me, since I used above https://github.com/NorthernMan54/rtl_433_ESP/pull/62. Thanks.

wastlmuc avatar Dec 13 '23 19:12 wastlmuc

Spent a fair bit of time and effort on this, and eventually abandoned the effort as getting something that was stable due to resource constraints between the various packages.

NorthernMan54 avatar Dec 13 '23 23:12 NorthernMan54