This is how I go about creating my binary environments in my personal *_env.ini file. Might help you and others, or might also encourage others to chip in with their solutions so I might get new ideas as well.
I take the environment definition from platformio.ini for the correct board and functionality I want, in this example the BLE gateway for an ESP32
[env:esp32dev-ble]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DLED_SEND_RECEIVE=2'
'-DLED_SEND_RECEIVE_ON=0'
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
I then go through the appropriate config_*.h file, in this case config_BT.h, and read through all the comments for the various definitions there, and add the ones I want to personalise in my environment. For my setup I want
# define TimeBtwRead 55555 //define default time between 2 scans
to be 20000
and
# define pubBLEManufacturerData false // define true if you want to publish the manufacturer's data (sometimes contains characters that aren't valid with receiving client)
to be true
So I add these to the environment
[env:esp32dev-ble]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DLED_SEND_RECEIVE=2'
'-DLED_SEND_RECEIVE_ON=0'
'-DTimeBtwRead=20000'
'-DpubBLEManufacturerData=true'
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
Since I have multiple environment definitions in my personal *_env.ini file, which share common definitions like using manual WiFi setup, the WiFi credentials, MQTT server details - defined in the User_config.h file … I define these at the beginning of my *_env.ini
[wifi]
build_flags =
'-DESPWifiManualSetup=true'
'-Dwifi_ssid="XXSSIDXX"'
'-Dwifi_password="XXPASSWORDXX"'
[mqtt]
build_flags =
'-DMQTT_SERVER="192.168.X.XX"'
'-DMQTT_USER="XXUSERXX"'
'-DMQTT_PASS="XXPASSWORDXX"'
and can then easily add these to all gateway environments. For the above example
[env:esp32dev-ble]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DLED_SEND_RECEIVE=2'
'-DLED_SEND_RECEIVE_ON=0'
'-DTimeBtwRead=20000'
'-DpubBLEManufacturerData=true'
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
${wifi.build_flags}
${mqtt.build_flags}
Nicely building up personalised environments in the separate *_env.ini file, which can then easily be copied over to any new OMG version in the future.
The key for me was going through all the relevant config files and also diffing the config files whenever a new OMG version comes out to see what options might have changed or been added.