Skip to content

Commit

Permalink
Merge main branch fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeswitz committed Oct 6, 2023
2 parents 5882084 + 629b93c commit 59150d9
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 582 deletions.
6 changes: 3 additions & 3 deletions .vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"configuration": "CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,PartitionScheme=noota_3gffat,DebugLevel=none",
"board": "esp32:esp32:lolin_s2_mini",
"configuration": "xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,FlashMode=dout,FlashFreq=40,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600",
"board": "esp8266:esp8266:d1_mini_clone",
"sketch": "src/Wardriver/Wardriver.ino",
"port": "/dev/ttyACM0"
"port": "/dev/ttyUSB0"
}
586 changes: 39 additions & 547 deletions .vscode/c_cpp_properties.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Wardriver/Vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include "Arduino.h"
#include <HardwareSerial.h>

#define VERSION 1.1
#define VERSION_STR "v1.1"
#define VERSION 1.2
#define VERSION_STR "v1.2"
#define WIGLE_HEADER "MAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type"

#define SERIAL_BAUD 115200
#define SERIAL_BAUD 1152007
#define GPS_BAUD 9600
#define TIMEZONE_UTC -7
#define SCAN_INTERVAL 500
Expand Down
3 changes: 3 additions & 0 deletions src/Wardriver/Wardriver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
void setup() {
Serial.begin(115200);
pinMode(A0, INPUT);
ESP.wdtDisable();

Wardriver::init();
ESP.wdtEnable(0);
}

void loop() {
Expand Down
33 changes: 30 additions & 3 deletions src/Wardriver/src/Filesys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ Filesys::Filesys() {
void Filesys::init(Filesys::ScreenUpdateCallback callback) {

#if defined (ESP8266)
if (!SD.begin(SD_CS)) {
bool sdSuccess = SD.begin(SD_CS);
if (!sdSuccess) {
callback("SD Card: NOT FOUND");
// ESP.wdtDisable();
while (!SD.begin(SD_CS)) { delay(0); }
while (!sdSuccess) {
sdSuccess = SD.begin(SD_CS);
ESP.wdtFeed();
}

}
callback("SD Card: FOUND!!");

#elif defined (ESP32)

EspTinyUSB::registerDeviceCallbacks(new Device());
Expand Down Expand Up @@ -82,6 +87,28 @@ void Filesys::init(Filesys::ScreenUpdateCallback callback) {
callback(tmpMsg);

#endif

Filesys::configure();

}

void Filesys::configure() {

// create config.txt if it doesn't exist
// if (!FS_VAR.exists("config.txt")) {
// File tmpSettings = FS_VAR.open("config.txt", FILE_WRITE);
// tmpSettings.println("# Duplicates recommended");
// tmpSettings.println("Duplicates: y");
// tmpSettings.println("GPS RX: D4");
// tmpSettings.println("GPS RX: D3");

// tmpSettings.close();
// }

// read settings & write to variables
// File tmpSettings = FS_VAR.open("config.txt", FILE_WRITE);
// tmpSettings.read()

}


Expand Down
3 changes: 3 additions & 0 deletions src/Wardriver/src/Filesys.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ class Filesys {

static void open();
static void close();

private:
static void configure();
};
63 changes: 37 additions & 26 deletions src/Wardriver/src/Wardriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "../Vars.h"
#include "Filesys.h"

const int MAX_MACS = 50;
const int MAX_MACS = 150;

#if defined(ESP8266)
#include <SoftwareSerial.h>
Expand Down Expand Up @@ -109,27 +109,40 @@ void initGPS() {

Screen::drawMockup("...", "...", sats, totalNets, openNets, clients, bat, speed, "GPS: Initializing...");

unsigned long startGPSTime = millis();
while (!(gps.location.isValid())) {
if (millis() - startGPSTime > 5000 && gps.charsProcessed() < 10) {
Screen::drawMockup("...", "...", sats, totalNets, openNets, clients, bat, speed, "GPS: NOT FOUND");
} else if (gps.charsProcessed() > 10) {
Screen::drawMockup("...", "...", sats, totalNets, openNets, clients, bat, speed, "GPS: Waiting for fix...");
unsigned long startGPSTime = millis();
while (! (gps.location.isValid())) {
if (millis()-startGPSTime > 5000 && gps.charsProcessed() < 10) {
Screen::drawMockup("...","...",sats,totalNets,openNets,clients,bat,speed,"GPS: NOT FOUND");
}
else if (gps.charsProcessed() > 10) {
Screen::drawMockup("...","...",sats,totalNets,openNets,clients,bat,speed,"GPS: Waiting for fix...");
}
sats = gps.satellites.value();

Serial.println(gps.location.isValid());
ESP.wdtFeed(); smartDelay(500);
}
sats = gps.satellites.value();
while (!(gps.date.year() == 2023)) {
Screen::drawMockup("...","...",sats,totalNets,openNets,clients,bat,speed,"GPS: Validating time...");
ESP.wdtFeed(); smartDelay(500);
Serial.println(gps.date.year());
}
Screen::drawMockup("...","...",sats,totalNets,openNets,clients,bat,speed,"GPS: LOCATION FOUND");

Serial.println(gps.location.isValid());
delay(0);
smartDelay(500);
}
while (!(gps.date.year() == 2023) && hdop < 30) {
Screen::drawMockup("...", "...", sats, totalNets, openNets, clients, bat, speed, "GPS: Calibrating...");
delay(0);
smartDelay(500);
}
Screen::drawMockup("...", "...", sats, totalNets, openNets, clients, bat, speed, "GPS: LOCATION FOUND");

updateGPS();

// while (!(gps.date.year() == 2023) && hdop < 30) {
// Screen::drawMockup("...", "...", sats, totalNets, openNets, clients, bat, speed, "GPS: Calibrating...");
// delay(0);
// smartDelay(500);
// }


updateGPS();
}

void initGPS(uint8_t override) {
Expand Down Expand Up @@ -208,17 +221,15 @@ void getBattery() {
}

void Wardriver::init() {
Screen::init();
Screen::drawSplash(2);
Filesys::init(updateScreen);
delay(1000);

getBattery();
initGPS();

char filename[23];
sprintf(filename, "%i-%02d-%02d", yr, mt, dy);
Filesys::createLog(filename, updateScreen);
Screen::init();
Screen::drawSplash(2);

Filesys::init(updateScreen); delay(1000);
getBattery();
initGPS();

char filename[23]; sprintf(filename,"%i-%02d-%02d",yr, mt, dy);
Filesys::createLog(filename, updateScreen);
}

void Wardriver::updateScreen(char* message) {
Expand Down

0 comments on commit 59150d9

Please sign in to comment.