ESPEasy custom build - values not overwritten

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

ESPEasy custom build - values not overwritten

#1 Post by lemon » 06 Oct 2022, 13:52

Hello everybody,

today I'm making my first experiences with custom building, followed the instructions and modified the Custom.h file, first build was perfect (set DEFAULT_NAME). But any other build I use on my Wemos D1 Mini does not overwrite existing values and neither write new ones.

This was first build:

Code: Select all

#undef DEFAULT_NAME
#define DEFAULT_NAME "test" 
I tried the following in my second build:

Code: Select all

#undef DEFAULT_NAME
#define DEFAULT_NAME "testX" 
#undef DEFAULT_USE_NTP
#define DEFAULT_USE_NTP true
After uploading nothing has changed, name is still "Test" and "use NTP" option is not active.

Did I miss something?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy custom build - values not overwritten

#2 Post by Ath » 06 Oct 2022, 15:02

That type of setting is only applied on factory reset, or install on a new unit. Gladly it doesn't update the existing settings :o, there are other means for that, like restoring a previously saved config file.
/Ton (PayPal.me)

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#3 Post by lemon » 06 Oct 2022, 16:09

Oh, didn't know that, thank for the info.
Se when I save a settings file from a configured Arduino and load it to a new one there settings should be identical, right? Tried it now, unfortunately some options as MQTT server address have not been imported, is there a reason for that? NTP server address is ok. Strange thing. :o

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#4 Post by lemon » 06 Oct 2022, 17:05

Ath wrote: 06 Oct 2022, 15:02 That type of setting is only applied on factory reset, or install on a new unit. Gladly it doesn't update the existing settings :o, there are other means for that, like restoring a previously saved config file.
Ok, tried to upload the build and then did a factory reset, the ESP8266 should use the default settings I set then, right? Well, it's not, it's activating the AP insted of using the WIFI settings I've set as default. :?:

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy custom build - values not overwritten

#5 Post by Ath » 06 Oct 2022, 17:31

lemon wrote: 06 Oct 2022, 17:05 it's activating the AP insted of using the WIFI settings I've set as default. :?:
That's the 1 exception (AFAIK), it uses the previous AP settings as it is stored somewhere 'hidden' by the closed-source WiFi code in Arduino framework.

You can wipe the using completely by flashing a blank.bin (of the matching size for your flash), as available in the Bin folder of a release you can download from Github.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#6 Post by TD-er » 06 Oct 2022, 17:39

The "secrets" like account info, WiFi credentials etc. are stored in a separate file "security.dat"
The rest is stored in "config.dat"
This is done to make sure users posting their settings file for help don't accidentally share "secrets" too.

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#7 Post by lemon » 06 Oct 2022, 18:22

Ath wrote: 06 Oct 2022, 17:31
lemon wrote: 06 Oct 2022, 17:05 it's activating the AP insted of using the WIFI settings I've set as default. :?:
That's the 1 exception (AFAIK), it uses the previous AP settings as it is stored somewhere 'hidden' by the closed-source WiFi code in Arduino framework.

You can wipe the using completely by flashing a blank.bin (of the matching size for your flash), as available in the Bin folder of a release you can download from Github.
Ok, flashed the blank.bin and afterwards my custom build. After restart WIFI credentials were fine, other things like Controller settings were not (p.e. controller type was set, controller IP not).

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#8 Post by TD-er » 06 Oct 2022, 19:05

Example of what to set in the Custom.h for the first controller when loading factory defaults:

Code: Select all

#define DEFAULT_PUB         "%sysname%/%tskname%/%valname%" // Enter your pub
#define DEFAULT_SUB         "%sysname%/#"                   // Enter your sub
#define DEFAULT_SERVER      "1.2.3.4"                                      // Enter your Server IP address
#define DEFAULT_SERVER_HOST "mqttbroker.local"                             // Server hostname
#define DEFAULT_SERVER_USEDNS true                                         // true: Use hostname.  false: use IP
#define DEFAULT_USE_EXTD_CONTROLLER_CREDENTIALS   true                     // true: Allow longer user credentials for controllers
#define CONTROLLER_DEFAULT_CLIENTID "%sysname%_%mac_int%"

