Display MAC and IPv4 addresses

This commit is contained in:
bwagstaff
2020-07-28 15:20:38 -05:00
parent 7873331c59
commit 7400e63a98
3 changed files with 16 additions and 2 deletions

View File

@@ -150,6 +150,12 @@ void wlan_password_tile_setup( lv_obj_t *tile, lv_style_t *style, lv_coord_t hre
lv_obj_align( wlan_password_pass_textfield, wlan_password_tile1, LV_ALIGN_IN_TOP_LEFT, 0, 75);
lv_obj_set_event_cb( wlan_password_pass_textfield, wlan_password_event_cb );
lv_obj_t *mac_label = lv_label_create( wlan_password_tile1, NULL);
lv_obj_add_style( mac_label, LV_IMGBTN_PART_MAIN, style);
lv_obj_set_width( mac_label, LV_HOR_RES);
lv_obj_align( mac_label, wlan_password_tile1, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_label_set_text_fmt( mac_label, "MAC: %s", WiFi.macAddress().c_str());
lv_obj_t *apply_btn = lv_imgbtn_create( wlan_password_tile1, NULL);
lv_imgbtn_set_src( apply_btn, LV_BTN_STATE_RELEASED, &check_32px);
lv_imgbtn_set_src( apply_btn, LV_BTN_STATE_PRESSED, &check_32px);

View File

@@ -222,7 +222,9 @@ void statusbar_wifi_set_state( bool state, const char *wifiname ) {
else {
lv_imgbtn_set_state( statusbar_wifi, LV_BTN_STATE_CHECKED_RELEASED );
}
lv_label_set_text( statusbar_wifilabel, wifiname );
lv_label_set_long_mode( statusbar_wifilabel, LV_LABEL_LONG_SROLL_CIRC);
lv_obj_set_width( statusbar_wifilabel, LV_HOR_RES);
lv_label_set_text( statusbar_wifilabel, wifiname);
lv_obj_align( statusbar_wifilabel, statusbar_wifi, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
statusbar_refresh();
}

View File

@@ -98,7 +98,13 @@ void wifictl_setup( void ) {
powermgm_clear_event( POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ON_REQUEST | POWERMGM_WIFI_SCAN );
statusbar_style_icon( STATUSBAR_WIFI, STATUSBAR_STYLE_WHITE );
statusbar_show_icon( STATUSBAR_WIFI );
statusbar_wifi_set_state( true, wifiname );
String label(wifiname);
label.concat(' ');
label.concat(WiFi.localIP().toString());
//If you want to see your IPv6 address too, uncomment this.
// label.concat('\n');
// label.concat(WiFi.localIPv6().toString());
statusbar_wifi_set_state( true, label.c_str() );
asyncwebserver_setup();
}, WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP );