mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2026-08-02 08:58:24 -07:00
Clean up mem
This commit is contained in:
@@ -1202,7 +1202,7 @@ void MenuFunctions::updateStatusBar()
|
||||
uint16_t the_color;
|
||||
|
||||
// Draw temp info
|
||||
if (temp_obj.current_temp < 70)
|
||||
/*if (temp_obj.current_temp < 70)
|
||||
the_color = TFT_GREEN;
|
||||
else if ((temp_obj.current_temp >= 70) && (temp_obj.current_temp < 80))
|
||||
the_color = TFT_YELLOW;
|
||||
@@ -1211,7 +1211,7 @@ void MenuFunctions::updateStatusBar()
|
||||
else if ((temp_obj.current_temp >= 90) && (temp_obj.current_temp < 100))
|
||||
the_color = TFT_RED;
|
||||
else
|
||||
the_color = TFT_MAROON;
|
||||
the_color = TFT_MAROON;*/
|
||||
|
||||
/*
|
||||
display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR);
|
||||
@@ -1326,7 +1326,7 @@ void MenuFunctions::drawStatusBar()
|
||||
uint16_t the_color;
|
||||
|
||||
// Draw temp info
|
||||
if (temp_obj.current_temp < 70)
|
||||
/*if (temp_obj.current_temp < 70)
|
||||
the_color = TFT_GREEN;
|
||||
else if ((temp_obj.current_temp >= 70) && (temp_obj.current_temp < 80))
|
||||
the_color = TFT_YELLOW;
|
||||
@@ -1339,7 +1339,7 @@ void MenuFunctions::drawStatusBar()
|
||||
|
||||
display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR);
|
||||
temp_obj.old_temp = temp_obj.current_temp;
|
||||
display_obj.tft.fillRect(0, 0, 50, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
display_obj.tft.fillRect(0, 0, 50, STATUS_BAR_WIDTH, STATUSBAR_COLOR);*/
|
||||
/*
|
||||
#ifdef HAS_ILI9341
|
||||
display_obj.tft.drawString((String)temp_obj.current_temp + " C", 4, 0, 2);
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#include "TemperatureInterface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
|
||||
TemperatureInterface::TemperatureInterface() {
|
||||
|
||||
}
|
||||
|
||||
void TemperatureInterface::RunSetup() {
|
||||
this->initTime = millis();
|
||||
this->current_temp = this->getCurrentTemp();
|
||||
}
|
||||
|
||||
uint8_t TemperatureInterface::getCurrentTemp() {
|
||||
return ((temprature_sens_read() - 32) / 1.8);
|
||||
}
|
||||
|
||||
void TemperatureInterface::main(uint32_t currentTime) {
|
||||
if (currentTime != 0) {
|
||||
if (currentTime - initTime >= 100) {
|
||||
//Serial.println("Checking Battery Level");
|
||||
this->initTime = millis();
|
||||
this->current_temp = this->getCurrentTemp();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef TemperatureInterface_h
|
||||
#define TemperatureInterface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class TemperatureInterface {
|
||||
|
||||
private:
|
||||
uint32_t initTime = 0;
|
||||
|
||||
public:
|
||||
TemperatureInterface();
|
||||
|
||||
uint8_t current_temp = 0;
|
||||
uint8_t old_temp = 0;
|
||||
|
||||
uint8_t getCurrentTemp();
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -905,9 +905,9 @@ void WiFiScan::RunInfo()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table4[35] + (String)temp_obj.current_temp + " C");
|
||||
#endif
|
||||
//#ifdef HAS_SCREEN
|
||||
// display_obj.tft.println(text_table4[35] + (String)temp_obj.current_temp + " C");
|
||||
//#endif
|
||||
}
|
||||
|
||||
void WiFiScan::RunEspressifScan(uint8_t scan_mode, uint16_t color) {
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#ifdef HAS_BATTERY
|
||||
#include "BatteryInterface.h"
|
||||
#endif
|
||||
#ifdef HAS_TEMP_SENSOR
|
||||
#include "TemperatureInterface.h"
|
||||
#endif
|
||||
//#ifdef HAS_TEMP_SENSOR
|
||||
// #include "TemperatureInterface.h"
|
||||
//#endif
|
||||
#include "settings.h"
|
||||
#include "Assets.h"
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
@@ -99,9 +99,9 @@ extern Buffer buffer_obj;
|
||||
#ifdef HAS_BATTERY
|
||||
extern BatteryInterface battery_obj;
|
||||
#endif
|
||||
#ifdef HAS_TEMP_SENSOR
|
||||
extern TemperatureInterface temp_obj;
|
||||
#endif
|
||||
//#ifdef HAS_TEMP_SENSOR
|
||||
// extern TemperatureInterface temp_obj;
|
||||
//#endif
|
||||
extern Settings settings_obj;
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
extern flipperLED flipper_led;
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#include "a32u4_interface.h"
|
||||
|
||||
HardwareSerial MySerial_two(2);
|
||||
|
||||
void A32u4Interface::begin() {
|
||||
MySerial_two.begin(BAUD32U4, SERIAL_8N1, 25, 4);
|
||||
|
||||
delay(2000);
|
||||
|
||||
Serial.println("Setup A32U4 Serial Interface");
|
||||
|
||||
MySerial_two.println("DELAY 1");
|
||||
|
||||
delay(1000);
|
||||
|
||||
uint8_t a32u4_rep = 0;
|
||||
|
||||
if (MySerial_two.available()) {
|
||||
a32u4_rep = (uint8_t)MySerial_two.read();
|
||||
}
|
||||
|
||||
//display_string.trim();
|
||||
|
||||
//Serial.println("\nDisplay string: " + (String)display_string);
|
||||
|
||||
if (a32u4_rep != 0) {
|
||||
this->supported = true;
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
Serial.print("A32U4 Said: ");
|
||||
Serial.println(a32u4_rep);
|
||||
}
|
||||
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
void A32u4Interface::runScript(String script) {
|
||||
MySerial_two.println(script);
|
||||
}
|
||||
|
||||
void A32u4Interface::test() {
|
||||
MySerial_two.println("STRING Hello, World!");
|
||||
}
|
||||
|
||||
void A32u4Interface::main(uint32_t current_time) {
|
||||
|
||||
if (current_time - this->initTime >= 1000) {
|
||||
this->initTime = millis();
|
||||
//MySerial_two.write("PING");
|
||||
|
||||
//delay(1);
|
||||
|
||||
if (MySerial_two.available()) {
|
||||
Serial.println("Got A32U4 Serial data");
|
||||
Serial.println(MySerial_two.read());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef a32u4_interface_h
|
||||
#define a32u4_interface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define BAUD32U4 115200
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class A32u4Interface {
|
||||
public:
|
||||
bool supported = false;
|
||||
|
||||
uint32_t initTime;
|
||||
|
||||
void begin();
|
||||
|
||||
void main(uint32_t current_time);
|
||||
void test();
|
||||
void runScript(String script);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -52,9 +52,9 @@ https://www.online-utility.org/image/convert/to/XBM
|
||||
#include "BatteryInterface.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAS_TEMP_SENSOR
|
||||
#include "TemperatureInterface.h"
|
||||
#endif
|
||||
//#ifdef HAS_TEMP_SENSOR
|
||||
// #include "TemperatureInterface.h"
|
||||
//#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
@@ -99,9 +99,9 @@ CommandLine cli_obj;
|
||||
BatteryInterface battery_obj;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_TEMP_SENSOR
|
||||
TemperatureInterface temp_obj;
|
||||
#endif
|
||||
//#ifdef HAS_TEMP_SENSOR
|
||||
// TemperatureInterface temp_obj;
|
||||
//#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
Display display_obj;
|
||||
@@ -303,9 +303,9 @@ void setup()
|
||||
#endif
|
||||
|
||||
// Temperature stuff
|
||||
#ifdef HAS_TEMP_SENSOR
|
||||
temp_obj.RunSetup();
|
||||
#endif
|
||||
//#ifdef HAS_TEMP_SENSOR
|
||||
// temp_obj.RunSetup();
|
||||
//#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[6]));
|
||||
@@ -408,7 +408,7 @@ void loop()
|
||||
|
||||
#ifdef HAS_BATTERY
|
||||
battery_obj.main(currentTime);
|
||||
temp_obj.main(currentTime);
|
||||
//temp_obj.main(currentTime);
|
||||
#endif
|
||||
settings_obj.main(currentTime);
|
||||
if (((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) && (wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL)) ||
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
#include "esp_interface.h"
|
||||
|
||||
HardwareSerial MySerial(1);
|
||||
|
||||
void EspInterface::begin() {
|
||||
pinMode(ESP_RST, OUTPUT);
|
||||
pinMode(ESP_ZERO, OUTPUT);
|
||||
|
||||
delay(100);
|
||||
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
|
||||
Serial.println("Checking for ESP8266...");
|
||||
|
||||
MySerial.begin(BAUD, SERIAL_8N1, 27, 26);
|
||||
|
||||
delay(100);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println("Checking for ESP8266...");
|
||||
#endif
|
||||
|
||||
this->bootRunMode();
|
||||
|
||||
delay(500);
|
||||
|
||||
while (MySerial.available())
|
||||
MySerial.read();
|
||||
|
||||
MySerial.write("PING");
|
||||
|
||||
delay(2000);
|
||||
|
||||
String display_string = "";
|
||||
|
||||
while (MySerial.available()) {
|
||||
display_string.concat((char)MySerial.read());
|
||||
}
|
||||
|
||||
display_string.trim();
|
||||
|
||||
Serial.println("\nDisplay string: " + (String)display_string);
|
||||
|
||||
if (display_string == "ESP8266 Pong") {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
Serial.println("ESP8266 Found!");
|
||||
this->supported = true;
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
void EspInterface::RunUpdate() {
|
||||
this->bootProgramMode();
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(true);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
|
||||
display_obj.tft.println("Waiting for serial data...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EspInterface::bootProgramMode() {
|
||||
Serial.println("[!] Setting ESP12 in program mode...");
|
||||
digitalWrite(ESP_ZERO, LOW);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, LOW);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
Serial.println("[!] Complete");
|
||||
Serial.end();
|
||||
Serial.begin(57600);
|
||||
}
|
||||
|
||||
void EspInterface::bootRunMode() {
|
||||
Serial.end();
|
||||
Serial.begin(115200);
|
||||
Serial.println("[!] Setting ESP12 in run mode...");
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, LOW);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
Serial.println("[!] Complete");
|
||||
}
|
||||
|
||||
void EspInterface::program() {
|
||||
if (MySerial.available()) {
|
||||
Serial.write((uint8_t)MySerial.read());
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(".");
|
||||
#endif
|
||||
while (Serial.available()) {
|
||||
MySerial.write((uint8_t)Serial.read());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EspInterface::main(uint32_t current_time) {
|
||||
if (current_time - this->initTime >= 1000) {
|
||||
this->initTime = millis();
|
||||
//MySerial.write("PING");
|
||||
}
|
||||
|
||||
while (MySerial.available()) {
|
||||
Serial.print((char)MySerial.read());
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
MySerial.write((uint8_t)Serial.read());
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef esp_interface_h
|
||||
#define esp_interface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define ESP_RST 14
|
||||
#define ESP_ZERO 13
|
||||
#define BAUD 115200
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class EspInterface {
|
||||
public:
|
||||
bool supported = false;
|
||||
|
||||
uint32_t initTime;
|
||||
|
||||
void RunUpdate();
|
||||
void bootProgramMode();
|
||||
void bootRunMode();
|
||||
void begin();
|
||||
|
||||
void program();
|
||||
void main(uint32_t current_time);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user