#define DEFAULT_PORT        1883                                           // Enter your Server port value

#define DEFAULT_PROTOCOL    5                                              // C005 = Home Assistant (openHAB) MQTT
N.B. with DEFAULT_SERVER_USEDNS set to true, you could theoretically leave the DEFAULT_SERVER empty, but better to set it with the actual IP for that controller (if known)
If you only can access it via IP, you must set DEFAULT_SERVER_USEDNS to false

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#9 Post by lemon » 07 Oct 2022, 10:30

Ok, let me tell you more detailed what I've done.
I'm using a Wemos D1 Mini which usually will be flashed with 4M1M version of ESPEasy.
I've configured VSCode according to this tutorial: https://espeasy.readthedocs.io/en/lates ... g-custom-h

I've created the Custom.h and edited the following lines:

Code: Select all

#undef DEFAULT_SSID
#define DEFAULT_SSID                         "mySSID"        // Enter your network SSID
#undef DEFAULT_KEY
#define DEFAULT_KEY                          "myPassword"  // Enter your network WPA key
#define DEFAULT_CONTROLLER_ENABLED true                                     // Enable default controller by default
#define DEFAULT_CONTROLLER_USER    "openhabian"                             // Default controller user
#define DEFAULT_CONTROLLER_PASS    "password"                              // Default controller Password
#undef DEFAULT_PUB
#define DEFAULT_PUB         "%sysname%/%tskname%/%valname%"                 // Enter your pub
#undef DEFAULT_SUB
#define DEFAULT_SUB         "%sysname%/#"                                   // Enter your sub
#undef DEFAULT_SERVER
#define DEFAULT_SERVER      "100.1.18.59"                                   // Enter your Server IP address
#undef DEFAULT_SERVER_USEDNS
#define DEFAULT_SERVER_USEDNS false                                         // true: Use hostname.  false: use IP
#define DEFAULT_USE_EXTD_CONTROLLER_CREDENTIALS   false                     // true: Allow longer user credentials for controllers
#undef DEFAULT_PORT
#define DEFAULT_PORT        1883                                            // Enter your Server port value
#define DEFAULT_PROTOCOL    5                                               // Protocol used for controller communications
#undef DEFAULT_USE_NTP
#define DEFAULT_USE_NTP                         true               // (true|false) Use NTP Server
#undef DEFAULT_NTP_HOST
#define DEFAULT_NTP_HOST                        "ourntpserver.com" // NTP Server Hostname
#define DEFAULT_TIME_ZONE                       120                // Time Offset (in minutes)
Then I've added this to platformio.ini (although it's not necessary as I found out, the Custom.h has to exist and that's enough):
[build_flags = -DUSE_CUSTOM_H
During building VSCode correctly says that Custom.h exists and will be used:
C:/Users/myuser/Downloads/ESPEasy-mega/ESPEasy-mega/src/ESPEasy.ino:18:5: warning: #warning "**** Using Settings from Custom.h File ***" [-Wcpp]
# warning "**** Using Settings from Custom.h File ***"
^
I've selected the environment custom_ESP8266_4M1M in Platformio and selected it also as project environment (at the bottom of the VSCode window).
Then I clicked on "Build" in the environments menu. After uploading it there's still the old WIFI credentials in flash memory, so I make a hardware reset on the Wemos D1 mini and restart it, afterwards WIFI credentials are set to the default ones and the Wemos gets connected.
Anyway, the other settings are not complete, p.e. the conteroller is set to 5 (MQTT OpenHab) but the controller's port is set to "1" instead of "1883" and so on. I really do not find out why not every setting is being set.
When I try to load the settings from another Wemos D1 mini which is configured already I have the same problem, some settings won't be updated correctly.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#10 Post by TD-er » 07 Oct 2022, 10:39

I find it strange you need to undef first. (or even can get it to compile)
What else is in your Custom.h?

Also what code revision do you use? Where did you get it from?
I assume just the latest "mega" branch code from Github by either cloning it via Git, or download the ZIP from Github (not the zip with the release binaries)

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#11 Post by lemon » 07 Oct 2022, 10:52

Custom.h:
Don't forget to first #undef each existing #define that you add below.
But there's also written this:

Code: Select all

 3) define USE_CUSTOM_H as a build flags. ie : export PLATFORMIO_BUILD_FLAGS="'-DUSE_CUSTOM_H'"
