From 8b496b8398dba9560009692943e6e178ffc7d884 Mon Sep 17 00:00:00 2001 From: francois <francois@clever.amilab.irit.fr> Date: Tue, 10 Jan 2023 10:27:12 +0100 Subject: [PATCH] update --- .../libraries/neocampus/neocampus_utils.cpp | 7 +-- neosensor/neosensor.ino | 3 + .../WiFiManager_simple/WiFiManager_simple.ino | 55 +++++++++++++++++++ tests/WiFiManager_simple/debug.cfg | 14 +++++ tests/WiFiManager_simple/debug_custom.json | 19 +++++++ 5 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 tests/WiFiManager_simple/WiFiManager_simple.ino create mode 100644 tests/WiFiManager_simple/debug.cfg create mode 100644 tests/WiFiManager_simple/debug_custom.json diff --git a/neosensor/libraries/neocampus/neocampus_utils.cpp b/neosensor/libraries/neocampus/neocampus_utils.cpp index 1c726297..70de3c8d 100644 --- a/neosensor/libraries/neocampus/neocampus_utils.cpp +++ b/neosensor/libraries/neocampus/neocampus_utils.cpp @@ -9,7 +9,6 @@ * - ... * * --- - * F.Thiebolt jan.23 removed wifiManager.setMinimumSignalQuality(); cause of DHCP issues ?? * F.Thiebolt aug.22 removed WiFiparameters hack :) ... by means of dynamic allocation :| * F.Thiebolt aug.21 extended checkCLEAR to 5000ms (some ESP32 have huge * internal capacitor enabled@starup ?!?!) @@ -213,10 +212,8 @@ bool setupWiFi( wifiParametersMgt *wp ) { // set config save notify callback: only usefull for additional parameters wifiManager.setSaveConfigCallback( cb_exitConfigMode ); - /* set minimum signal level - * [jan.23] disabled while trying to overcome DHCP issues :| - * wifiManager.setMinimumSignalQuality(); // min. default is 8% - */ + // set minimum signal level + wifiManager.setMinimumSignalQuality(); // min. default is 8% /* [aug.20] does not work on ESP32 ... segfault :( * set custom ip for AP portal diff --git a/neosensor/neosensor.ino b/neosensor/neosensor.ino index 76d57eff..ac936440 100644 --- a/neosensor/neosensor.ino +++ b/neosensor/neosensor.ino @@ -9,6 +9,9 @@ * (c) F.Thiebolt / neOCampus operation - Université Toulouse 3 * * --- + * WARNING: [jan.23] WiFiManager 2.0.15-rc1 does not list WiFi networks available !?!?! + * ==> UPGRADE WiFiManager for bsp_update branch <== + * --- * NOTES: * - [ESP8266]MEMP_NUM_TCP_PCB= 8 (MAX simulteaneous listening TCP connections) * - you need to 'deploy' our boards definitions (run the deploy.sh script) diff --git a/tests/WiFiManager_simple/WiFiManager_simple.ino b/tests/WiFiManager_simple/WiFiManager_simple.ino new file mode 100644 index 00000000..23bd8dd0 --- /dev/null +++ b/tests/WiFiManager_simple/WiFiManager_simple.ino @@ -0,0 +1,55 @@ +#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager + +/* Global variables */ +const char *mySSID="neOCampus"; +const char *mySSIDpw="CHANGE_ME"; + +void setup() { + delay(3000); // time for USB serial link to come up anew + Serial.begin(115200); // Start serial for output + + Serial.println(F("\n\n###\n### Starting simple WiFiManager connection test ...\n###")); + + // Arduino libs v2.4.1, to enable printf and debug messages output + Serial.setDebugOutput( true ); + + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP + // it is a good practice to make sure your code sets wifi mode how you want it. + + + //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around + WiFiManager wm; + wm.setDebugOutput(true); + + // reset settings - wipe stored credentials for testing + // these are stored by the esp library + // wm.resetSettings(); + + // Automatically connect using saved credentials, + // if connection fails, it starts an access point with the specified name ( "AutoConnectAP"), + // if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect()) + // then goes into a blocking loop awaiting configuration and will return success result + + Serial.println(F("\tconnection timeout to 5mn ..."); + wm.setConnectTimeout(300); + + bool res; + // res = wm.autoConnect(); // auto generated AP name from chipid + // res = wm.autoConnect("AutoConnectAP"); // anonymous ap + res = wm.autoConnect(mySSID,mySSIDpw); // password protected ap + + if(!res) { + Serial.println("Failed to connect"); + // ESP.restart(); + } + else { + //if you get here you have connected to the WiFi + Serial.println("connected...yeey :)"); + } + +} + +void loop() { + // put your main code here, to run repeatedly: + Serial.print("+"); delay(1000); +} diff --git a/tests/WiFiManager_simple/debug.cfg b/tests/WiFiManager_simple/debug.cfg new file mode 100644 index 00000000..aa99b3e5 --- /dev/null +++ b/tests/WiFiManager_simple/debug.cfg @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Example OpenOCD configuration file for ESP32-WROVER-KIT board. +# +# For example, OpenOCD can be started for ESP32 debugging on +# +# openocd -f board/esp32-wrover-kit-3.3v.cfg +# + +# Source the JTAG interface configuration file +source [find interface/ftdi/esp32_devkitj_v1.cfg] +set ESP32_FLASH_VOLTAGE 3.3 +# Source the ESP32 configuration file +source [find target/esp32.cfg] diff --git a/tests/WiFiManager_simple/debug_custom.json b/tests/WiFiManager_simple/debug_custom.json new file mode 100644 index 00000000..b890268e --- /dev/null +++ b/tests/WiFiManager_simple/debug_custom.json @@ -0,0 +1,19 @@ +{ + "name":"Arduino on ESP32", + "toolchainPrefix":"xtensa-esp32-elf", + "svdFile":"esp32.svd", + "request":"attach", + "postAttachCommands":[ + "set remote hardware-watchpoint-limit 2", + "monitor reset halt", + "monitor gdb_sync", + "thb setup", + "c" + ], + "overrideRestartCommands":[ + "monitor reset halt", + "monitor gdb_sync", + "thb setup", + "c" + ] +} \ No newline at end of file -- GitLab