mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-05 20:40:25 -08:00
Add wifi connection status icon to status bar
This commit is contained in:
@@ -221,7 +221,10 @@ PROGMEM static const unsigned char menu_icons[][66] = {
|
||||
0x3B, 0x77, 0x37, 0xBD, 0x6A, 0x2F, 0xD6, 0xBD, 0x1A, 0xDA, 0xDA, 0x16,
|
||||
0x5A, 0x6F, 0x16, 0x9A, 0xF7, 0x16, 0xD6, 0x5A, 0x1A, 0xDD, 0xBD, 0x2E,
|
||||
0xBB, 0x5A, 0x37, 0x3F, 0x6F, 0x3F, 0x7F, 0xB7, 0x3F, 0xFF, 0xCC, 0x3F,
|
||||
0xFF, 0xF3, 0x3F, 0xFF, 0xFF, 0x3F}
|
||||
0xFF, 0xF3, 0x3F, 0xFF, 0xFF, 0x3F},
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFC, 0xFF, 0xF3, 0x87, 0xF7, // JOINED: 38
|
||||
0x7F, 0xEE, 0xFF, 0xED, 0xC7, 0xDD, 0xBF, 0xDB, 0x7F, 0xDB, 0x67, 0xDB,
|
||||
0x67, 0xDB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
|
||||
};
|
||||
|
||||
/*#ifndef MARAUDER_MINI
|
||||
|
||||
@@ -608,6 +608,7 @@ MenuFunctions::MenuFunctions()
|
||||
// Create second label
|
||||
lv_obj_t * pw_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(pw_label, "Password:");
|
||||
lv_textarea_set_text(ta2, "");
|
||||
lv_obj_align(pw_label, ta2, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
// Create a keyboard and apply the styles
|
||||
@@ -633,13 +634,18 @@ MenuFunctions::MenuFunctions()
|
||||
String ta2_text = lv_textarea_get_text(ta2);
|
||||
Serial.println(ta1_text);
|
||||
Serial.println(ta2_text);
|
||||
wifi_scan_obj.joinWiFi(ta1_text, ta2_text);
|
||||
if (wifi_scan_obj.joinWiFi(ta1_text, ta2_text))
|
||||
wifi_scan_obj.currentScanMode = WIFI_CONNECTED;
|
||||
else
|
||||
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
|
||||
}else if(event == LV_EVENT_CANCEL){
|
||||
printf("LV_EVENT_CANCEL\n");
|
||||
//lv_textarea_set_text(lv_keyboard_get_textarea(kb), "");
|
||||
menu_function_obj.deinitLVGL();
|
||||
//wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||
display_obj.exit_draw = true; // set everything back to normal
|
||||
if (wifi_scan_obj.connected_network != "")
|
||||
wifi_scan_obj.currentScanMode = WIFI_CONNECTED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,7 +761,8 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
{
|
||||
// Some function exited and we need to go back to normal
|
||||
if (display_obj.exit_draw) {
|
||||
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
|
||||
if (wifi_scan_obj.currentScanMode != WIFI_CONNECTED)
|
||||
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
|
||||
display_obj.exit_draw = false;
|
||||
this->orientDisplay();
|
||||
}
|
||||
@@ -1431,7 +1438,7 @@ void MenuFunctions::updateStatusBar()
|
||||
MenuFunctions::battery(false);
|
||||
display_obj.tft.fillRect(186, 0, 16, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
|
||||
|
||||
// Disable touch stuff
|
||||
#ifdef HAS_ILI9341
|
||||
#ifdef HAS_BUTTONS
|
||||
if (this->disable_touch) {
|
||||
@@ -1444,10 +1451,19 @@ void MenuFunctions::updateStatusBar()
|
||||
STATUSBAR_COLOR,
|
||||
TFT_RED);
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setCursor(0, 1);
|
||||
display_obj.tft.drawXBitmap(186,
|
||||
0,
|
||||
menu_icons[DISABLE_TOUCH],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
TFT_DARKGREY);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Draw SD info
|
||||
#ifdef HAS_SD
|
||||
if (sd_obj.supported)
|
||||
@@ -1470,6 +1486,29 @@ void MenuFunctions::updateStatusBar()
|
||||
display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR);
|
||||
display_obj.tft.drawString("SD", TFT_WIDTH - 12, 0, 1);
|
||||
#endif
|
||||
|
||||
// WiFi connection status stuff
|
||||
if (wifi_scan_obj.currentScanMode == WIFI_CONNECTED) {
|
||||
#ifdef HAS_FULL_SCREEN
|
||||
display_obj.tft.drawXBitmap(170 - 16,
|
||||
0,
|
||||
menu_icons[JOINED],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
TFT_GREEN);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef HAS_FULL_SCREEN
|
||||
display_obj.tft.drawXBitmap(170 - 16,
|
||||
0,
|
||||
menu_icons[JOINED],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
TFT_DARKGREY);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MenuFunctions::drawStatusBar()
|
||||
@@ -1557,6 +1596,7 @@ void MenuFunctions::drawStatusBar()
|
||||
display_obj.tft.fillRect(186, 0, 16, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
|
||||
|
||||
// Disable touch stuff
|
||||
#ifdef HAS_ILI9341
|
||||
#ifdef HAS_BUTTONS
|
||||
if (this->disable_touch) {
|
||||
@@ -1569,6 +1609,16 @@ void MenuFunctions::drawStatusBar()
|
||||
STATUSBAR_COLOR,
|
||||
TFT_RED);
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setCursor(0, 1);
|
||||
display_obj.tft.drawXBitmap(186,
|
||||
0,
|
||||
menu_icons[DISABLE_TOUCH],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
TFT_DARKGREY);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1595,6 +1645,29 @@ void MenuFunctions::drawStatusBar()
|
||||
display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR);
|
||||
display_obj.tft.drawString("SD", TFT_WIDTH - 12, 0, 1);
|
||||
#endif
|
||||
|
||||
// WiFi connection status stuff
|
||||
if (wifi_scan_obj.currentScanMode == WIFI_CONNECTED) {
|
||||
#ifdef HAS_FULL_SCREEN
|
||||
display_obj.tft.drawXBitmap(170 - 16,
|
||||
0,
|
||||
menu_icons[JOINED],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
TFT_GREEN);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef HAS_FULL_SCREEN
|
||||
display_obj.tft.drawXBitmap(170 - 16,
|
||||
0,
|
||||
menu_icons[JOINED],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
TFT_DARKGREY);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MenuFunctions::orientDisplay()
|
||||
@@ -3180,7 +3253,7 @@ void MenuFunctions::RunSetup()
|
||||
// Reset the touch keys so we don't activate the keys when we go back
|
||||
display_obj.menuButton(&t_x, &t_y, display_obj.updateTouch(&t_x, &t_y));
|
||||
this->changeMenu(targetMenu->parentMenu);
|
||||
return;
|
||||
return wifi_scan_obj.current_mini_kb_ssid;
|
||||
}
|
||||
|
||||
// If the screen is touched but none of the keys are used, don't refresh display
|
||||
|
||||
@@ -76,6 +76,7 @@ extern Settings settings_obj;
|
||||
#define BLANK 36
|
||||
#define PINESCAN_SNIFF 37 // Use blanks icon
|
||||
#define MULTISSID_SNIFF 37 // Use blanks icon
|
||||
#define JOINED 38
|
||||
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
@@ -780,8 +780,10 @@ bool WiFiScan::joinWiFi(String ssid, String password)
|
||||
#endif
|
||||
#endif
|
||||
this->wifi_initialized = true;
|
||||
this->currentScanMode = WIFI_CONNECTED;
|
||||
display_obj.tft.setTextWrap(false, false);
|
||||
#ifndef HAS_TOUCH
|
||||
this->currentScanMode = WIFI_CONNECTED;
|
||||
display_obj.tft.setTextWrap(false, false);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1775,7 +1777,7 @@ void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color)
|
||||
Serial.println("Using TFT Shield");
|
||||
#else if defined(TFT_DIY)
|
||||
uint16_t calData[5] = { 213, 3469, 320, 3446, 1 }; // Landscape TFT DIY
|
||||
Serial.println("Using TFT DIY");
|
||||
Serial.println("Using TFT DIY (join wifi)");
|
||||
#endif
|
||||
#ifdef HAS_ILI9341
|
||||
display_obj.tft.setTouch(calData);
|
||||
|
||||
BIN
pictures/icons/joined_16.bmp
Normal file
BIN
pictures/icons/joined_16.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
6
pictures/xbm/joined_16.xbm
Normal file
6
pictures/xbm/joined_16.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define 67ae760eaaa64924c492c46151d37f46mewyG1NBArKDOITT_width 16
|
||||
#define 67ae760eaaa64924c492c46151d37f46mewyG1NBArKDOITT_height 16
|
||||
static char 67ae760eaaa64924c492c46151d37f46mewyG1NBArKDOITT_bits[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFC, 0xFF, 0xF3, 0x87, 0xF7,
|
||||
0x7F, 0xEE, 0xFF, 0xED, 0xC7, 0xDD, 0xBF, 0xDB, 0x7F, 0xDB, 0x67, 0xDB,
|
||||
0x67, 0xDB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, };
|
||||
Reference in New Issue
Block a user