And this is not necessary for sure, so maybe also the first indications are wrong.

I let the Custom.h as it was and just changed the values I needed, maybe that's the error? Should I just put the settings I want?

I cloned the source by downloading the ZIP file from github, yes.

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#12 Post by lemon » 07 Oct 2022, 11:36

Tried with a smaller Custom.h now:

Code: Select all

#ifndef ESPEASY_CUSTOM_H
#define ESPEASY_CUSTOM_H

/*
    To modify the stock configuration without changing the EspEasy.ino file :
    1) rename this file to "Custom.h" (It is ignored by Git)
    2) define your own settings below
    3) define USE_CUSTOM_H as a build flags. ie : export PLATFORMIO_BUILD_FLAGS="'-DUSE_CUSTOM_H'"
 */


/*
 #######################################################################################################
   Your Own Default Settings
 #######################################################################################################
    You can basically ovveride ALL macro defined in ESPEasy.ino.
    Don't forget to first #undef each existing #define that you add below.
    But since this Custom.h is included before other defines are made, you don't have to undef a lot of defines.
    Here are some examples:
 */

// --- Feature Flagging ---------------------------------------------------------
// Can be set to 1 to enable, 0 to disable, or not set to use the default (usually via define_plugin_sets.h)

#define FEATURE_ESPEASY_P2P       1 // (1/0) enables the ESP Easy P2P protocol
#define FEATURE_ARDUINO_OTA       1 // enables the Arduino OTA capabilities
// #define FEATURE_SD                1     // Enable SD card support
// #define FEATURE_DOWNLOAD          1     // Enable downloading a file from an url

#ifdef BUILD_GIT
# undef BUILD_GIT
#endif // ifdef BUILD_GIT

#define BUILD_GIT           "My Build: "  __DATE__ " "  __TIME__


#undef DEFAULT_NAME
#define DEFAULT_NAME        "mydefaultname" // Enter your device friendly name


// --- Wifi Client Mode -----------------------------------------------------------------------------
#undef DEFAULT_SSID
#define DEFAULT_SSID                         "mywifi"        // Enter your network SSID
#undef DEFAULT_KEY
#define DEFAULT_KEY                          "mypassword"  // Enter your network WPA key
#define DEFAULT_SSID2                        ""                // Enter your fallback network SSID
#define DEFAULT_IP_BLOCK_LEVEL               0                 // 0: ALL_ALLOWED  1: LOCAL_SUBNET_ALLOWED  2:

#undef DEFAULT_CONTROLLER_ENABLED
#define DEFAULT_CONTROLLER_ENABLED true                                     // Enable default controller by default
#undef DEFAULT_CONTROLLER_USER
#define DEFAULT_CONTROLLER_USER    "openhabian"                             // Default controller user
#undef DEFAULT_CONTROLLER_PASS
#define DEFAULT_CONTROLLER_PASS    "mypassword"                              // Default controller Password

// using a default template, you also need to set a DEFAULT PROTOCOL to a suitable MQTT protocol !
#undef DEFAULT_PUB
#define DEFAULT_PUB         "%sysname%/%tskname%/%valname%"                 // Enter your pub
#undef DEFAULT_SUB
#define DEFAULT_SUB         "%sysname%/#"                                   // Enter your sub
#undef DEFAULT_SERVER
#define DEFAULT_SERVER      "192.168.0.50"                                   // Enter your Server IP address
#define DEFAULT_SERVER_HOST ""                                              // Server hostname
#undef DEFAULT_SERVER_USEDNS
#define DEFAULT_SERVER_USEDNS false                                         // true: Use hostname.  false: use IP

#undef DEFAULT_PORT
#define DEFAULT_PORT        1883                                            // Enter your Server port value

