Skip to content

Commit

Permalink
flipper app completed and Serial FS Support Finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Spooks4576 committed Aug 8, 2024
1 parent 7806312 commit 65bb0de
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 116 deletions.
72 changes: 0 additions & 72 deletions scripts/ScriptConverter_Switch.py

This file was deleted.

Binary file added scripts/ghost_esp.fap
Binary file not shown.
7 changes: 0 additions & 7 deletions scripts/start_debug.bat

This file was deleted.

44 changes: 28 additions & 16 deletions src/components/gps_module/gps_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,15 @@ void gps_module::WarDrivingLoop()

#ifdef HAS_GPS
if (gps.location.isValid() && gps.location.isUpdated()) {
String streetName = findClosestStreet(gps.location.lat(), gps.location.lng());
Serial.println(streetName);

String streetName = "";

if (SystemManager::getInstance().sdCardModule.Initlized)
{
streetName = findClosestStreet(gps.location.lat(), gps.location.lng());
}


int Networks = WiFi.scanNetworks();

for (int i = 0; i < Networks; i++)
Expand All @@ -122,11 +129,24 @@ void gps_module::WarDrivingLoop()

String Message = G_Utils::formatString("%s, %s, %s, %s, %i, %i, %f, %f, %f, %f", BSSID.c_str(), SSID.c_str(), SecurityType.c_str(), GetDateAndTime().c_str(), Channel, RSSI, gps.location.lat(), gps.location.lng(), gps.altitude.meters(), 2.5 * gps.hdop.hdop() / 10);
String MessageWithStreet = G_Utils::formatString("%s, %s, %s, %s, %i, %i, %f, %f, %f, %f, %s", BSSID.c_str(), SSID.c_str(), SecurityType.c_str(), GetDateAndTime().c_str(), Channel, RSSI, gps.location.lat(), gps.location.lng(), gps.altitude.meters(), 2.5 * gps.hdop.hdop() / 10, streetName.c_str());
LOG_RESULTS("wardiving.csv", "gps", Message);
LOG_RESULTS("wardiving_withstreets.csv", "gps", MessageWithStreet);
Serial.println("Logged Info At " + streetName);

LOG_RESULTS("wardiving.csv", "gps", Message.c_str());
if (SystemManager::getInstance().sdCardModule.Initlized)
{
LOG_RESULTS("wardiving_withstreets.csv", "gps", MessageWithStreet.c_str());
}

if (SystemManager::getInstance().sdCardModule.Initlized)
{
Serial.println("Logged Info At " + streetName);
}
else
{
Serial.println("Logged WiFi " + SSID);
}
}
uint8_t set_channel = random(1, 13);
CurrentChannel = CurrentChannel + 1 % 13;
uint8_t set_channel = CurrentChannel;
esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE);
} else {
Serial.println("GPS signal not found");
Expand Down Expand Up @@ -167,7 +187,7 @@ void gps_module::streetloop()
Serial.print("Altitude: "); Serial.println(gps.altitude.kilometers());
Serial.print("Speed: "); Serial.println(gps.speed.kmph());
Serial.println(streetName);
LOG_RESULTS("streets.txt", "gps", "Visited " + streetName);
LOG_RESULTS("streets.txt", "gps", String(streetName + " Visited").c_str());
} else {
Serial.println("GPS signal not found");
}
Expand All @@ -180,8 +200,7 @@ void gps_module::streetloop()

void gps_module::setup(bool EnableBLEScans)
{
if (SystemManager::getInstance().sdCardModule.Initlized)
{

#ifdef HAS_GPS
Serial1.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);
#endif
Expand All @@ -192,11 +211,4 @@ void gps_module::setup(bool EnableBLEScans)
SystemManager::getInstance().bleModule->InitWarDriveCallback();
#endif
Serial.println("Initilized GPS Serial");
}
else
{
Initilized = false;
Stop = true;
Serial.println("Failed to Initilize GPS Serial Possible SD Card Init Failure");
}
}
1 change: 1 addition & 0 deletions src/components/gps_module/gps_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class gps_module
#endif
File MapData;
bool Initilized;
uint8_t CurrentChannel;
bool Stop;
unsigned long lastUpdate = 0;
long updateInterval = 1000;
Expand Down
22 changes: 2 additions & 20 deletions src/components/sdcard_module/sd_card_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,10 @@ bool SDCardModule::init() {
Initlized = SD_MMC.begin();
IsMMCCard = true;
CardType = ECardType::MMC;
#else
CardType = ECardType::Serial;
#endif

// if (!Initlized)
// {
// Serial.print("HELLO");

// unsigned long startTime = millis();
// unsigned long timeout = 5000;

// while (millis() - startTime < timeout)
// {
// String data = Serial.readString();
// if (data.indexOf("RECIEVED") != -1) {
// Serial.println("Message received successfully.");
// Initlized = true;
// CardType = ECardType::Serial;
// break;
// }
// }
// }


if (!Initlized) {
Serial.println("SD Card initialization failed!");
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/core/system_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ neopixelModule->breatheLED(SystemManager::getInstance().neopixelModule->strip.Co
#define LOG_RESULTS(filename, folder, message) SystemManager::getInstance().sdCardModule.logMessage(filename, folder, message)
#else
#define LOG_MESSAGE_TO_SD(message) // Not Supported do nothing
#define LOG_RESULTS(filename, folder, message)
#define LOG_RESULTS(filename, folder, message) SystemManager::getInstance().sdCardModule.logPacket((const uint8_t*)message, strlen(message))
#endif

namespace G_Utils
Expand Down

0 comments on commit 65bb0de

Please sign in to comment.