diff --git a/docs/faq.md b/docs/faq.md index 220b8971cb..6ff60add8e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -855,11 +855,17 @@ where `&type` is: `sensor = 4` ### 7.6. Q: How do I connect to the companion via WIFI, e.g. using a heltec v3? - **A:** -WiFi firmware requires you to compile it yourself, as you need to set the wifi ssid and password. -Edit WIFI_SSID and WIFI_PWD in `./variants/heltec_v3/platformio.ini` and then flash it to your device. + + **A:** +WiFi firmware now utilizes WIFI Manager which automatically creates an AP of "MC-AP" with password "mypwd000" when unable to connect to WIFI. + +To customize the default AP name and password, edit WIFI_MANAGER and WIFI_PWD in `./variants/heltec_v3/platformio.ini` and then flash it to your device. A custom password with fewer than 8 characters will be right-padded with zeros to a length of 8. + +If the manager does not pop up automatically after connecting to the AP, please browse to 192.168.4.1 . + ### 7.7. Q: I have a Station G2, or a Heltec V4, or an Ikoka Stick, or a radio with a EByte E22-900M30S or a E22-900M33S module, what should their transmit power be set to? + **A:** For companion radios, you can set these radios' transmit power in the smartphone app. For repeater and room server radios, you can set their transmit power using the command line command `set tx`. You can get their current value using command line comand `get tx` diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index eff9efca47..cfdefddeeb 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -35,7 +35,9 @@ static uint32_t _atoi(const char* sp) { #endif #ifdef ESP32 - #ifdef WIFI_SSID + #if defined(WIFI_MANAGER) + #include // https://github.com/tzapu/WiFiManager + WiFiManager wifiManager; #include SerialWifiInterface serial_interface; #ifndef TCP_PORT @@ -193,10 +195,21 @@ void setup() { #endif ); -#ifdef WIFI_SSID - board.setInhibitSleep(true); // prevent sleep when WiFi is active - WiFi.begin(WIFI_SSID, WIFI_PWD); - serial_interface.begin(TCP_PORT); +#if defined(WIFI_MANAGER) + // AP password must have a minimum 8 characters + String ap_passwd = WIFI_PWD; + while (ap_passwd.length() < 8) { + ap_passwd += "0"; + } + if (wifiManager.autoConnect(WIFI_MANAGER, ap_passwd.c_str())) + { + board.setInhibitSleep(true); // prevent sleep when WiFi is active + serial_interface.begin(TCP_PORT); + } else { + MESH_DEBUG_PRINTLN("WifiManager failed to connect. Restarting."); + delay(2000); + ESP.restart(); + } #elif defined(BLE_PIN_CODE) serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin()); #elif defined(SERIAL_RX) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 265532be0b..c9f371ce0b 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -2,7 +2,7 @@ #include #include "../MyMesh.h" #include "target.h" -#ifdef WIFI_SSID +#if defined(WIFI_MANAGER) #include #endif @@ -209,7 +209,7 @@ class HomeScreen : public UIScreen { sprintf(tmp, "MSG: %d", _task->getMsgCount()); display.drawTextCentered(display.width() / 2, 20, tmp); - #ifdef WIFI_SSID + #if defined(WIFI_MANAGER) IPAddress ip = WiFi.localIP(); snprintf(tmp, sizeof(tmp), "IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); display.setTextSize(1); diff --git a/variants/heltec_tracker_v2/platformio.ini b/variants/heltec_tracker_v2/platformio.ini index 5f196834c9..efcc167495 100644 --- a/variants/heltec_tracker_v2/platformio.ini +++ b/variants/heltec_tracker_v2/platformio.ini @@ -184,8 +184,8 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D DISPLAY_CLASS=ST7735Display -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -198,6 +198,7 @@ build_src_filter = ${Heltec_tracker_v2.build_src_filter} lib_deps = ${Heltec_tracker_v2.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 [env:heltec_tracker_v2_sensor] extends = Heltec_tracker_v2 diff --git a/variants/heltec_v2/platformio.ini b/variants/heltec_v2/platformio.ini index f8cc936083..849f99bdfc 100644 --- a/variants/heltec_v2/platformio.ini +++ b/variants/heltec_v2/platformio.ini @@ -181,8 +181,8 @@ build_flags = -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -195,3 +195,4 @@ build_src_filter = ${Heltec_lora32_v2.build_src_filter} lib_deps = ${Heltec_lora32_v2.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index 4d299104e4..1cbf609f2c 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -187,8 +187,8 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D DISPLAY_CLASS=SSD1306Display -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -340,8 +340,8 @@ build_flags = -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -351,6 +351,7 @@ build_src_filter = ${Heltec_lora32_v3.build_src_filter} lib_deps = ${Heltec_lora32_v3.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 [env:Heltec_WSL3_sensor] extends = Heltec_lora32_v3 diff --git a/variants/heltec_v4/platformio.ini b/variants/heltec_v4/platformio.ini index 71ffc2e6a9..7652b5fd22 100644 --- a/variants/heltec_v4/platformio.ini +++ b/variants/heltec_v4/platformio.ini @@ -206,8 +206,8 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D DISPLAY_CLASS=SSD1306Display -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 build_src_filter = ${heltec_v4_oled.build_src_filter} @@ -369,8 +369,8 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D DISPLAY_CLASS=ST7789LCDDisplay -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 build_src_filter = ${heltec_v4_tft.build_src_filter} @@ -382,6 +382,7 @@ build_src_filter = ${heltec_v4_tft.build_src_filter} lib_deps = ${heltec_v4_tft.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 [env:heltec_v4_tft_sensor] extends = heltec_v4_tft diff --git a/variants/lilygo_tlora_v2_1/platformio.ini b/variants/lilygo_tlora_v2_1/platformio.ini index 7e1330e6cc..464ef187f2 100644 --- a/variants/lilygo_tlora_v2_1/platformio.ini +++ b/variants/lilygo_tlora_v2_1/platformio.ini @@ -133,8 +133,8 @@ build_flags = -I examples/companion_radio/ui-new -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 - -D WIFI_SSID='"ssid"' - -D WIFI_PWD='"password"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D WIFI_DEBUG_LOGGING=1 -D OFFLINE_QUEUE_SIZE=256 build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} @@ -145,6 +145,7 @@ build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 ; ; Repeater Bridges diff --git a/variants/nibble_screen_connect/platformio.ini b/variants/nibble_screen_connect/platformio.ini index 0d3d46523f..855ff26792 100644 --- a/variants/nibble_screen_connect/platformio.ini +++ b/variants/nibble_screen_connect/platformio.ini @@ -145,8 +145,8 @@ build_flags = -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 build_src_filter = ${nibble_screen_connect_base.build_src_filter} + @@ -157,4 +157,5 @@ build_src_filter = ${nibble_screen_connect_base.build_src_filter} lib_deps = ${nibble_screen_connect_base.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 950b46efa2..1ea4096d47 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -111,14 +111,15 @@ lib_deps = ${rak11310.lib_deps} ; -D MAX_CONTACTS=100 ; -D MAX_GROUP_CHANNELS=8 ; -D WIFI_DEBUG_LOGGING=1 -; -D WIFI_SSID='"myssid"' -; -D WIFI_PWD='"mypwd"' +; -D WIFI_MANAGER='"MC-AP"' +; -D WIFI_PWD='"mypwd000"' ; ; -D MESH_PACKET_LOGGING=1 ; ; -D MESH_DEBUG=1 ; build_src_filter = ${rak11310.build_src_filter} ; +<../examples/companion_radio/*.cpp> ; lib_deps = ${rak11310.lib_deps} ; densaugeo/base64 @ ~1.4.0 +; tzapu/WiFiManager@^2.0.17 [env:RAK_11310_terminal_chat] extends = rak11310 diff --git a/variants/rak3112/platformio.ini b/variants/rak3112/platformio.ini index d030e74946..8a686753c7 100644 --- a/variants/rak3112/platformio.ini +++ b/variants/rak3112/platformio.ini @@ -173,8 +173,8 @@ build_flags = -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -185,6 +185,7 @@ build_src_filter = ${rak3112.build_src_filter} lib_deps = ${rak3112.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 [env:RAK_3112_sensor] extends = rak3112 diff --git a/variants/rpi_picow/platformio.ini b/variants/rpi_picow/platformio.ini index ec5cdb8390..5cb60e8790 100644 --- a/variants/rpi_picow/platformio.ini +++ b/variants/rpi_picow/platformio.ini @@ -85,14 +85,15 @@ lib_deps = ${rpi_picow.lib_deps} ; -D MAX_CONTACTS=100 ; -D MAX_GROUP_CHANNELS=8 ; -D WIFI_DEBUG_LOGGING=1 -; -D WIFI_SSID='"myssid"' -; -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' ; ; -D MESH_PACKET_LOGGING=1 ; ; -D MESH_DEBUG=1 ; build_src_filter = ${rpi_picow.build_src_filter} ; +<../examples/companion_radio/*.cpp> ; lib_deps = ${rpi_picow.lib_deps} ; densaugeo/base64 @ ~1.4.0 +; tzapu/WiFiManager@^2.0.17 [env:PicoW_terminal_chat] extends = rpi_picow diff --git a/variants/station_g2/platformio.ini b/variants/station_g2/platformio.ini index 91ef5f7a50..30f8c157f8 100644 --- a/variants/station_g2/platformio.ini +++ b/variants/station_g2/platformio.ini @@ -225,8 +225,8 @@ build_flags = -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -237,3 +237,4 @@ build_src_filter = ${Station_G2.build_src_filter} lib_deps = ${Station_G2.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 diff --git a/variants/thinknode_m2/platformio.ini b/variants/thinknode_m2/platformio.ini index b2ebca7325..ffe1c78bde 100644 --- a/variants/thinknode_m2/platformio.ini +++ b/variants/thinknode_m2/platformio.ini @@ -177,8 +177,10 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D OFFLINE_QUEUE_SIZE=256 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 build_src_filter = ${ThinkNode_M2.build_src_filter} + + @@ -188,6 +190,7 @@ lib_deps = ${ThinkNode_M2.lib_deps} densaugeo/base64 @ ~1.4.0 end2endzone/NonBlockingRTTTL@^1.3.0 + tzapu/WiFiManager@^2.0.17 [env:ThinkNode_M2_companion_radio_serial] extends = ThinkNode_M2 diff --git a/variants/thinknode_m5/platformio.ini b/variants/thinknode_m5/platformio.ini index fb2ba3ac28..d4ce78dff2 100644 --- a/variants/thinknode_m5/platformio.ini +++ b/variants/thinknode_m5/platformio.ini @@ -192,8 +192,10 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D OFFLINE_QUEUE_SIZE=256 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"Livebox-633C"' - -D WIFI_PWD='"vvQUHGSxsWd7fKMYSr"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 build_src_filter = ${ThinkNode_M5.build_src_filter} + + @@ -204,6 +206,7 @@ lib_deps = ${ThinkNode_M5.lib_deps} densaugeo/base64 @ ~1.4.0 end2endzone/NonBlockingRTTTL@^1.3.0 + tzapu/WiFiManager@^2.0.17 [env:ThinkNode_M5_companion_radio_serial] extends = ThinkNode_M5 diff --git a/variants/waveshare_rp2040_lora/platformio.ini b/variants/waveshare_rp2040_lora/platformio.ini index 78a5e3e771..4ac5be0863 100644 --- a/variants/waveshare_rp2040_lora/platformio.ini +++ b/variants/waveshare_rp2040_lora/platformio.ini @@ -109,14 +109,15 @@ lib_deps = ${waveshare_rp2040_lora.lib_deps} ; -D MAX_CONTACTS=100 ; -D MAX_GROUP_CHANNELS=8 ; -D WIFI_DEBUG_LOGGING=1 -; -D WIFI_SSID='"myssid"' -; -D WIFI_PWD='"mypwd"' -; ; -D MESH_PACKET_LOGGING=1 -; ; -D MESH_DEBUG=1 +; -D WIFI_MANAGER='"MC-AP"' +; -D WIFI_PWD='"mypwd000"' +; ; -D MESH_PACKET_LOGGING=1 +; ; -D MESH_DEBUG=1 ; build_src_filter = ${waveshare_rp2040_lora.build_src_filter} ; +<../examples/companion_radio/*.cpp> ; lib_deps = ${waveshare_rp2040_lora.lib_deps} ; densaugeo/base64 @ ~1.4.0 +; tzapu/WiFiManager@^2.0.17 [env:waveshare_rp2040_lora_terminal_chat] extends = waveshare_rp2040_lora diff --git a/variants/xiao_c3/platformio.ini b/variants/xiao_c3/platformio.ini index 76b72174af..2c49706c79 100644 --- a/variants/xiao_c3/platformio.ini +++ b/variants/xiao_c3/platformio.ini @@ -114,8 +114,8 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D OFFLINE_QUEUE_SIZE=256 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"mypwd"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' ; -D BLE_DEBUG_LOGGING=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -123,3 +123,4 @@ lib_deps = ${Xiao_esp32_C3.lib_deps} ${esp32_ota.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 diff --git a/variants/xiao_rp2040/platformio.ini b/variants/xiao_rp2040/platformio.ini index 2b3e744220..3a93127820 100644 --- a/variants/xiao_rp2040/platformio.ini +++ b/variants/xiao_rp2040/platformio.ini @@ -87,14 +87,15 @@ lib_deps = ${Xiao_rp2040.lib_deps} ; -D MAX_CONTACTS=100 ; -D MAX_GROUP_CHANNELS=8 ; -D WIFI_DEBUG_LOGGING=1 -; -D WIFI_SSID='"myssid"' -; -D WIFI_PWD='"mypwd"' +; -D WIFI_MANAGER='"MC-AP"' +; -D WIFI_PWD='"mypwd000"' ; ; -D MESH_PACKET_LOGGING=1 ; ; -D MESH_DEBUG=1 ; build_src_filter = ${Xiao_rp2040.build_src_filter} ; +<../examples/companion_radio/*.cpp> ; lib_deps = ${Xiao_rp2040.lib_deps} ; densaugeo/base64 @ ~1.4.0 +; tzapu/WiFiManager@^2.0.17 [env:Xiao_rp2040_terminal_chat] extends = Xiao_rp2040 diff --git a/variants/xiao_s3_wio/platformio.ini b/variants/xiao_s3_wio/platformio.ini index 22bb4090a4..968007c730 100644 --- a/variants/xiao_s3_wio/platformio.ini +++ b/variants/xiao_s3_wio/platformio.ini @@ -209,14 +209,15 @@ build_flags = -D MAX_GROUP_CHANNELS=40 -D OFFLINE_QUEUE_SIZE=256 -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"myssid"' - -D WIFI_PWD='"password"' + -D WIFI_MANAGER='"MC-AP"' + -D WIFI_PWD='"mypwd000"' ; -D BLE_DEBUG_LOGGING=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 lib_deps = ${Xiao_S3_WIO.lib_deps} densaugeo/base64 @ ~1.4.0 + tzapu/WiFiManager@^2.0.17 [env:Xiao_S3_WIO_sensor] extends = Xiao_S3_WIO