md
ESP8266/Arduino Core version 2.4.2 and WPS
September 3, 2018
Update: November 2, 2018
<-Installation de Ubuntu 18.04.1, ajouts et additions --

Setting up the Arduino EDI with support for ESP8266/Arduino cards was one of the subjects of a previous post. I mentioned there that the version of the ESP core was now 2.4.2 whereas previously I was using version 2.4.1.

A cursory review indicates that my three Arduino libraries for ESP8266, mdBlinky, mdButton et mdEspRestart/mdEspRestartSF, are working properly in the new environment. It will be a relief for their many users! In all, there were 11, 11 and 14 downloads respectively. These figures overestimate their importance, because I downloaded them when verifying the links.

The transition to version 2.4.2 was not smooth, because one of my sketches, which is not yet public, can not be compiled. Here is the error message that the IDE displays.

/tmp/arduino_build_259410/sketch/routermon.ino.cpp.o: In function `monitorModule()': /home/michel/ED/arduino-1.8.6/portable/sketchbook/md/routermon/webserver.ino:481: undefined reference to `WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool' /tmp/arduino_build_259410/sketch/routermon.ino.cpp.o: In function `connectWiFiWithWps()': /home/michel/ED/arduino-1.8.6/portable/sketchbook/md/routermon/webserver.ino:481: undefined reference to `WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool' collect2: error: ld returned 1 exit status

A quick reminder: WPS, Wi-Fi Protected Setup, is a way to establish a Wi-Fi connection between a router and a device by pressing a button (real or virtual) on each of these devices. In my sketch, running on a Sonoff switch, I have to press its push button three times in quick succession and the WPS button on the router for the Sonoff to connect it to my home Wi-Fi network. It is not necessary to program the network name and password in the sketch.

A search on Google with the criterion "WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool" brought me to the Arduino WiFiManager forum: WiFiManager is causing compile problems Aug 06, 2018. The suggestion from user pert was to update the library. The most recent version of the library was already installed. Even after reinstalling version 0.14.0, the problem was not eliminated.

After more digging, I found the relevant information in the FAQ of version 2.4.2 of the ESP8266/Arduino core, that I should have read before. The ESP8266 board definition file, boards.txt has to be rebuilt because by default, WPS is no longer available in the new core. Since I have a portable EDI installation that is in the directory /home/michel/ED here is how I proceeded.

michel@hp:~/ED/arduino-1.8.6/portable/packages/esp8266/hardware/esp8266/2.4.2$ cp boards.txt boards.txt.bak michel@hp:~/ED/arduino-1.8.6/portable/packages/esp8266/hardware/esp8266/2.4.2$ python ./tools/boards.txt.py --allowWPS --boardsgen michel@hp:~/ED/arduino-1.8.6/portable/packages/esp8266/hardware/esp8266/2.4.2$

A reader from Italy, Claudio Barca, who uses Windows 10, kindly provided the command to use in that operating system:
C:\Users\Claudio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2>python tools/boards.txt.py --allowWPS --boardsgen
Do not forget to make a backup of the boards.txt file before generating a new a version.

Thank you Claudio for this additonal information. I really should be more considerate of Windows users, who consitute the majority of my readers. However, it has been so long since I have used Windows on a regular basis, that I now feel awkward when using it, and for some reason, it feels very slow, perhaps because of numerous updates being done in the background.

November 2, 2018

Note that version 2.7 of python must be used to generate the file boards.txt. This version is no longer installed by default in Ubunut 18.04. So you have to install it. I think it should be simple.

michel@hp:~$ sudo apt-get install python

I cannot confirm that this is how to do it because Python 2.7.15rc1 was available on my system. It was included when installing some other application whose name I cannot recall.

If version 2.7.15 of Python is not installed on your system and you do not want it, then here is my modified boards.txt file. This file contains an additional directive at the end of each board definition board.build.noextra4kheap=-DNO_EXTRA_4K_HEAP such as nodemcuv2.build.noextra4kheap=-DNO_EXTRA_4K_HEAP. It is very important to save the original file as shown above, because with time and inevitable changes to the ESP8266/Arduino core, the file that I am making available will become obsolete.

If you have not opted for a portable installation of the Arduino EDI, the directory containing the definition of ESP8266 cards will be different. It seems to me that it would be something like /home/user/.arduino15/packages/esp8266... alias ~/.arduino15/packages/esp8266...

According to the FAQ, support for Wi-Fi connections by WPS will be incorporated again in future versions of the ESP8266/Arduino core. So, in the future, it will no longer be necessary to generate a modified boards.txt file.

<-Installation de Ubuntu 18.04.1, ajouts et additions --