#define DEFAULT_PROTOCOL    5                                               // Protocol used for controller communications
                                                                            //   0 = Stand-alone (no controller set)
                                                                            //   1 = Domoticz HTTP
                                                                            //   2 = Domoticz MQTT
                                                                            //   3 = Nodo Telnet
                                                                            //   4 = ThingSpeak
                                                                            //   5 = Home Assistant (openHAB) MQTT
                                                                            //   6 = PiDome MQTT
                                                                            //   7 = EmonCMS
                                                                            //   8 = Generic HTTP
                                                                            //   9 = FHEM HTTP


#undef DEFAULT_USE_NTP
#define DEFAULT_USE_NTP                         true               // (true|false) Use NTP Server
#undef DEFAULT_NTP_HOST
#define DEFAULT_NTP_HOST                        "ntp.zid.gvcc.net" // NTP Server Hostname
#define DEFAULT_TIME_ZONE                       120                // Time Offset (in minutes)


#define MENU_INDEX_MAIN_VISIBLE          true

/*
 #define MENU_INDEX_CONFIG_VISIBLE        false
 #define MENU_INDEX_CONTROLLERS_VISIBLE   false
 #define MENU_INDEX_HARDWARE_VISIBLE      false
 #define MENU_INDEX_DEVICES_VISIBLE
 #define MENU_INDEX_DEVICES_VISIBLE       true
 #define MENU_INDEX_RULES_VISIBLE         false
 #define MENU_INDEX_NOTIFICATIONS_VISIBLE false
 #define MENU_INDEX_TOOLS_VISIBLE         false
 */

#define MAIN_PAGE_SHOW_SYSINFO_BUTTON    true
#define MAIN_PAGE_SHOW_WiFi_SETUP_BUTTON true
#define MAIN_PAGE_SHOW_BASIC_INFO_NOT_LOGGED_IN false

#define MAIN_PAGE_SHOW_NODE_LIST_BUILD   true
#define MAIN_PAGE_SHOW_NODE_LIST_TYPE    true

#define SETUP_PAGE_SHOW_CONFIG_BUTTON    true

// #define FEATURE_AUTO_DARK_MODE           0 // Disable auto-dark mode

// #define WEBPAGE_TEMPLATE_HIDE_HELP_BUTTON


 #define USES_P004 // Dallas
#define USES_P005  // DHT

#define USES_C005 // Home Assistant (openHAB) MQTT


#endif // ESPEASY_CUSTOM_H
After building it I flashed the blank_4MB first and then my custom build. The Wemos afterwards starts an AP named "mydefaultname" as set in Custom.h. Why does it not use the WIFI credentials from Custom.h as well?


