How to remove certain config from a portable environment?

Hi,

Probably a stupid newbie question again…

I’m working with a portable environment “platform_custom_env.ini”.
I created some custom environments with my custom settings, i.e.

; --------------------------------------------------------------------------------------
; esp32-rf-custom
; --------------------------------------------------------------------------------------
[env:esp32-rf-custom]
extends = env:esp32dev-rf
lib_deps =
  ${env:esp32dev-rf.lib_deps}
build_flags =
  ${env:esp32dev-rf.build_flags}
  ${env:my-network.build_flags}
  '-DGateway_Name="OMG-ESP32-RF-GPIO16"'
  '-DRF_RECEIVER_GPIO=16'

Here I explicitly set some parameters etc…

Now I’m wondering: is it also possible to UNSET some parameters?
In my case, I want to start from the “esp32-mult_receiver” environment, and disable the CC1101 module, because the esp won’t start if the transceiver is not connected

On the terminal I can see following error:

N: WiFi ok with manual config credentials
N: RF_EMITTER_GPIO: 12
N: RF_RECEIVER_GPIO: 27
E: C1101 spi Connection Error
N: RF_EMITTER_GPIO: 12
N: RF_RECEIVER_GPIO: 27
N: RF_EMITTER_GPIO: 12
N: RF_RECEIVER_GPIO: 27
N: ZgatewayRTL_433 setup done
N: Switching to RTL_433 Receiver: 433.92Mhz
rtl_433_ESP(3): CC1101 radio.begin() failed, code: -2

My custom environment looks now like

; --------------------------------------------------------------------------------------
; esp32-multi_receiver-custom
; --------------------------------------------------------------------------------------
[env:esp32-multi_receiver-custom]
extends = env:esp32dev-multi_receiver
lib_deps =
  ${env:esp32dev-multi_receiver.lib_deps}
build_flags =
  ${env:esp32dev-multi_receiver.build_flags}
  ${env:my-network.build_flags}

  '-DGateway_Name="OpenMQTTGateway_multi_receiver"'

  '-DZgatewayPilight="Pilight"'
  '-DZgatewayRF="RF"'
  '-DZgatewayRTL_433="RTL_433"'
  '-DZgatewayRF2="RF2"'

  '-DZradioCC1101="CC1101"'
  '-DvalueAsATopic=true'  ; MQTT topic includes model and device (rtl_433) or protocol and id (RF and PiLight)

  '-DDEFAULT_RECEIVER=4'  ; Default receiver to enable on startup 1 - PiLight 2 - RF 3 - RTL_433 4 - RF2

; *** RF Module Options ***
  '-DRF_CC1101="CC1101"'  ; CC1101 Transceiver Module
  '-DRF_MODULE_CS=5'      ; pin to be used as chip select
  '-DRF_MODULE_GDO0=12'   ; CC1101 pin GDO0
  '-DRF_MODULE_GDO2=27'   ; CC1101 pin GDO2
  '-DRF_MODULE_INIT_STATUS=true'    ; Display transceiver config during startup

So in fact an explicit copy of the default.

But is there a possibility to DISABLE the CC1101 dependency?

kind regards,

Bart Plessers

Hi @BartPlessers,

Any definitions which are not defined in any included .lib_deps and .build_flags can just be commented out or deleted.

Any definitions which are defined in any included .lib_deps and .build_flags can be undefined with

'-U…

so

'-UZradioCC1101="CC1101"'

should do the trick.

Without a CC1101 though it won’t be possible to use RTL_433, so the related .lib_deps and .build_flags should also be undefined removed, which brings me to the point of advising you to build your custom environment from the ground up by only copying the relevant defines for your gateway.

Hope this helps.

thanx a lot. again.

I was just wondering: with the multi_receiver setup is easy to switch between RF and RF2 (by mqtt commands) without the need to recompile/upload code. I don’t know if this functionality is implemented in let’ say the esp32def-rf environment, but why should it.
So the idea was to use the multi_receiver (that has this functionality) and scale down it a bit so that it at least start without a CC1101 attached.

What I meant was building up a new environment from scratch, but taking the multi_receiver one as a template.

Currently you would still have

${libraries.smartrc-cc1101-driver-lib}
${libraries.rtl_433_ESP}

unnecessarily included and uploaded with your

${env:esp32dev-multi_receiver.lib_deps}

and have superfluous undefines with

'-UZradioCC1101="CC1101"'
'-URF_CC1101="CC1101"'
'-URF_MODULE_CS=5'      ; pin to be used as chip select
'-URF_MODULE_GDO0=12'   ; CC1101 pin GDO0
'-URF_MODULE_GDO2=27'
…

So building up a new environment without all these would make the firmware slimmer and the environment clearer. The MQTT module switching should still be possible among the then included non-rtl_433 modules.