@@ -223,22 +223,38 @@ def update(self, CC, CS, now_nanos):
223
223
pump_on , self .last_pump_ts = brake_pump_hysteresis (apply_brake , self .apply_brake_last , self .last_pump_ts , ts )
224
224
225
225
pcm_override = True
226
- can_sends .append (hondacan .create_brake_command (self .packer , self .CAN , apply_brake , pump_on ,
226
+
227
+ stopping = actuators .longControlState == LongCtrlState .stopping
228
+ brake = np .clip (- brake , 0 , NIDEC_BRAKE_MAX )
229
+ can_sends .append (hondacan .create_brake_command (self .packer , self .CAN , brake , stopping ,
227
230
pcm_override , pcm_cancel_cmd , fcw_display ,
228
231
self .CP .carFingerprint , CS .stock_brake ))
232
+
233
+ # can_sends.append(hondacan.create_brake_command(self.packer, self.CAN, apply_brake, pump_on,
234
+ # pcm_override, pcm_cancel_cmd, fcw_display,
235
+ # self.CP.carFingerprint, CS.stock_brake))
236
+
237
+
229
238
self .apply_brake_last = apply_brake
230
239
self .brake = apply_brake / self .params .NIDEC_BRAKE_MAX
231
240
232
241
# Send dashboard UI commands.
233
242
# On Nidec, this controls longitudinal positive acceleration
234
243
if self .frame % 10 == 0 :
235
- hud = HUDData (int (pcm_accel ), int (round (hud_v_cruise )), hud_control .leadVisible ,
244
+ gas = np .clip ( gas , 0 , NIDEC_GAS_MAX )
245
+ hud = HUDData (int (gas ), int (round (hud_v_cruise )), hud_control .leadVisible ,
236
246
hud_control .lanesVisible , fcw_display , acc_alert , steer_required , hud_control .leadDistanceBars )
247
+ # hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible,
248
+ # hud_control.lanesVisible, fcw_display, acc_alert, steer_required, hud_control.leadDistanceBars)
249
+
237
250
can_sends .extend (hondacan .create_ui_commands (self .packer , self .CAN , self .CP , CC .enabled , pcm_speed , hud , CS .is_metric , CS .acc_hud , CS .lkas_hud ))
238
251
239
252
if self .CP .openpilotLongitudinalControl and self .CP .carFingerprint not in HONDA_BOSCH :
240
253
self .speed = pcm_speed
241
- self .gas = pcm_accel / self .params .NIDEC_GAS_MAX
254
+ self .gas = gas
255
+ self .brake = brake
256
+ # self.speed = pcm_speed
257
+ # self.gas = pcm_accel / self.params.NIDEC_GAS_MAX
242
258
243
259
new_actuators = actuators .as_builder ()
244
260
new_actuators .speed = self .speed
0 commit comments