This is the serial monitor's output after flashing:
INIT : Booting version: ESP_Easy_mega_20221007_custom_ESP8266_4M1M, (Self built) My Build: Oct 7 2022 11:02:39 (ESP82xx Core ffffffff, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support)
199 : Info : INIT : Free RAM:30456
201 : Info : INIT : Manual Reboot #29 Last Action before Reboot: Const Interval: TIMER_100MSEC Last systime: 164 - Restart Reason: External System
202 : Info : FS : Mounting...
227 : Info : FS : Mount successful, used 71284 bytes of 957314
248 : Info : CRC : SecuritySettings CRC ...OK
251 : Info : INIT : I2C
253 : Info : INIT : SPI not enabled
265 : Info : Time set to 164.000 Time adjusted by 163736.00 msec. Wander: 0.000 msec/second Source: RTC at boot
268 : Info : Current Time Zone: STD time start: 1970-10-25 03:00:00 offset: 120 min
270 : Info : Local time: 1970-01-01 02:02:44
282 : Info : WiFi : Start network scan all channels
296 : Info : INIT : Free RAM:28064
319 : Info : INFO : Plugins: 2 (ESP82xx Core ffffffff, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support)
323 : Info : Webserver: start
325 : Info : OTA : Arduino OTA enabled on port 18266
1679 : Info : WD : Uptime 0 ConnectFailures 0 FreeMem 23632 WiFiStatus WL_IDLE_STATUS 0 ESPeasy internal wifi status: DISCONNECTED
2495 : Info : WiFi : Scan finished, found: 1
2497 : Info : WiFi : Best AP candidate: mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK
2498 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #0
2504 : Info : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
5013 : Info : WIFI : Disconnected! Reason: '(2) Auth expire' Connected for 2412 ms
5025 : Error : WiFi : Scan not allowed, unprocessed WiFi events: disconn
5125 : Info : WIFI : Set WiFi to OFF
5342 : Info : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
5344 : Info : WiFi : Best AP candidate: mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK
5345 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #1
5450 : Info : WIFI : Set WiFi to STA
10677 : Info : WIFI : Disconnected! Reason: '(15) 4way handshake timeout' Connected for 5226 ms
10689 : Error : WiFi : Scan not allowed, unprocessed WiFi events: disconn
10790 : Info : WIFI : Set WiFi to OFF
11005 : Info : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
11007 : Info : WiFi : Best AP candidate: mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK
11008 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #2
11113 : Info : WIFI : Set WiFi to STA
13519 : Info : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2406 ms
13532 : Error : WiFi : Scan not allowed, unprocessed WiFi events: disconn
13632 : Info : WIFI : Set WiFi to OFF
13847 : Info : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
13849 : Info : WiFi : Best AP candidate: mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK
13850 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #3
13955 : Info : WIFI : Set WiFi to STA
16361 : Info : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2405 ms
16374 : Error : WiFi : Scan not allowed, unprocessed WiFi events: disconn
16474 : Info : WIFI : Set WiFi to OFF
16689 : Info : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
16691 : Info : WiFi : Best AP candidate: mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK
16692 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #4
16797 : Info : WIFI : Set WiFi to STA
19415 : Info : WIFI : Disconnected! Reason: '(2) Auth expire' Connected for 2619 ms
19427 : Error : WiFi : Scan not allowed, unprocessed WiFi events: disconn
19528 : Info : WIFI : Set WiFi to OFF
19743 : Info : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
19745 : Info : WiFi : Best AP candidate: mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK
19746 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #5
19850 : Info : WIFI : Set WiFi to STA
20366 : Info : WIFI : Set WiFi to AP+STA
21357 : Info : WIFI : AP Mode ssid will be mydefaultnamewith address 192.168.4.1
Last edited by lemon on 07 Oct 2022, 11:41, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#13 Post by TD-er » 07 Oct 2022, 11:40

Ah that's an old comment that should not be there anymore.
Or at least it should be made a bit more specific to only undef those defines you make which the compiler may compain about being redefined.

But I made sure to include the Custom.h file first and then all other .h files which may define things already defined in the Custom.h file. There each define is checked first to see it doesn't change user defined values.

About the USE_CUSTOM_H
That's not needed anymore when using PlatformIO.
When building using PlatformIO, I have made 2 Python scripts (ESPEasy/tools/pio/pre_custom_esp8266.py and one for esp32) which do check for the presence of such Custom.h file.
When found, the defines are appended with this define.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#14 Post by TD-er » 07 Oct 2022, 11:43

When facing such issues, it is often best to perform a "Clean all" from the PlatformIO build tasks menu on the left.

Also make sure to close any open terminal if you used "Upload and monitor" as it might (re)start the wrong one.
This PlatformIO bug has bitten me extremely often (multiple times a day)

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#15 Post by lemon » 07 Oct 2022, 11:57

Ok, next try.

First i erased flash with "esptool.py erase_flash", then I performed a "Clean all" in PlatformIO. The next step was "Upload and Monitor" which ended with this error:
Compiling .pio\build\custom_ESP8266_4M1M\src\_C006.cpp.o
Compiling .pio\build\custom_ESP8266_4M1M\src\_C007.cpp.o
xtensa-lx106-elf-g++: error: src\ESPEasy.ino.cpp: No such file or directory
xtensa-lx106-elf-g++: fatal error: no input files
compilation terminated.
*** [.pio\build\custom_ESP8266_4M1M\src\ESPEasy.ino.cpp.o] Error 1
================================================================================================= [FAILED] Took 186.84 seconds =================================================================================================

