Skip to content

Commit

Permalink
starting mods
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed May 22, 2024
1 parent 0c81df7 commit 0921d01
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 17 deletions.
22 changes: 12 additions & 10 deletions src/LoRa_APRS_iGate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,10 @@ ________________________________________________________________________________
String versionDate = "2024.05.20";
Configuration Config;
WiFiClient espClient;
uint8_t myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];

bool isUpdatingOTA = false;
uint32_t previousWiFiMillis = 0;
uint32_t lastScreenOn = millis();

uint32_t lastWiFiCheck = 0;
bool WiFiConnect = true;
bool WiFiConnected = false;
bool WiFiAutoAPStarted = false;
long WiFiAutoAPTime = false;

uint32_t lastBatteryCheck = 0;
String batteryVoltage;

Expand All @@ -63,6 +53,18 @@ bool modemLoggedToAPRSIS = false;

String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine;

/*uint8_t myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];*/
//uint32_t previousWiFiMillis = 0;
//uint32_t lastWiFiCheck = 0;
//bool WiFiConnect = true;
//bool WiFiConnected = false;
//bool WiFiAutoAPStarted = false;
//long WiFiAutoAPTime = false;



//#define STARTUP_DELAY 5 //min

void setup() {
Expand Down
39 changes: 32 additions & 7 deletions src/wifi_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
#include "utils.h"

extern Configuration Config;
extern WiFi_AP *currentWiFi;
extern uint8_t myWiFiAPIndex;
extern int myWiFiAPSize;
extern uint32_t previousWiFiMillis;
extern bool WiFiConnected;
extern long WiFiAutoAPTime;
extern bool WiFiAutoAPStarted;

//extern WiFi_AP *currentWiFi;
//extern uint8_t myWiFiAPIndex;
//extern int myWiFiAPSize;
//extern uint32_t previousWiFiMillis;

uint8_t myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];

uint8_t wifiCounter = 0;
bool WiFiConnected = false;
uint32_t WiFiAutoAPTime = millis();
bool WiFiAutoAPStarted = false;
uint32_t previousWiFiMillis = 0;

namespace WIFI_Utils {

Expand All @@ -24,9 +31,27 @@ namespace WIFI_Utils {
WiFi.disconnect();
WiFi.reconnect();
previousWiFiMillis = millis();
wifiCounter++;
} else if (WiFi.status() == WL_CONNECTED) {
wifiCounter = 0;
Serial.println(wifiCounter);
}
}

/*void checkWiFiInterval() {
uint32_t WiFiCheck = millis() - lastWiFiCheck;
if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15 * 60 * 1000) {
WiFiConnect = true;
}
if (WiFiConnect) {
Serial.println("\nConnecting to WiFi ...");
WIFI_Utils::startWiFi();
lastWiFiCheck = millis();
WiFiConnect = false;
}
}*/


void startAutoAP() {
WiFi.mode(WIFI_MODE_NULL);

Expand Down

0 comments on commit 0921d01

Please sign in to comment.