mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-26 16:12:06 +08:00
refactor logging
This commit is contained in:
+1
-2
@@ -211,8 +211,7 @@ struct CarControlSP @0xb86e6369214c01c8 {
|
||||
cruiseButton @1 :Int16;
|
||||
finalSpeedKph @2 :Float32;
|
||||
targetSpeed @3 :Float32;
|
||||
vSetDis @4 :Float32;
|
||||
buttonType @5 :Int16;
|
||||
vCruise @4 :Float32;
|
||||
|
||||
enum ButtonControlState {
|
||||
inactive @0; # No button press or default state
|
||||
|
||||
@@ -189,6 +189,8 @@ class Car:
|
||||
|
||||
car_control_sp_send = messaging.new_message('carControlSP')
|
||||
car_control_sp_send.valid = self.sm.all_checks(['carControl'])
|
||||
if not self.CP.pcmCruiseSpeed:
|
||||
car_control_sp_send.CustomStockLongitudinalControl = self.custom_stock_longitudinal_controller.state_publish()
|
||||
self.pm.send('carControlSP', car_control_sp_send)
|
||||
|
||||
def step(self):
|
||||
|
||||
@@ -288,8 +288,6 @@ class CarInterface(CarInterfaceBase):
|
||||
if self.CS.params_list.hyundai_radar_tracks_available and not self.CS.params_list.hyundai_radar_tracks_available_cache:
|
||||
events.add(car.CarEvent.EventName.hyundaiRadarTracksAvailable)
|
||||
|
||||
ret.customStockLong = self.update_custom_stock_long()
|
||||
|
||||
ret.events = events.to_msg()
|
||||
|
||||
return ret
|
||||
|
||||
@@ -54,6 +54,14 @@ class CustomStockLongitudinalControllerBase(ABC):
|
||||
ButtonControlState.loading: LoadingState(),
|
||||
}
|
||||
|
||||
def state_publish(self):
|
||||
customStockLongitudinalControl = custom.CarControlSP.CustomStockLongitudinalControl.new_message()
|
||||
customStockLongitudinalControl.state = self.button_state
|
||||
customStockLongitudinalControl.cruiseButton = 0 if self.cruise_button is None else int(self.cruise_button)
|
||||
customStockLongitudinalControl.finalSpeedKph = float(self.final_speed_kph)
|
||||
customStockLongitudinalControl.targetSpeed = float(self.target_speed)
|
||||
customStockLongitudinalControl.vCruise = float(self.v_cruise)
|
||||
|
||||
def get_set_speed_buttons(self, CS: car.CarState) -> bool:
|
||||
return any(be.type in self.set_speed_buttons for be in CS.out.buttonEvents)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user