Environment Status Duration
------------------- -------- ------------
custom_ESP8266_4M1M FAILED 00:03:06.845
============================================================================================= 1 failed, 0 succeeded in 00:03:06.845 =============================================================================================
2nd try with "Upload and Monitor" ended successfully. :o

Reboot anyway ended with a bootloop:
INIT : Booting version: ESP_Easy_mega_20221007_custom_ESP8266_4M1M, (Self built) My Build: Oct 7 2022 11:52:14 (ESP82xx Core ffffffff, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support)
300 : Info : INIT : Free RAM:30456
302 : Info : INIT : Exception #44 Last Action before Reboot: Const Interval: TIMER_20MSEC Last systime: 482 - Restart Reason: Exception
303 : Info : FS : Mounting...
328 : Info : FS : Mount successful, used 0 bytes of 957314
RESET: Resetting factory defaults... using default settings
RESET: Warm boot, reset count: 3
RESET: Too many resets, protecting your flash memory (powercycle to solve this)
1369 : Error : FS : Error while reading/writing config.dat in 7573
1397 : Error : FS : Error while reading/writing security.dat in 7573
1399 : Error : CRC : SecuritySettings CRC ...FAIL
1400 : Error : FS : Error while reading/writing security.dat in 7573
1402 : Info : INIT : I2C
1404 : Info : INIT : SPI not enabled
1406 : Info : Time set to 482.000 Time adjusted by 480595.00 msec. Wander: 0.000 msec/second Source: RTC at boot
1408 : Info : Current Time Zone: STD time start: 1970-10-25 03:00:00 offset: 0 min
1410 : Info : Local time: 1970-01-01 00:08:02
1413 : Info : WiFi : Start network scan all channels
3601 : Info : WiFi : Scan finished, found: 3
3605 : Error : WIFI : No valid wifi settings
3707 : Info : WIFI : Set WiFi to AP+STA
3817 : Info : WIFI : AP Mode ssid will be ESPEasy- with address 192.168.4.1
3819 : Info : WIFI : Arduino wifi status: WL_IDLE_STATUS 0 ESPeasy internal wifi status: DISCONNECTED
3821 : Info : WiFi : Start network scan all channels

PID:0
Versio
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (0):
epc1=0x4000e25d epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

Illegal instruction

>>>stack>>>

ctx: cont
sp: 3fff2750 end: 3fff29f0 offset: 0190
3fff28e0: 3fff080a 3fff08a4 3fff08c4 3fff1550
3fff28f0: 4025a446 00000000 3fff527c 4025a54d
3fff2900: 0000001c 00000000 00000000 00000000
3fff2910: 00000003 00000000 3fff463c 4025a782
3fff2920: 3fff18ac 00000001 3fff18ac 3fff1550
3fff2930: 00000000 00000001 3fff18ac 402548c8
3fff2940: 00000000 3fff18ac 0000000a 4025a2e6
3fff2950: 00000000 0000001c 00000000 40254840
3fff2960: 3fff18ac 3ffeff80 00000000 40229c08
3fff2970: 3fff1408 3fff08a4 3ffeff80 4022999c
3fff2980: 65630000 6f697470 80ef006e 00323800
3fff2990: 00000000 80feff58 feefeffe feefeffe
3fff29a0: 00000000 feefeffe feefeffe feefeffe
3fff29b0: feefeffe feefeffe feefeffe 3fff2a3c
3fff29c0: 3fffdad0 00000000 3fff29f8 40216880
3fff29d0: feefeffe feefeffe feefeffe 4025775c
3fff29e0: feefeffe feefeffe 3ffe8660 40100309
<<<stack<<<

