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.

2 Likes

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

Hello,
I’m trying to get the Lilygo to work with RTL and BT. It compiles but I get error:


ESP_ERROR_CHECK failed: esp_err_t 0x101 (ESP_ERR_NO_MEM) at 0x40095448
file: "IDF/components/esp_timer/src/ets_timer_legacy.c" line 69
func: ets_timer_setfn
expression: esp_timer_create(&create_args, (esp_timer_handle_t*)&(ptimer->timer_arg))

abort() was called at PC 0x4009544b on core 0


Backtrace: 0x40083f89:0x3ffe2450 0x40095455:0x3ffe2470 0x4009b6d1:0x3ffe2490 0x4009544b:0x3ffe2510 0x401821ad:0x3ffe2530 0x4016b325:0x3ffe2570 0x401d9ea0:0x3ffe2590 0x401d751c:0x3ffe25b0 0x401d76f1:0x3ffe25d0 
0x40217129:0x3ffe25f0

I understand that it is perhaps possible to solve this by removing included supported rtl devices. I struggle to find the lib where I can remove these, or where to list which I want to include. Can you point me in the right direction please?

I asked to quickly, I found the reference here:

I cannot find this file locally though, should I include this in another source file locally?

If you look, you will find the say, that is true.

By limiting RTL devices to around 10 it works fine in combination with BT.
For me this is ok as there are really not that many 433Mhz devices I need.

This worked for me:

OpenMQTTGateway-development.pio\libdeps\lilygo-rtl_433\rtl_433_ESP\src\signalDecoder.cpp:




    // end of fragement &oregon_scientific_sl109h,

#else
      memcpy(&cfg->devices[0], &oregon_scientific, sizeof(r_device));
      memcpy(&cfg->devices[1], &interlogix, sizeof(r_device));
      memcpy(&cfg->devices[2], &oregon_scientific_v1, sizeof(r_device));
      memcpy(&cfg->devices[3], &rubicson, sizeof(r_device));
      memcpy(&cfg->devices[4], &rubicson_48659, sizeof(r_device));
      memcpy(&cfg->devices[5], &rubicson_pool_48942, sizeof(r_device));
      memcpy(&cfg->devices[6], &ts_ft002, sizeof(r_device));
      memcpy(&cfg->devices[7], &smoke_gs558, sizeof(r_device));
      memcpy(&cfg->devices[8], &kerui, sizeof(r_device));
      memcpy(&cfg->devices[9], &nexus, sizeof(r_device));
  

#endif

and in:
OpenMQTTGateway-development.pio\libdeps\lilygo-rtl_433\rtl_433_ESP\include\rtl_433_devices.h

#else
/**
 * Subset of devices that I have access to and have tested with
 */
#  define DEVICES         \
    DECL(oregon_scientific)          \
    DECL(interlogix)                 \
    DECL(oregon_scientific_v1)       \
    DECL(rubicson)                   \
    DECL(rubicson_48659)             \
    DECL(rubicson_pool_48942)        \
    DECL(ts_ft002)                   \
    DECL(smoke_gs558)                \
    DECL(kerui)                      \
    DECL(nexus)                      \
	
/* Add new personal decoders here. */
#  define NUMOF_OOK_DEVICES 10
#  define NUMOF_FSK_DEVICES 0
#endif

I will test for stability and report back if it not stable.
Thanks for great project and sorry for asking stupid questions…