Custom Build using PlatformIO?
Moderators: grovkillen, Stuntteam, TD-er
Custom Build using PlatformIO?
In the documents it says to open the file pre_extra_script.py if the first Build is successful.
But I can't find any file with that name in the Github source file. Here is what is found with a *.py search.
But I can't find any file with that name in the Github source file. Here is what is found with a *.py search.
Re: Custom Build using PlatformIO?
For ESP8266/ESP8285 you can edit pre_custom_esp82xx.py and for ESP32 you can edit pre_custom_esp32.py
Alternative is you copy Custom-sample.h to Custom.h (in the same foulder you find Custom-sample.h), and un-comment all the options and plugins you want, set your local WiFi credentials so it will connect automatically, etc.
OT: To me, the advantage of editing these .py files is that your build will be as close to the prebuilt 'custom' builds, with the plugins you select added. You will have to pay attention when updating your sources though (using 'git pull upstream mega', assuming you have added the ESPEasy repo as 'upstream' from your fork).
Alternative is you copy Custom-sample.h to Custom.h (in the same foulder you find Custom-sample.h), and un-comment all the options and plugins you want, set your local WiFi credentials so it will connect automatically, etc.
OT: To me, the advantage of editing these .py files is that your build will be as close to the prebuilt 'custom' builds, with the plugins you select added. You will have to pay attention when updating your sources though (using 'git pull upstream mega', assuming you have added the ESPEasy repo as 'upstream' from your fork).
/Ton (PayPal.me)
Re: Custom Build using PlatformIO?
Then you probably have not installed PlatformIO in your VS code.
It is under the "extensions" in VS code.
Installation of PlatformIO does take a while and needs a restart of VS code.
See also: https://www.youtube.com/watch?v=ArqwMcYSMsU
It is under the "extensions" in VS code.
Installation of PlatformIO does take a while and needs a restart of VS code.
See also: https://www.youtube.com/watch?v=ArqwMcYSMsU
Re: Custom Build using PlatformIO?
I successfully flashed the build_output\bin\ESP_Easy_mega_20210420_custom_ESP8266_4M1M.bin
And was able to get on the AP and configure my WiFi.
And was able to get on the AP and configure my WiFi.
Should I be able to configure my WiFi and set options and plugins via the pre_custom_esp82xx.py?For ESP8266/ESP8285 you can edit pre_custom_esp82xx.py and for ESP32 you can edit pre_custom_esp32.py
Alternative is you copy Custom-sample.h to Custom.h (in the same foulder you find Custom-sample.h), and un-comment all the options and plugins you want, set your local WiFi credentials so it will connect automatically, etc.
Re: Custom Build using PlatformIO?
If you want such specific settings, you may want to have a look at the Custom-sample.h and rename it to Custom.h.
The build process detects whether this file exists and will use it for "Custom" builds made in PlatformIO.
Setting string-like configuration like passwords is a bit tricky in a Python config file, so for that it is better to use the Custom.h route.
You may also keep a copy of Custom.h somewhere for yourself to make it easier to create your own builds.
The file will never be overwritten by Git checkouts, but just to be sure it is best to keep a copy somewhere else too as you will probably use that file a lot
The build process detects whether this file exists and will use it for "Custom" builds made in PlatformIO.
Setting string-like configuration like passwords is a bit tricky in a Python config file, so for that it is better to use the Custom.h route.
You may also keep a copy of Custom.h somewhere for yourself to make it easier to create your own builds.
The file will never be overwritten by Git checkouts, but just to be sure it is best to keep a copy somewhere else too as you will probably use that file a lot

Re: Custom Build using PlatformIO?
Here is my extensions in VS. If I click the extension it gives me the option to Uninstall. I did follow along with the youtube video provided.TD-er wrote: ↑20 Apr 2021, 15:12 Then you probably have not installed PlatformIO in your VS code.
It is under the "extensions" in VS code.
Installation of PlatformIO does take a while and needs a restart of VS code.
See also: https://www.youtube.com/watch?v=ArqwMcYSMsU
Re: Custom Build using PlatformIO?
Okay now I feel like I'm getting somewhere.

Thanks for this information TD-er
Re: Custom Build using PlatformIO?
The Python extension is disabled on my setup, so I guess I have done that with a reason...
Re: Custom Build using PlatformIO?
Good to know I have now disabled Python in my setup also.
Thanks again for all your help.
I copied and saved Custom-sample.h as Custom.h
I configured the Custom.h file with my network settings and enabled some of the Controllers
After uploading using PlatformIO none of my settings have taken.
The terminal shows the custom_ESP8266_4M1M was a success
I'm not using any ESP32 devices so if I can get it to quit trying to use that it would be great.Thanks again for all your help.
Re: Custom Build using PlatformIO?
You should best build (or upload) from the PlatformIO menu:
/Ton (PayPal.me)
Re: Custom Build using PlatformIO?
Got ya. I used the Upload under project tasks but the device still booted back up into AP and didn't have my Wifi settings.
After I connect to my Wifi using a tablet it will then connect to my network but doesn't have any of the other settings I configured like NTP and MQTT.
After I connect to my Wifi using a tablet it will then connect to my network but doesn't have any of the other settings I configured like NTP and MQTT.
Re: Custom Build using PlatformIO?
I wonder what you mean by the settings not being used...
If you refer to those "DEFAULT_..." defines, those are only used when creating a new instance of whatever they refer to.
So you may need to perform a "factory default" (See tools page) to create a new settings file where all your DEFAULT_xxx defines are being used.
You may first want to check you actually have uploaded the latest build (see Tools->Sysinfo page, the build time)
When you just recompile only a few changed files, you may want to do a "clean" build first in PlatformIO (option is shown on Ath's screenshot) and then perform a new build or else the _BUILD_TIME_ may not be reflecting the actual build time.
I find uploading via PIO quite simple to do as you then have feedback whether an update was successful, which may not always be clear when doing an OTA update.
If you refer to those "DEFAULT_..." defines, those are only used when creating a new instance of whatever they refer to.
So you may need to perform a "factory default" (See tools page) to create a new settings file where all your DEFAULT_xxx defines are being used.
You may first want to check you actually have uploaded the latest build (see Tools->Sysinfo page, the build time)
When you just recompile only a few changed files, you may want to do a "clean" build first in PlatformIO (option is shown on Ath's screenshot) and then perform a new build or else the _BUILD_TIME_ may not be reflecting the actual build time.
I find uploading via PIO quite simple to do as you then have feedback whether an update was successful, which may not always be clear when doing an OTA update.
Re: Custom Build using PlatformIO?
Yes that's what I was meaning.
I did a Erase Flash then uploaded it and it did pickup the defaults.
Thanks again for all the patience you've shown me.
Re: Custom Build using PlatformIO?
If I'm understanding correctly, if I reset the unit to factory defaults anything that was configured in my initial upload of my Custom.h should be restored?
Is that correct?
Or do I need to do something more to save a Pre-defined config?
Is that correct?
Or do I need to do something more to save a Pre-defined config?
Re: Custom Build using PlatformIO?
I would also like to set the I2C Interface to None in my Custom.h can that be done by commenting out those lines?
Re: Custom Build using PlatformIO?
If you change both values to (-1) they will show as None in the UI (and I2C will be technically disabled).
Edit: Checkout the value for DEFAULT_PIN_STATUS_LED, a few lines lower.
Edit: Checkout the value for DEFAULT_PIN_STATUS_LED, a few lines lower.
/Ton (PayPal.me)
Who is online
Users browsing this forum: Bing [Bot] and 12 guests