From bbe864d605da3afb88fefd8287e8cc9fa6198ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Farkas=20Szil=C3=A1rd?= Date: Sun, 6 Jun 2021 16:28:22 +0200 Subject: [PATCH] Icon if AP is enabled --- main/disp_oled.cpp | 9 +++++++++ main/wifi.cpp | 1 + main/wifi.h | 1 + 3 files changed, 11 insertions(+) diff --git a/main/disp_oled.cpp b/main/disp_oled.cpp index 7cddf66..a11e6cf 100644 --- a/main/disp_oled.cpp +++ b/main/disp_oled.cpp @@ -23,6 +23,10 @@ #include "wifi.h" #endif +#ifdef WITH_AP +#include "wifi.h" +#endif + #ifdef WITH_BT_SPP #include "bt.h" #endif @@ -592,6 +596,11 @@ void OLED_DrawStatusBar(u8g2_t *OLED, GPS_Position *GPS) // status bar on top if(WIFI_isConnected()) { u8g2_SetFont(OLED, u8g2_font_open_iconic_all_1x_t); u8g2_DrawGlyph(OLED, 43, 11, 0x119); } // 0x50 +#endif +#ifdef WITH_AP + if(WIFI_isAP()) + { u8g2_SetFont(OLED, u8g2_font_open_iconic_all_1x_t); + u8g2_DrawGlyph(OLED, 43, 11, 0xF8); } // 0x50 #endif // u8g2_SetFont(OLED, u8g2_font_5x7_tr); // u8g2_SetFont(OLED, u8g2_font_5x8_tr); diff --git a/main/wifi.cpp b/main/wifi.cpp index a09de4d..e5c57d0 100644 --- a/main/wifi.cpp +++ b/main/wifi.cpp @@ -8,6 +8,7 @@ tcpip_adapter_ip_info_t WIFI_IP = { 0, 0, 0 }; // WIFI local IP address, mask a WIFI_State_t WIFI_State; bool WIFI_isConnected(void) { return WIFI_IP.ip.addr!=0; } // return "connected" status when IP from DHCP is there +bool WIFI_isAP(void) { return WIFI_Config.ap.ssid_len!=0; } // return if AP mode enabled static esp_err_t WIFI_event_handler(void *ctx, system_event_t *event) { diff --git a/main/wifi.h b/main/wifi.h index 39da6d9..6164c95 100644 --- a/main/wifi.h +++ b/main/wifi.h @@ -19,6 +19,7 @@ typedef union extern WIFI_State_t WIFI_State; bool WIFI_isConnected(void); +bool WIFI_isAP(void); esp_err_t WIFI_Init(void); esp_err_t WIFI_setPowerSave(bool ON); esp_err_t WIFI_Start(void);