Edgent issues: So many libraries and Speed

So I’m trying to speed up the onboarding process, currently, it seems to hang on the ESP32 configuration for up to 2-3 minutes. I’m aiming to get that down to 1:30 max if possible and I’m wondering if Edgent experts have some insights.

Also, I have a bug that came into my code that is messing up one of my sensors after adding Edgent but I’m not an expert coder, and debugging it has been brutal for me with so many libraries.

So questions:

  1. in the code below, is there a way I can keep Edgent focused while it configures my device. In my serial monitor, it seems like the code is running through a few times while configuring and I’d assume that is slowing it down. OR is 2-3 mintues just how it works.

  2. Are there simplified Edgent outlays out there or ways to eliminate several of the libraries that it references without destroying the very nice functionality?

Thank you!


void loop() {
  BlynkEdgent.run();
  
 if(Blynk.connected()){
  digitalWrite(pin_LED_GREEN,HIGH);
  delay(500);
  digitalWrite(pin_LED_GREEN,LOW);
FUNCTIONS ETC...
 } else  Serial.print("Trying to connect again... ");
delay(15000);

You shouldn’t be using blocking delays - you should be using BlynkTimer instead.
And, your void loop needs to be as clean as possible - you certainly shouldn’t be doing digitalWrites and calling functions in the void loop.
Read this…

That’s probably caused by the delays in your void loop.
I just provisioned a fresh ESP32 board and it took just under 36 seconds from power-on to finish…

07:07:59.609 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
07:07:59.609 -> configsip: 0, SPIWP:0xee
07:07:59.609 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
07:07:59.609 -> mode:DIO, clock div:1
07:07:59.609 -> load:0x3fff0030,len:1324
07:07:59.609 -> ho 0 tail 12 room 4
07:07:59.609 -> load:0x40078000,len:13508
07:07:59.609 -> load:0x40080400,len:3604
07:07:59.644 -> entry 0x400805f0
07:08:00.123 -> [213] Using default config.
07:08:00.123 -> [213] 
07:08:00.123 ->     ___  __          __
07:08:00.123 ->    / _ )/ /_ _____  / /__
07:08:00.123 ->   / _  / / // / _ \/  '_/
07:08:00.123 ->  /____/_/\_, /_//_/_/\_\
07:08:00.123 ->         /___/ v1.0.1 on ESP32
07:08:00.123 -> 
07:08:00.123 -> [223] --------------------------
07:08:00.123 -> [223] Product:  REDACTED
07:08:00.123 -> [223] Firmware: 0.1.0 (build Apr 29 2022 07:05:05)
07:08:00.157 -> [234] Device:   ESP32 @ 240MHz
07:08:00.157 -> [234] MAC:      7C:9E:BD:39:68:6C
07:08:00.157 -> [234] Flash:    4096K
07:08:00.157 -> [235] ESP sdk:  v4.4-beta1-189-ga79dc75f0a
07:08:00.157 -> [245] Chip rev: 1
07:08:00.157 -> [245] Free mem: 261284
07:08:00.157 -> [245] --------------------------
07:08:00.157 -> [245] INIT => WAIT_CONFIG
07:08:02.767 -> [2864] AP SSID: REDACTED
07:08:02.767 -> [2864] AP IP:   192.168.4.1
07:08:02.767 -> [2865] AP URL:  blynk.setup
07:08:02.767 -> 
07:08:02.767 -> >[14130] WAIT_CONFIG => CONFIGURING
07:08:27.590 -> [27689] Sending board info...
07:08:29.645 -> [29753] Applying configuration...
07:08:29.645 -> [29753] WiFi SSID: REDACTED Pass: REDACTED
07:08:29.679 -> [29753] Blynk cloud: REDACTED @ blynk.cloud:443
07:08:29.679 -> [29767] CONFIGURING => SWITCH_TO_STA
07:08:29.679 -> [29768] Switching to STA...
07:08:30.870 -> [30956] SWITCH_TO_STA => CONNECTING_NET
07:08:30.870 -> [30956] Connecting to WiFi: REDACTED
07:08:33.714 -> [33799] Using Dynamic IP: 192.168.1.42
07:08:33.714 -> [33799] CONNECTING_NET => CONNECTING_CLOUD
07:08:33.714 -> [33809] Connecting to blynk.cloud:443
07:08:34.809 -> [34922] Certificate OK
07:08:34.844 -> [34943] Ready (ping: 20ms).
07:08:34.912 -> [35011] CONNECTING_CLOUD => RUNNING
07:08:34.912 -> [35014] Configuration stored to flash

Pete.

Thanks Pete! I’ll dig in there, I didn’t realize the void loop should be so squeaky clean.