0x4025a446 in uart_init at ??:?
0x4025a54d in uart_init at ??:?
0x4025a782 in uart_uninit at ??:?
0x402548c8 in HardwareSerial::begin(unsigned long, SerialConfig, SerialMode, unsigned char, bool) at ??:?
0x4025a2e6 in uart_wait_tx_empty at ??:?
0x40254840 in HardwareSerial::flush() at ??:?
0x40229c08 in initSerial() at ??:?
0x4022999c in ESPEasy_setup() at ??:?
0x40216880 in setup at ??:?
0x4025775c in loop_wrapper() at core_esp8266_main.cpp:?
0x40100309 in cont_wrapper at ??:?


--------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
vffffffff
~ld
�U195 : Info : WIFI : Set WiFi to OFF
313 : Info :

INIT : Booting version: ESP_Easy_mega_20221007_custom_ESP8266_4M1M, (Self built) My Build: Oct 7 2022 11:52:14 (ESP82xx Core ffffffff, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support)
314 : Info : INIT : Free RAM:30456
316 : Info : INIT : Exception #45 Last Action before Reboot: Const Interval: TIMER_20MSEC Last systime: 482 - Restart Reason: Exception
317 : Info : FS : Mounting...
342 : Info : FS : Mount successful, used 0 bytes of 957314
RESET: Resetting factory defaults... using default settings
RESET: Warm boot, reset count: 3
RESET: Too many resets, protecting your flash memory (powercycle to solve this)
1384 : Error : FS : Error while reading/writing config.dat in 7573
1411 : Error : FS : Error while reading/writing security.dat in 7573
1413 : Error : CRC : SecuritySettings CRC ...FAIL
1415 : Error : FS : Error while reading/writing security.dat in 7573
Can't believe it, wanted to save time with my 50 Wemos D1 Mini to install and now I'm stuck for a day with this problem(s) with the custom build :cry:

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#16 Post by TD-er » 07 Oct 2022, 12:07

OK, you may have tried too much today... or at least without power cycling the unit.

See this log line:
RESET: Too many resets, protecting your flash memory (powercycle to solve this)

So I guess the ESP was not writing newly updated settings to the settings file anymore as you already had 100 flash writes since the last power cycle.

I do keep this counter in RTC memory, which does survive a reboot and flash, as long as it remains powered.

So please power cycle it and perform a factory reset (or just your last flash run) as I guess this may have been the cause for lots of problems and failed attempts in this process.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#17 Post by TD-er » 07 Oct 2022, 12:27

By the way, can you make notes of things you came across when building?
This way we can improve the documentation so others may not need to suffer making the same wrong turns...

Problem is, I cannot do this as I will not be able to see "obvious" missing information in the docs.

So consider yourself one highly needed and appreciated "noob" :)

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#18 Post by lemon » 07 Oct 2022, 12:34

Ok, did what you said, powercycled the Wemos.
First I flashed again the blank_4M.bin file, then I flashed the build I made with VSCode.
Anyway, bootloop is resolved, but the Wemos creates still the AP instead of connecting to the WIFI I set in the Custom.h :-(

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#19 Post by lemon » 07 Oct 2022, 12:35

TD-er wrote: 07 Oct 2022, 12:27 By the way, can you make notes of things you came across when building?
This way we can improve the documentation so others may not need to suffer making the same wrong turns...

Problem is, I cannot do this as I will not be able to see "obvious" missing information in the docs.

So consider yourself one highly needed and appreciated "noob" :)
Sure, would be a honor for me, as long as I solved my problem I can send you the information you want. It's not that I do not want to send it before, but as long as my problem persists there will be still a part in the documentation missing.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy custom build - values not overwritten

#20 Post by Ath » 07 Oct 2022, 12:39

lemon wrote: 07 Oct 2022, 11:57 Ok, next try.

First i erased flash with "esptool.py erase_flash", then I performed a "Clean all" in PlatformIO. The next step was "Upload and Monitor" which ended with this error:
[..]
2nd try with "Upload and Monitor" ended successfully. :o
[..]
This is often caused either by PlatformIO itself, or the antivirus interfering with what PIO is doing at that moment. For any PIO issue, a retry is usually the solution, for AV, adding the project folder to the folder exclusion list should solve that (mostly).

