mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 11:23:55 +08:00
boardd: add controls heartbeat (#23185)
* boardd: add controls heartbeat * bump panda * bump again * bump panda
This commit is contained in:
+1
-1
Submodule panda updated: 652367d2e8...6f95a096e6
@@ -411,6 +411,8 @@ void panda_state_thread(PubMaster *pm, std::vector<Panda *> pandas, bool spoofin
|
||||
util::set_thread_name("boardd_panda_state");
|
||||
|
||||
Params params;
|
||||
SubMaster sm({"controlsState"});
|
||||
|
||||
Panda *peripheral_panda = pandas[0];
|
||||
bool ignition_last = false;
|
||||
std::future<bool> safety_future;
|
||||
@@ -445,8 +447,11 @@ void panda_state_thread(PubMaster *pm, std::vector<Panda *> pandas, bool spoofin
|
||||
|
||||
ignition_last = ignition;
|
||||
|
||||
sm.update(0);
|
||||
const bool engaged = sm.allAliveAndValid({"controlsState"}) && sm["controlsState"].getControlsState().getEnabled();
|
||||
|
||||
for (const auto &panda : pandas) {
|
||||
panda->send_heartbeat();
|
||||
panda->send_heartbeat(engaged);
|
||||
}
|
||||
util::sleep_for(500);
|
||||
}
|
||||
|
||||
@@ -340,8 +340,8 @@ void Panda::set_usb_power_mode(cereal::PeripheralState::UsbPowerMode power_mode)
|
||||
usb_write(0xe6, (uint16_t)power_mode, 0);
|
||||
}
|
||||
|
||||
void Panda::send_heartbeat() {
|
||||
usb_write(0xf3, 1, 0);
|
||||
void Panda::send_heartbeat(bool engaged) {
|
||||
usb_write(0xf3, engaged, 0);
|
||||
}
|
||||
|
||||
void Panda::set_can_speed_kbps(uint16_t bus, uint16_t speed) {
|
||||
|
||||
@@ -108,7 +108,7 @@ class Panda {
|
||||
std::optional<std::string> get_serial();
|
||||
void set_power_saving(bool power_saving);
|
||||
void set_usb_power_mode(cereal::PeripheralState::UsbPowerMode power_mode);
|
||||
void send_heartbeat();
|
||||
void send_heartbeat(bool engaged);
|
||||
void set_can_speed_kbps(uint16_t bus, uint16_t speed);
|
||||
void set_data_speed_kbps(uint16_t bus, uint16_t speed);
|
||||
void can_send(capnp::List<cereal::CanData>::Reader can_data_list);
|
||||
|
||||
Reference in New Issue
Block a user