Unable to compile RTL_433 and BT together on ESP32

Hi,

I’m facing an error when trying to compile the development branch (cf0f535) for ESP32 with both RTL_433 and BT modules. I can compile only when only one of those modules is enabled. I’ve tried couple of previous commits to no avail.

Using pio on Linux.

Config:

[env:esp32-somfy-ble]
platform = ${com.esp32_platform}
board = esp32dev
upload_port = /dev/CP2104
upload_speed = 256000
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.ble}
  ${libraries.decoder}
  ${libraries.rtl_433_ESP}
  ${libraries.smartrc-cc1101-driver-lib}
  ${libraries.somfy_remote}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
  '-DZgatewayRTL_433="RTL_433"'
  '-DZactuatorSomfy="Somfy"'
  '-DZradioCC1101="CC1101"'
  '-DLED_SEND_RECEIVE=2'
  '-DLED_SEND_RECEIVE_ON=1'
  '-DGateway_Name="OpenMQTTGateway"'

The error:

/home/andrew/projects/OpenMQTTGateway/main/ZgatewayBT.ino:68:1: error: 'TheengsDecoder' does not name a type
TheengsDecoder decoder;
^
Compiling .pio/build/esp32-somfy-ble/lib5e4/WiFi/WiFiMulti.cpp.o
/home/andrew/projects/OpenMQTTGateway/main/ZgatewayBT.ino: In function 'void launchBTDiscovery()':
/home/andrew/projects/OpenMQTTGateway/main/ZgatewayBT.ino:794:32: error: 'decoder' was not declared in this scope
std::string properties = decoder.getTheengProperties(p->sensorModel_id.c_str());
^
/home/andrew/projects/OpenMQTTGateway/main/ZgatewayBT.ino: In function 'void process_bledata(ArduinoJson::JsonObject&)':
/home/andrew/projects/OpenMQTTGateway/main/ZgatewayBT.ino:878:7: error: 'decoder' was not declared in this scope
if (decoder.decodeBLEJson(BLEdata)) { // Broadcaster devices
^

I can see |-- <TheengsDecoder> 0.1.4+sha.0c1649f in the dependency graph above, but the build cannot find it during compilation.

Could someone help me with this please?

Cheers.

Hi,

Interesting, I reproduce your issue.

I also get it working by changing this

@h2zero any thoughts on this?

I thought that the two modules wouldn’t work together on the same ESP32 as they were very resource intensive ?

Yeah, didn’t tested it. Only building. I should have written “building” instead if working.

Hi @1technophile ,

Thanks for your reply.
I didn’t quite get what you’ve done.
decoder.h already defines TheengsDecoder class.
Have you added a new TheengsDecoder.cpp and TheengsDecoder.h ?

Hello,

I renamed the .h and .cpp to match the class name and renamed the library include.

So I tried to do the same, and it compiles fine.
However I’m getting a boot loop on startup.
The error:

*WM: [1] AutoConnect: SUCCESS 
*WM: [1] STA IP Address: 192.168.1.37
N: BLE scans interval: 55555
N: BLE scans number before connect: 10
N: Publishing only BLE sensors: false
N: minrssi: 100
N: Low Power Mode: 0
WARNING: low memory? malloc() failed in blueline_create() from .pio/libdeps/esp32-somfy-ble/rtl_433_ESP/src/rtl_433/devices/blueline.c:416
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4010f735  PS      : 0x00060b30  A0      : 0x8010f792  A1      : 0x3ffd8170  
A2      : 0x3ffc8d50  A3      : 0x3ffefea4  A4      : 0x00000000  A5      : 0x00002a9c  
A6      : 0x00000000  A7      : 0x00000004  A8      : 0x8010f6e8  A9      : 0x3ffd8150  
A10     : 0x00000000  A11     : 0x3fff2a20  A12     : 0x00000000  A13     : 0x00010008  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000038  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffdd  

ELF file SHA256: 0000000000000000

Backtrace: 0x4010f735:0x3ffd8170 0x4010f78f:0x3ffd8190 0x40101f8d:0x3ffd81b0 0x4010200b:0x3ffd81f0 0x400d5863:0x3ffd8220 0x400df3f8:0x3ffd8240 0x401198e6:0x3ffd82e0 0x40090f2a:0x3ffd8300

Rebooting...

Any suggestions ?

As @NorthernMan54 warned the board may not have enough memory for this combination.
I suggest that you remove protocols from RTL_433 so as to free more memory

@antoniosa in the rtl_433_esp module I included a compiler definition called MY_DEVICES that shows the changes needed to reduce the number of device decoders. You should be able to use this as a guide to make the adjustments to reduce the memory usage based on your specific devices.

1 Like

Thanks for suggestions guys.
I’ve played around with things and concluded that I actually don’t need RTL_433 for my devices, they work fine with RCSwitch. Thus the problem is irrelevant for me anymore.
Anyway thank you for a brilliant piece of software, I can now control my blinds and ceiling fans with Homeassistant.

Cheers.

1 Like