To avoid errors during Upload and Monitor, I usually run a Build first, and once that succeeds (sometimes it needs a second try after a Clean All), the Upload and Monitor action (or just Upload if I'm sure I have the current PIO environment Monitor still active, then it will stop and restart Monitor correctly).
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#21 Post by TD-er » 07 Oct 2022, 12:41

OK, one more hurdle passed.

Can you also configure your SSID using these? (can only be used in "Custom" builds for obvious reasons)

Code: Select all

#define CUSTOM_DEPLOYMENT_SSID                  "myssid"     // Enter SSID not shown in UI, to be used on custom builds to ease deployment
#define CUSTOM_DEPLOYMENT_KEY                   "mywifipass"      // Enter key not shown in UI, to be used on custom builds to ease deployment
The reason this may work is that it isn't stored in the WiFi settings and I'm suspecting the security.dat file may not have been written when the monitoring kicks in and thus resets the ESP while it is creating the file system and default settings.

Also I am working on fixing some WiFi issues, so please also check if your AP might be set to "N only" and/or might have WiFi mesh enabled.

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#22 Post by lemon » 07 Oct 2022, 12:52

TD-er wrote: 07 Oct 2022, 12:41 OK, one more hurdle passed.

Can you also configure your SSID using these? (can only be used in "Custom" builds for obvious reasons)

Code: Select all

#define CUSTOM_DEPLOYMENT_SSID                  "myssid"     // Enter SSID not shown in UI, to be used on custom builds to ease deployment
#define CUSTOM_DEPLOYMENT_KEY                   "mywifipass"      // Enter key not shown in UI, to be used on custom builds to ease deployment
The reason this may work is that it isn't stored in the WiFi settings and I'm suspecting the security.dat file may not have been written when the monitoring kicks in and thus resets the ESP while it is creating the file system and default settings.

Also I am working on fixing some WiFi issues, so please also check if your AP might be set to "N only" and/or might have WiFi mesh enabled.
Ok, I'll try with these additional credentials. You must know that I already have a Wemos D1 mini configured that is correctly connected to this Wifi network and also to my MQTT broker, so the network is ok.

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#23 Post by lemon » 07 Oct 2022, 13:13

Ok, inserting these additional settings didn't change anything, Wemos is still creating the AP with the name I set in Custom.h as DEFAULT_NAME.
5345 : Info : WIFI : Connecting mywifi 02:92:BF:67:03:4E Ch:6 (-59dBm) WPA2/PSK attempt #1
5450 : Info : WIFI : Set WiFi to STA
10677 : Info : WIFI : Disconnected! Reason: '(15) 4way handshake timeout' Connected for 5226 ms
Very strange, seems to be a WIFI problem but it cannot :-(

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#24 Post by TD-er » 07 Oct 2022, 15:53

One advice on such WiFi issues: Reboot your access point or turn the wifi radio off and on if a reboot is too much (e.g. since it is your router)

And as I said, there is a PR which should also prevent such issues with WiFi reconnect as this new code does make sure the access point really knows the ESP is disconnected.

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#25 Post by lemon » 07 Oct 2022, 15:56

Tried on a different computer now (and different Wifi network), flashed again first the blank_4M.bin, then flashed a program that only reads existing Wifi credentials out (and it didn't find any). Afterwards I flashed the ESPEasy custom build and... still the AP waiting for me.
I'm so little before giving up, have to configure these 50 Wemos D1 Mini till monday, maybe it was not a good idea building a custom one :|

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#26 Post by TD-er » 07 Oct 2022, 16:09

Mail me your config, perhaps I can make one for you for testing.
If I need to change your Custom.h to make it work, you will get a revised version back of course :)

lemon
Normal user
Posts: 16
Joined: 05 Oct 2022, 11:47
Location: South tyrol

Re: ESPEasy custom build - values not overwritten

#27 Post by lemon » 07 Oct 2022, 16:10

What do you need precisely? The Custom.h only?
And can you send me a PN with your mail address?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESPEasy custom build - values not overwritten

#28 Post by TD-er » 07 Oct 2022, 17:34

Ah I did find a bug in the factory default code when setting SSID2.
Will fix that and send you a new build via DM.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 27 guests