1515from openpilot .selfdrive .ui .mici .onroad .driver_camera_dialog import DriverCameraDialog
1616from openpilot .system .ui .widgets .label import gui_label
1717from openpilot .system .ui .lib .multilang import tr
18+ from openpilot .system .version import terms_version , training_version
1819
1920
2021class OnboardingState (IntEnum ):
@@ -60,7 +61,7 @@ def __init__(self, continue_callback):
6061 self ._title_header = TermsHeader ("welcome to openpilot" , gui_app .texture ("icons_mici/offroad_alerts/green_wheel.png" , 60 , 60 ))
6162
6263 self ._dm_label = UnifiedLabel ("Before we get on the road, let's review the " +
63- "functionality and limitations of openpilot." , 36 ,
64+ "functionality and limitations of openpilot." , 42 ,
6465 FontWeight .ROMAN )
6566
6667 @property
@@ -90,7 +91,7 @@ def __init__(self, continue_callback):
9091
9192 self ._dm_label = UnifiedLabel ("Next, we'll ensure comma four is mounted properly.\n \n If it does not have a clear view of the driver, " +
9293 "simply unplug and remount before continuing.\n \n " +
93- "NOTE: the driver camera will have a purple tint due to the IR illumination used for seeing at night." , 36 ,
94+ "NOTE: the driver camera will have a purple tint due to the IR illumination used for seeing at night." , 42 ,
9495 FontWeight .ROMAN )
9596
9697 def show_event (self ):
@@ -123,7 +124,14 @@ def __init__(self, continue_callback):
123124 super ().__init__ ()
124125 self ._title_header = TermsHeader ("fill the circle to continue" , gui_app .texture ("icons_mici/setup/green_dm.png" , 60 , 60 ))
125126
126- self ._dialog = DriverCameraSetupDialog (continue_callback )
127+ self ._original_continue_callback = continue_callback
128+
129+ # Wrap the continue callback to restore settings
130+ def wrapped_continue_callback ():
131+ self ._restore_settings ()
132+ continue_callback ()
133+
134+ self ._dialog = DriverCameraSetupDialog (wrapped_continue_callback )
127135
128136 # Disable driver monitoring model when device times out for inactivity
129137 def inactivity_callback ():
@@ -135,6 +143,13 @@ def show_event(self):
135143 super ().show_event ()
136144 self ._dialog .show_event ()
137145
146+ device .set_offroad_brightness (100 )
147+ device .reset_interactive_timeout (300 ) # 5 minutes
148+
149+ def _restore_settings (self ):
150+ device .set_offroad_brightness (None )
151+ device .reset_interactive_timeout ()
152+
138153 def _update_state (self ):
139154 super ()._update_state ()
140155 if device .awake :
@@ -168,7 +183,7 @@ def on_continue():
168183 self ._title_header = TermsHeader ("improve driver monitoring" , gui_app .texture ("icons_mici/setup/green_dm.png" , 60 , 60 ))
169184
170185 self ._dm_label = UnifiedLabel ("Help improve driver monitoring by including your driving data in the training data set. " +
171- "Your preference can be changed at any time in Settings. Would you like to share your data?" , 36 ,
186+ "Your preference can be changed at any time in Settings. Would you like to share your data?" , 42 ,
172187 FontWeight .ROMAN )
173188
174189 def show_event (self ):
@@ -200,7 +215,7 @@ class TrainingGuideAttentionNotice1(SetupTermsPage):
200215 def __init__ (self , continue_callback ):
201216 super ().__init__ (continue_callback , continue_text = "continue" )
202217 self ._title_header = TermsHeader ("not a self driving car" , gui_app .texture ("icons_mici/setup/warning.png" , 60 , 60 ))
203- self ._warning_label = UnifiedLabel ("THIS IS A DRIVER ASSISTANCE SYSTEM. A DRIVER ASSISTANCE SYSTEM IS NOT A SELF DRIVING CAR." , 36 ,
218+ self ._warning_label = UnifiedLabel ("THIS IS A DRIVER ASSISTANCE SYSTEM. A DRIVER ASSISTANCE SYSTEM IS NOT A SELF- DRIVING CAR." , 42 ,
204219 FontWeight .ROMAN )
205220
206221 @property
@@ -227,7 +242,8 @@ class TrainingGuideAttentionNotice2(SetupTermsPage):
227242 def __init__ (self , continue_callback ):
228243 super ().__init__ (continue_callback , continue_text = "continue" )
229244 self ._title_header = TermsHeader ("attention is required" , gui_app .texture ("icons_mici/setup/warning.png" , 60 , 60 ))
230- self ._warning_label = UnifiedLabel ("YOU MUST PAY ATTENTION AT ALL TIMES. YOU ARE FULLY RESPONSIBLE FOR DRIVING THE CAR." , 36 ,
245+ self ._warning_label = UnifiedLabel ("1. You must pay attention at all times.\n \n 2. You must be ready to take over at any time." +
246+ "\n \n 3. You are fully responsible for driving the car." , 42 ,
231247 FontWeight .ROMAN )
232248
233249 @property
@@ -255,7 +271,7 @@ def __init__(self, continue_callback):
255271 super ().__init__ (continue_callback , continue_text = "continue" )
256272 self ._title_header = TermsHeader ("disengaging openpilot" , gui_app .texture ("icons_mici/setup/green_pedal.png" , 60 , 60 ))
257273 self ._warning_label = UnifiedLabel ("You can disengage openpilot by either pressing the brake pedal or " +
258- "the cancel button on your steering wheel." , 36 ,
274+ "the cancel button on your steering wheel." , 42 ,
259275 FontWeight .ROMAN )
260276
261277 @property
@@ -288,7 +304,7 @@ def __init__(self, continue_callback):
288304
289305 self ._title_header = TermsHeader ("confidence ball" , gui_app .texture ("icons_mici/setup/green_car.png" , 60 , 60 ))
290306 self ._warning_label = UnifiedLabel ("The ball on the right communicates how confident openpilot " +
291- "is about the road scene at any given time." , 36 ,
307+ "is about the road scene at any given time." , 42 ,
292308 FontWeight .ROMAN )
293309
294310 def show_event (self ):
@@ -343,7 +359,7 @@ def __init__(self, continue_callback):
343359 self ._title_header = TermsHeader ("steering arc" , gui_app .texture ("icons_mici/offroad_alerts/green_wheel.png" , 60 , 60 ))
344360 self ._warning_label = UnifiedLabel ("All cars limit the amount of steering that openpilot is able to apply. While driving, the " +
345361 "steering arc shows the current amount of force being applied in relation to the maximum available to openpilot. " +
346- "You may need to assist if you see the arc nearing its orange state." , 36 ,
362+ "You may need to assist if you see the arc nearing its orange state." , 42 ,
347363 FontWeight .ROMAN )
348364
349365 def show_event (self ):
@@ -506,10 +522,8 @@ def _render_content(self, scroll_offset):
506522class OnboardingWindow (Widget ):
507523 def __init__ (self ):
508524 super ().__init__ ()
509- self ._current_terms_version = ui_state .params .get ("TermsVersion" )
510- self ._current_training_version = ui_state .params .get ("TrainingVersion" )
511- self ._accepted_terms : bool = ui_state .params .get ("HasAcceptedTerms" ) == self ._current_terms_version
512- self ._training_done : bool = ui_state .params .get ("CompletedTrainingVersion" ) == self ._current_training_version
525+ self ._accepted_terms : bool = ui_state .params .get ("HasAcceptedTerms" ) == terms_version
526+ self ._training_done : bool = ui_state .params .get ("CompletedTrainingVersion" ) == training_version
513527
514528 self ._state = OnboardingState .TERMS if not self ._accepted_terms else OnboardingState .ONBOARDING
515529
@@ -535,11 +549,11 @@ def close(self):
535549 gui_app .set_modal_overlay (None )
536550
537551 def _on_terms_accepted (self ):
538- ui_state .params .put ("HasAcceptedTerms" , self . _current_terms_version )
552+ ui_state .params .put ("HasAcceptedTerms" , terms_version )
539553 self ._state = OnboardingState .ONBOARDING
540554
541555 def _on_completed_training (self ):
542- ui_state .params .put ("CompletedTrainingVersion" , self . _current_training_version )
556+ ui_state .params .put ("CompletedTrainingVersion" , training_version )
543557 self .close ()
544558
545559 def _render (self , _ ):
0 commit comments