@@ -413,7 +413,7 @@ def load_config():
413
413
except Exception as e :
414
414
print ("exception config load failed!" , e )
415
415
416
- def get_ip_name ():
416
+ def get_ip_address ():
417
417
ip_str = subprocess .getoutput ("timeout 1 hostname -I" )
418
418
ip_list = [x for x in ip_str .split (' ' ) if '.' in x ]
419
419
if len (ip_list ) == 0 :
@@ -507,7 +507,7 @@ def display_page(self, level, page):
507
507
else :
508
508
draw .text ((0 , 0 ), f"{ self .pb_info ['full_name' ]} " , font = usb4vc_oled .font_regular , fill = "white" )
509
509
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" )
511
511
if page == 2 :
512
512
with canvas (usb4vc_oled .oled_device ) as draw :
513
513
usb4vc_oled .oled_print_centered ("Load Custom" , usb4vc_oled .font_medium , 0 , draw )
@@ -802,7 +802,8 @@ def action(self, level, page):
802
802
os ._exit (0 )
803
803
if page == 2 :
804
804
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 )
806
807
os .system ("sudo reboot" )
807
808
while 1 :
808
809
time .sleep (1 )
@@ -814,7 +815,7 @@ def action(self, level, page):
814
815
self .display_curent_page ()
815
816
816
817
def action_current_page (self ):
817
- self .action (self .current_level , self .current_page );
818
+ self .action (self .current_level , self .current_page )
818
819
819
820
def display_curent_page (self ):
820
821
self .display_page (self .current_level , self .current_page )
@@ -823,6 +824,10 @@ def update_usb_status(self):
823
824
if self .current_level == 0 and self .current_page == 0 :
824
825
self .display_page (0 , 0 )
825
826
827
+ def update_board_status (self ):
828
+ if self .current_level == 0 and self .current_page == 1 :
829
+ self .display_page (0 , 1 )
830
+
826
831
pboard_database = {
827
832
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 },
828
833
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():
912
917
time .sleep (0.1 )
913
918
my_oled .ui_loop_count += 1
914
919
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 ()
916
922
917
923
if plus_button .is_pressed ():
918
924
my_oled .kick ()
@@ -962,4 +968,9 @@ def oled_print_oneline(msg):
962
968
with canvas (usb4vc_oled .oled_device ) as draw :
963
969
usb4vc_oled .oled_print_centered (msg , usb4vc_oled .font_medium , 10 , draw )
964
970
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
+
965
976
ui_thread = threading .Thread (target = ui_worker , daemon = True )
0 commit comments