mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 15:50:36 -08:00
Merge pull request #921 from justcallmekoko/develop
Improve signal monitor UI
This commit is contained in:
@@ -26,63 +26,41 @@ void BatteryInterface::RunSetup() {
|
||||
|
||||
#ifdef HAS_BATTERY
|
||||
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
|
||||
Serial.println("Checking for battery monitors...");
|
||||
|
||||
Wire.beginTransmission(IP5306_ADDR);
|
||||
error = Wire.endTransmission();
|
||||
#ifndef HAS_AXP2101
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
|
||||
if (error == 0) {
|
||||
Serial.println("Detected IP5306");
|
||||
this->has_ip5306 = true;
|
||||
this->i2c_supported = true;
|
||||
}
|
||||
|
||||
Wire.beginTransmission(MAX17048_ADDR);
|
||||
error = Wire.endTransmission();
|
||||
|
||||
if (error == 0) {
|
||||
if (maxlipo.begin()) {
|
||||
Serial.println("Detected MAX17048");
|
||||
this->has_max17048 = true;
|
||||
this->i2c_supported = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*for(addr = 1; addr < 127; addr++ ) {
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.beginTransmission(IP5306_ADDR);
|
||||
error = Wire.endTransmission();
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
Serial.print("I2C device found at address 0x");
|
||||
|
||||
if (addr<16)
|
||||
Serial.print("0");
|
||||
if (error == 0) {
|
||||
Serial.println("Detected IP5306");
|
||||
this->has_ip5306 = true;
|
||||
this->i2c_supported = true;
|
||||
}
|
||||
|
||||
Serial.println(addr,HEX);
|
||||
|
||||
if (addr == IP5306_ADDR) {
|
||||
this->has_ip5306 = true;
|
||||
Wire.beginTransmission(MAX17048_ADDR);
|
||||
error = Wire.endTransmission();
|
||||
|
||||
if (error == 0) {
|
||||
if (maxlipo.begin()) {
|
||||
Serial.println("Detected MAX17048");
|
||||
this->has_max17048 = true;
|
||||
this->i2c_supported = true;
|
||||
}
|
||||
|
||||
if (addr == MAX17048_ADDR) {
|
||||
if (maxlipo.begin()) {
|
||||
Serial.println("Detected MAX17048");
|
||||
this->has_max17048 = true;
|
||||
this->i2c_supported = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
#else
|
||||
bool result = this->power.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL);
|
||||
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
Serial.println("Detected AXP2101");
|
||||
|
||||
/*if (this->maxlipo.begin()) {
|
||||
Serial.println("Detected MAX17048");
|
||||
this->has_max17048 = true;
|
||||
this->i2c_supported = true;
|
||||
}*/
|
||||
this->has_axp2101 = true;
|
||||
#endif
|
||||
|
||||
this->initTime = millis();
|
||||
#endif
|
||||
@@ -120,4 +98,10 @@ int8_t BatteryInterface::getBatteryLevel() {
|
||||
else
|
||||
return percent;
|
||||
}
|
||||
|
||||
#ifdef HAS_AXP2101
|
||||
if (this->has_axp2101) {
|
||||
return this->power.getBatteryPercent();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
#include "configs.h"
|
||||
#include "Adafruit_MAX1704X.h"
|
||||
|
||||
#ifdef HAS_AXP2101
|
||||
#define XPOWERS_CHIP_AXP2101
|
||||
#include "XPowersLib.h"
|
||||
#endif
|
||||
|
||||
#include <Wire.h>
|
||||
|
||||
#define IP5306_ADDR 0x75
|
||||
@@ -18,12 +23,17 @@ class BatteryInterface {
|
||||
uint32_t initTime = 0;
|
||||
Adafruit_MAX17048 maxlipo;
|
||||
|
||||
#ifdef HAS_AXP2101
|
||||
XPowersPMU power;
|
||||
#endif
|
||||
|
||||
public:
|
||||
int8_t battery_level = 0;
|
||||
int8_t old_level = 0;
|
||||
bool i2c_supported = false;
|
||||
bool has_max17048 = false;
|
||||
bool has_ip5306 = false;
|
||||
bool has_axp2101 = false;
|
||||
|
||||
BatteryInterface();
|
||||
|
||||
|
||||
@@ -5882,11 +5882,13 @@ void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
if ((targ_ap.rssi + 5 < snifferPacket->rx_ctrl.rssi) || (snifferPacket->rx_ctrl.rssi + 5 < targ_ap.rssi)) {
|
||||
if ((targ_ap.rssi + 1 < snifferPacket->rx_ctrl.rssi) || (snifferPacket->rx_ctrl.rssi + 1 < targ_ap.rssi)) {
|
||||
targ_ap.rssi = snifferPacket->rx_ctrl.rssi;
|
||||
access_points->set(targ_index, targ_ap);
|
||||
|
||||
Serial.println((String)access_points->get(targ_index).essid + " RSSI: " + (String)access_points->get(targ_index).rssi);
|
||||
display_string.concat((String)access_points->get(targ_index).essid);
|
||||
|
||||
/*display_string.concat((String)access_points->get(targ_index).essid);
|
||||
#ifndef HAS_MINI_SCREEN
|
||||
display_string.concat(" RSSI: ");
|
||||
display_string.concat((String)access_points->get(targ_index).rssi);
|
||||
@@ -5909,7 +5911,7 @@ void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
}
|
||||
display_obj.display_buffer->add(display_string);
|
||||
#endif
|
||||
#endif
|
||||
#endif*/
|
||||
}
|
||||
else
|
||||
return;
|
||||
@@ -8392,6 +8394,27 @@ void WiFiScan::main(uint32_t currentTime)
|
||||
#ifdef HAS_ILI9341
|
||||
this->signalAnalyzerLoop(currentTime);
|
||||
#endif
|
||||
if (currentTime - initTime >= this->channel_hop_delay * 500) {
|
||||
initTime = millis();
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.fillRect(0,
|
||||
(STATUS_BAR_WIDTH * 2) + 1 + EXT_BUTTON_WIDTH,
|
||||
TFT_WIDTH,
|
||||
TFT_HEIGHT - STATUS_BAR_WIDTH + 1,
|
||||
TFT_BLACK);
|
||||
|
||||
display_obj.tft.setCursor(0, (STATUS_BAR_WIDTH * 2) + CHAR_WIDTH + EXT_BUTTON_WIDTH);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
for (int y = 0; y < access_points->size(); y++) {
|
||||
if (access_points->get(y).selected) {
|
||||
display_obj.tft.println(access_points->get(y).essid + ": " + (String)access_points->get(y).rssi);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if ((currentScanMode == WIFI_SCAN_CHAN_ANALYZER) ||
|
||||
(currentScanMode == BT_SCAN_ANALYZER)) {
|
||||
|
||||
Reference in New Issue
Block a user