mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2026-04-28 03:53:06 -07:00
Fix non-display hardware
This commit is contained in:
@@ -4914,73 +4914,75 @@ void WiFiScan::tagPOI(const char* label) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WiFiScan::onWiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
void WiFiScan::onWiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||||
extern WiFiScan wifi_scan_obj;
|
#ifdef HAS_SCREEN
|
||||||
|
extern WiFiScan wifi_scan_obj;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ARDUINO_EVENT_WIFI_AP_STACONNECTED: {
|
case ARDUINO_EVENT_WIFI_AP_STACONNECTED: {
|
||||||
char macStr[18];
|
char macStr[18];
|
||||||
|
|
||||||
snprintf(macStr,
|
snprintf(macStr,
|
||||||
sizeof(macStr),
|
sizeof(macStr),
|
||||||
"%02X:%02X:%02X:%02X:%02X:%02X",
|
"%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
info.wifi_ap_staconnected.mac[0],
|
info.wifi_ap_staconnected.mac[0],
|
||||||
info.wifi_ap_staconnected.mac[1],
|
info.wifi_ap_staconnected.mac[1],
|
||||||
info.wifi_ap_staconnected.mac[2],
|
info.wifi_ap_staconnected.mac[2],
|
||||||
info.wifi_ap_staconnected.mac[3],
|
info.wifi_ap_staconnected.mac[3],
|
||||||
info.wifi_ap_staconnected.mac[4],
|
info.wifi_ap_staconnected.mac[4],
|
||||||
info.wifi_ap_staconnected.mac[5]);
|
info.wifi_ap_staconnected.mac[5]);
|
||||||
|
|
||||||
lastClientMAC = String(macStr);
|
lastClientMAC = String(macStr);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED: {
|
|
||||||
IPAddress ip(info.wifi_ap_staipassigned.ip.addr);
|
|
||||||
lastClientIP = ip.toString();
|
|
||||||
|
|
||||||
Serial.println("Client IP assigned");
|
|
||||||
Serial.println("IP: " + lastClientIP);
|
|
||||||
|
|
||||||
display_obj.tft.setTextSize(1);
|
|
||||||
if (wifi_scan_obj.currentScanMode == WIFI_SCAN_DISPLAY_AP_INFO) {
|
|
||||||
display_obj.tft.fillRect(0,
|
|
||||||
((SCREEN_HEIGHT / 3) * 2),
|
|
||||||
TFT_WIDTH,
|
|
||||||
SCREEN_HEIGHT,
|
|
||||||
TFT_BLACK);
|
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
|
||||||
display_obj.tft.setCursor(0, ((SCREEN_HEIGHT / 3) * 2));
|
|
||||||
display_obj.tft.println(lastClientMAC + "\n" + lastClientIP + "\nconnected");
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED: {
|
||||||
|
IPAddress ip(info.wifi_ap_staipassigned.ip.addr);
|
||||||
|
lastClientIP = ip.toString();
|
||||||
|
|
||||||
|
Serial.println("Client IP assigned");
|
||||||
|
Serial.println("IP: " + lastClientIP);
|
||||||
|
|
||||||
|
display_obj.tft.setTextSize(1);
|
||||||
|
if (wifi_scan_obj.currentScanMode == WIFI_SCAN_DISPLAY_AP_INFO) {
|
||||||
|
display_obj.tft.fillRect(0,
|
||||||
|
((SCREEN_HEIGHT / 3) * 2),
|
||||||
|
TFT_WIDTH,
|
||||||
|
SCREEN_HEIGHT,
|
||||||
|
TFT_BLACK);
|
||||||
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
|
display_obj.tft.setCursor(0, ((SCREEN_HEIGHT / 3) * 2));
|
||||||
|
display_obj.tft.println(lastClientMAC + "\n" + lastClientIP + "\nconnected");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED: {
|
||||||
|
char macStr[18];
|
||||||
|
|
||||||
|
snprintf(macStr,
|
||||||
|
sizeof(macStr),
|
||||||
|
"%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
|
info.wifi_ap_staconnected.mac[0],
|
||||||
|
info.wifi_ap_staconnected.mac[1],
|
||||||
|
info.wifi_ap_staconnected.mac[2],
|
||||||
|
info.wifi_ap_staconnected.mac[3],
|
||||||
|
info.wifi_ap_staconnected.mac[4],
|
||||||
|
info.wifi_ap_staconnected.mac[5]);
|
||||||
|
|
||||||
|
display_obj.tft.fillRect(0,
|
||||||
|
((SCREEN_HEIGHT / 3) * 2),
|
||||||
|
TFT_WIDTH,
|
||||||
|
SCREEN_HEIGHT,
|
||||||
|
TFT_BLACK);
|
||||||
|
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||||
|
display_obj.tft.setCursor(0, ((SCREEN_HEIGHT / 3) * 2));
|
||||||
|
display_obj.tft.println(String(macStr) + "\nClient disconnected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED: {
|
#endif
|
||||||
char macStr[18];
|
|
||||||
|
|
||||||
snprintf(macStr,
|
|
||||||
sizeof(macStr),
|
|
||||||
"%02X:%02X:%02X:%02X:%02X:%02X",
|
|
||||||
info.wifi_ap_staconnected.mac[0],
|
|
||||||
info.wifi_ap_staconnected.mac[1],
|
|
||||||
info.wifi_ap_staconnected.mac[2],
|
|
||||||
info.wifi_ap_staconnected.mac[3],
|
|
||||||
info.wifi_ap_staconnected.mac[4],
|
|
||||||
info.wifi_ap_staconnected.mac[5]);
|
|
||||||
|
|
||||||
display_obj.tft.fillRect(0,
|
|
||||||
((SCREEN_HEIGHT / 3) * 2),
|
|
||||||
TFT_WIDTH,
|
|
||||||
SCREEN_HEIGHT,
|
|
||||||
TFT_BLACK);
|
|
||||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
|
||||||
display_obj.tft.setCursor(0, ((SCREEN_HEIGHT / 3) * 2));
|
|
||||||
display_obj.tft.println(String(macStr) + "\nClient disconnected");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiFiScan::displayAPStats() {
|
void WiFiScan::displayAPStats() {
|
||||||
|
|||||||
Reference in New Issue
Block a user