@@ -413,7 +413,7 @@ def load_config():
413413 except Exception as e :
414414 print ("exception config load failed!" , e )
415415
416- def get_ip_name ():
416+ def get_ip_address ():
417417 ip_str = subprocess .getoutput ("timeout 1 hostname -I" )
418418 ip_list = [x for x in ip_str .split (' ' ) if '.' in x ]
419419 if len (ip_list ) == 0 :
@@ -507,7 +507,7 @@ def display_page(self, level, page):
507507 else :
508508 draw .text ((0 , 0 ), f"{ self .pb_info ['full_name' ]} " , font = usb4vc_oled .font_regular , fill = "white" )
509509 draw .text ((0 , 10 ), f"PB { self .pb_info ['fw_ver' ][0 ]} .{ self .pb_info ['fw_ver' ][1 ]} .{ self .pb_info ['fw_ver' ][2 ]} RPi { usb4vc_shared .RPI_APP_VERSION_TUPLE [0 ]} .{ usb4vc_shared .RPI_APP_VERSION_TUPLE [1 ]} .{ usb4vc_shared .RPI_APP_VERSION_TUPLE [2 ]} " , font = usb4vc_oled .font_regular , fill = "white" )
510- draw .text ((0 , 20 ), f"IP: { get_ip_name ()} " , font = usb4vc_oled .font_regular , fill = "white" )
510+ draw .text ((0 , 20 ), f"IP: { get_ip_address ()} " , font = usb4vc_oled .font_regular , fill = "white" )
511511 if page == 2 :
512512 with canvas (usb4vc_oled .oled_device ) as draw :
513513 usb4vc_oled .oled_print_centered ("Load Custom" , usb4vc_oled .font_medium , 0 , draw )
@@ -802,7 +802,8 @@ def action(self, level, page):
802802 os ._exit (0 )
803803 if page == 2 :
804804 with canvas (usb4vc_oled .oled_device ) as draw :
805- usb4vc_oled .oled_print_centered ("Rebooting..." , usb4vc_oled .font_medium , 10 , draw )
805+ usb4vc_oled .oled_print_centered ("Rebooting..." , usb4vc_oled .font_medium , 0 , draw )
806+ usb4vc_oled .oled_print_centered ("Unplug if stuck >10s" , usb4vc_oled .font_regular , 16 , draw )
806807 os .system ("sudo reboot" )
807808 while 1 :
808809 time .sleep (1 )
@@ -814,7 +815,7 @@ def action(self, level, page):
814815 self .display_curent_page ()
815816
816817 def action_current_page (self ):
817- self .action (self .current_level , self .current_page );
818+ self .action (self .current_level , self .current_page )
818819
819820 def display_curent_page (self ):
820821 self .display_page (self .current_level , self .current_page )
@@ -823,6 +824,10 @@ def update_usb_status(self):
823824 if self .current_level == 0 and self .current_page == 0 :
824825 self .display_page (0 , 0 )
825826
827+ def update_board_status (self ):
828+ if self .current_level == 0 and self .current_page == 1 :
829+ self .display_page (0 , 1 )
830+
826831pboard_database = {
827832 PBOARD_ID_UNKNOWN :{'author' :'Unknown' , 'fw_ver' :(0 ,0 ,0 ), 'full_name' :'Unknown' , 'hw_rev' :0 , 'protocol_list_keyboard' :raw_keyboard_protocols , 'protocol_list_mouse' :raw_mouse_protocols , 'protocol_list_gamepad' :raw_gamepad_protocols },
828833 PBOARD_ID_IBMPC :{'author' :'dekuNukem' , 'fw_ver' :(0 ,0 ,0 ), 'full_name' :'IBM PC Compatible' , 'hw_rev' :0 , 'protocol_list_keyboard' :ibmpc_keyboard_protocols , 'protocol_list_mouse' :ibmpc_mouse_protocols , 'protocol_list_gamepad' :ibmpc_gamepad_protocols },
@@ -912,7 +917,8 @@ def ui_worker():
912917 time .sleep (0.1 )
913918 my_oled .ui_loop_count += 1
914919 if my_oled .is_sleeping is False and my_oled .ui_loop_count % 5 == 0 :
915- my_menu .update_usb_status ();
920+ my_menu .update_usb_status ()
921+ my_menu .update_board_status ()
916922
917923 if plus_button .is_pressed ():
918924 my_oled .kick ()
@@ -962,4 +968,9 @@ def oled_print_oneline(msg):
962968 with canvas (usb4vc_oled .oled_device ) as draw :
963969 usb4vc_oled .oled_print_centered (msg , usb4vc_oled .font_medium , 10 , draw )
964970
971+ def oled_print_reboot ():
972+ with canvas (usb4vc_oled .oled_device ) as draw :
973+ usb4vc_oled .oled_print_centered ("Done! Rebooting.." , usb4vc_oled .font_medium , 0 , draw )
974+ usb4vc_oled .oled_print_centered ("Unplug if stuck >10s" , usb4vc_oled .font_regular , 16 , draw )
975+
965976ui_thread = threading .Thread (target = ui_worker , daemon = True )
0 commit comments