Github Boards Devices Community Docs Blog

User_config.h is ignored by PlatformIO

Hello, I know that is not the exact subject here but I have no alternative.
I have been trying to configure OMG in PlatformIO for a week, but all changes I make to User_config.h are ignored in the compilation.
I’ve tried all the alternatives I could think of, can someone help me?
Thanks.

Hello,

If parameters are defined into your .ini platformio file this is normal.
Main parameters definition in config files are ignored if they are already define into a .ini file.
We may help you if you post a list of the change you made.
You can also try to define your change in the .ini files like below:

[env:esp32-lolin32lite-ble]
platform = ${com.esp32_platform}
board = lolin32
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.ble}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
  '-DLED_RECEIVE=22'
  '-DLED_RECEIVE_ON=0'
  '-DGateway_Name="OpenMQTTGateway_LOLIN32LITE_BLE"'
  '-DMQTT_USER="lolin-esp32"'
  '-DMQTT_PASS="yourpassword"'
  '-DMQTT_SERVER="192.168.1.88"'
1 Like

Hi Florian, thanks for the help.
I understood your explanation and made the changes you said. No compilation errors but still without the basics like Wifi.

 My User_Config parameters:

//#define ESP32_ETHERNET=true // Uncomment to use Ethernet module on OLIMEX ESP32 Ethernet gateway

#if defined(ESPWifiManualSetup) // for nodemcu, weemos and esp8266
#  ifndef wifi_ssid
#    define wifi_ssid "My-WIFI-ssid"
#  endif
#  ifndef wifi_password
#    define wifi_password "My-Wifi-Pass"
#  endif
#endif

#ifndef WifiManager_password
#  define WifiManager_password "Gate-Pass" //this is going to be the WPA2-PSK password for the initial setup access point
#endif

/*-------------DEFINE THE MODULES YOU WANT BELOW----------------*/
//Addons and module management, uncomment the Z line corresponding to the module you want to use

`#define ZgatewayRF     "RF"       //ESP8266, Arduino, ESP32`
#define ZgatewayIR     "IR"       //ESP8266, Arduino,         Sonoff RF Bridge
//#define ZgatewayLORA   "LORA"       //ESP8266, Arduino, ESP32
//#define ZgatewayPilight "Pilight" //ESP8266, Arduino, ESP32
//#define ZgatewayWeatherStation "WeatherStation" //ESP8266, Arduino, ESP32
#define ZgatewayBT     "BT"       //ESP8266, ESP32
//#define ZgatewayRF2    "RF2"      //ESP8266, Arduino, ESP32
//#define ZgatewaySRFB   "SRFB"     //                          Sonoff RF Bridge
//#define Zgateway2G     "2G"       //ESP8266, Arduino, ESP32
//#define ZgatewayRFM69  "RFM69"    //ESP8266, Arduino, ESP32
//#define ZactuatorONOFF "ONOFF"    //ESP8266, Arduino, ESP32,  Sonoff RF Bridge
//#define ZsensorINA226  "INA226"   //ESP8266, Arduino, ESP32
//#define ZsensorHCSR04  "HCSR04"   //ESP8266, Arduino, ESP32
#define ZsensorHCSR501 "HCSR501"  //ESP8266, Arduino, ESP32,  Sonoff RF Bridge
//#define ZsensorADC     "ADC"      //ESP8266, Arduino, ESP32
//#define ZsensorBH1750  "BH1750"   //ESP8266, Arduino, ESP32
//#define ZsensorTSL2561 "TSL2561"  //ESP8266, Arduino, ESP32
//#define ZsensorBME280  "BME280"   //ESP8266, Arduino, ESP32
//#define ZsensorHTU21   "HTU21"    //ESP8266, Arduino, ESP32
#define ZsensorDHT     "DHT"      //ESP8266, Arduino, ESP32,  Sonoff RF Bridge
//#define ZsensorDS1820  "DS1820"   //ESP8266, Arduino, ESP32
//#define ZsensorGPIOKeyCode "GPIOKeyCode" //ESP8266, Arduino, ESP32
//#define ZsensorGPIOInput "GPIOInput" //ESP8266, Arduino, ESP32
#define ZmqttDiscovery "HADiscovery"//ESP8266, Arduino, ESP32, Sonoff RF Bridge
#define ZactuatorFASTLED "FASTLED" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
//#define ZboardM5STICKC "M5StickC"
//#define ZboardM5STACK  "ZboardM5STACK"
//#define ZradioCC1101   "CC1101"   //ESP8266, ESP32
//#define ZactuatorPWM   "PWM"      //ESP8266, ESP32

And in Platformio.ini I have the “default_envs = nodemcuv2-all-test” choosed.

Thanks for your patience, this Platformio makes me feel like an old man who has never turned on a computer or changed a lamp.

ps1: Ow, Why the hell does the compilation continue using the example ip 192.168.1.17 if this number no longer exists in User_config?

ps2: I looked in “Help”, in “FAQ” … I didn’t find how to leave the message as “code” like you did in your answer.

Well, I try this in Platformio.ini :

build_flags =
  ${com-esp.build_flags}
  '-DZgatewayRF="RF"'
  '-DZgatewayIR="IR"'
  '-DZgatewayBT="BT"'
  '-DZactuatorFASTLED="FASTLED"'
  '-DZsensorHCSR501="HCSR501"'
  '-DZsensorHCSR04="HCSR04"'
  '-DZsensorDHT="DHT"'
  '-Dwifi_ssid="My-Router"'
  '-Dwifi_password "RouterPass"'
  '-DGateway_Name="Gateway_Name"'
  '-DMQTT_USER="Mosquitto_User"'
  '-DMQTT_PASS="Mosquitto_Pass"'
  '-DMQTT_SERVER="192.168.1.xxx"'
board_build.flash_mode = dout

It works, but I have the same config in User_config.h and I don’t know wich is working. My Platformio is very unstable here. :roll_eyes:

You can put the default user_config.h. This way you will be sure that infos are coming from the .ini