I was trying to conditionally replace some variables inside platformio.ini using a python script registered as a pre extra script:
extra_scripts = pre:scripts/gen_vars.py.
When I try to do
config.set('common', 'esp_protocol', 'esptool') inside that script, even though
print(config.get('common', 'esp_protocol')) returns the expected ‘esptool’ string, I still get
Warning! Unknown upload protocol ESP_PROTOCOL, where that’s defined as `esp_protocol = ESP_PROTOCOL’ inside platformio.ini.
Relevant scripts can be found here
I’m using platformio core 5.0.4.
If anyone knows why this maybe happening and how I can fix it, please let me know.