Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
99b4293
allows WiFi to attempt reconnect more than once as defined, default 6…
sandeepkumar0153 Oct 5, 2025
4f1156c
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 5, 2025
b78e35d
Merge branch 'develop' into develop
sandeepkumar0153 Oct 6, 2025
e8dcc30
changes to pin config based on custom hardware.
sandeepkumar0153 Oct 5, 2025
8bb91b6
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 6, 2025
f6631fb
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 7, 2025
bfa17f5
Merge branch 'develop' into develop
thebentern Oct 7, 2025
6966392
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 7, 2025
55a7c95
Update src/mesh/wifi/WiFiAPClient.cpp
sandeepkumar0153 Oct 7, 2025
bdc28f9
Update src/mesh/wifi/WiFiAPClient.cpp
sandeepkumar0153 Oct 7, 2025
38d5e46
Update variant.h to default
sandeepkumar0153 Oct 7, 2025
c2224ad
Update variant.h to default
sandeepkumar0153 Oct 7, 2025
c6c5307
Update variant.h
sandeepkumar0153 Oct 7, 2025
4ff4358
Update WiFiAPClient.cpp
sandeepkumar0153 Oct 7, 2025
bcb8274
Merge branch 'develop' into develop
sandeepkumar0153 Oct 8, 2025
9e08b7b
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 12, 2025
90be0ae
Merge branch 'develop' into develop
thebentern Oct 12, 2025
0d32fc6
Merge branch 'develop' into develop
thebentern Oct 12, 2025
5e4ff85
Macros have been capitalised, Updated WiFiAPClient.cpp
sandeepkumar0153 Oct 12, 2025
3fd00a6
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 13, 2025
69bde4b
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 Oct 16, 2025
e073e09
Merge branch 'develop' into develop
sandeepkumar0153 Oct 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions src/mesh/wifi/WiFiAPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ char ourHost[16];
// To replace blocking wifi connect delay with a non-blocking sleep
static unsigned long wifiReconnectStartMillis = 0;
static bool wifiReconnectPending = false;
static unsigned char wifiConnectAttempts=0;

#ifndef MaxWifiConnectionAttempts
#define MaxWifiConnectionAttempts 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macros should be CAPS_LOCK

#endif

#ifndef wifiReconnectGap
#define wifiReconnectGap 10000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macros should be CAPS_LOCK

#endif

bool APStartupComplete = 0;

Expand Down Expand Up @@ -168,28 +177,44 @@ static int32_t reconnectWiFi()
#elif defined(ARCH_RP2040)
WiFi.disconnect(false);
#endif
LOG_INFO("Reconnecting to WiFi access point %s", wifiName);
LOG_INFO("Connecting to WiFi access point %s", wifiName);

// Start the non-blocking wait for 5 seconds
wifiReconnectStartMillis = millis();
wifiReconnectPending = true;
// Do not attempt to connect yet, wait for the next invocation
return 5000; // Schedule next check soon
return wifiReconnectGap; // Schedule next check soon
}

// Check if we are ready to proceed with the WiFi connection after the 5s wait
if (wifiReconnectPending) {
if (millis() - wifiReconnectStartMillis >= 5000) {
if (millis() - wifiReconnectStartMillis >= wifiReconnectGap) {
if (!WiFi.isConnected()) {
wifiConnectAttempts++;
LOG_INFO("Reconnecting to WiFi access point %s, attempt %d", wifiName, wifiConnectAttempts);
#ifdef CONFIG_IDF_TARGET_ESP32C3
WiFi.mode(WIFI_MODE_NULL);
WiFi.useStaticBuffers(true);
WiFi.mode(WIFI_STA);
#endif
WiFi.begin(wifiName, wifiPsw);
wifiReconnectStartMillis=millis();
if(wifiConnectAttempts<MaxWifiConnectionAttempts){
needReconnect=true;
}
else{
needReconnect=false;
wifiReconnectPending = false;
LOG_INFO("Maximum connection attempts reached %d", wifiConnectAttempts);
LOG_INFO("Unable to connect access point %s", wifiName);
}

}
else{
LOG_INFO("WiFi succesfully connected to access point %s", wifiName);
LOG_INFO("Connection attempts %d", wifiConnectAttempts);
wifiReconnectPending = false;
}
isReconnecting = false;
wifiReconnectPending = false;
} else {
// Still waiting for 5s to elapse
return 100; // Check again soon
Expand Down
30 changes: 15 additions & 15 deletions variants/nrf52840/diy/nrf52_promicro_diy_tcxo/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ NRF52 PRO MICRO PIN ASSIGNMENT
// Definition of milliVolt per LSB => 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
#define VBAT_MV_PER_LSB (0.73242188F)
// Voltage divider value => 1.5M + 1M voltage divider on VBAT = (1.5M / (1M + 1.5M))
#define VBAT_DIVIDER (0.6F)
#define VBAT_DIVIDER (0.39F)
// Compensation factor for the VBAT divider
#define VBAT_DIVIDER_COMP (1.73)
#define VBAT_DIVIDER_COMP (1.65)
// Fixed calculation of milliVolt from compensation value
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
#undef AREF_VOLTAGE
Expand All @@ -87,23 +87,23 @@ NRF52 PRO MICRO PIN ASSIGNMENT
#define LED_STATE_ON 1 // State when LED is lit

// Button
#define BUTTON_PIN (32 + 0) // P1.00
#define BUTTON_PIN (32 + 7) // P1.00 // modified

// GPS
#define PIN_GPS_TX (0 + 22) // P0.22
#define PIN_GPS_RX (0 + 20) // P0.20
#define PIN_GPS_TX (0 + 6) // P0.22 // modified
#define PIN_GPS_RX (0 + 8) // P0.20 // modified

#define PIN_GPS_EN (0 + 24) // P0.24
#define GPS_POWER_TOGGLE
// #define GPS_POWER_TOGGLE /modified
#define GPS_UBLOX
// define GPS_DEBUG

// UART interfaces
#define PIN_SERIAL1_RX PIN_GPS_TX
#define PIN_SERIAL1_TX PIN_GPS_RX
// // UART interfaces //modified
#define PIN_SERIAL1_RX PIN_GPS_TX
#define PIN_SERIAL1_TX PIN_GPS_RX

#define PIN_SERIAL2_RX (0 + 6) // P0.06
#define PIN_SERIAL2_TX (0 + 8) // P0.08
#define PIN_SERIAL2_RX (0 + 20) // P0.06
#define PIN_SERIAL2_TX (0 + 22) // P0.08

// Serial interfaces
#define SPI_INTERFACES_COUNT 1
Expand All @@ -118,11 +118,11 @@ NRF52 PRO MICRO PIN ASSIGNMENT
#define LORA_CS (32 + 13) // P1.13

// LORA MODULES
#define USE_LLCC68
// #define USE_LLCC68
#define USE_SX1262
#define USE_RF95
#define USE_SX1268
#define USE_LR1121
// #define USE_RF95
// #define USE_SX1268
// #define USE_LR1121

// RF95 CONFIG

Expand Down
3 changes: 2 additions & 1 deletion variants/rp2040/rpipicow/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
// rxd = 9

#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17

#define BUTTON_PIN 6

#define LED_PIN LED_BUILTIN

Expand Down
Loading