mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-24 07:13:53 +08:00
turn pigeon off when going offroad (#20296)
* cleanup * power off pigeon * comment Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -363,7 +363,7 @@ void panda_state_thread(bool spoofing_started) {
|
||||
ps.setIgnitionCan(pandaState.ignition_can);
|
||||
ps.setControlsAllowed(pandaState.controls_allowed);
|
||||
ps.setGasInterceptorDetected(pandaState.gas_interceptor_detected);
|
||||
ps.setHasGps(panda->is_pigeon);
|
||||
ps.setHasGps(true);
|
||||
ps.setCanRxErrs(pandaState.can_rx_errs);
|
||||
ps.setCanSendErrs(pandaState.can_send_errs);
|
||||
ps.setCanFwdErrs(pandaState.can_fwd_errs);
|
||||
@@ -472,16 +472,13 @@ static void pigeon_publish_raw(PubMaster &pm, const std::string &dat) {
|
||||
}
|
||||
|
||||
void pigeon_thread() {
|
||||
if (!panda->is_pigeon) { return; };
|
||||
|
||||
// ubloxRaw = 8042
|
||||
PubMaster pm({"ubloxRaw"});
|
||||
bool ignition_last = false;
|
||||
|
||||
#ifdef QCOM2
|
||||
Pigeon * pigeon = Pigeon::connect("/dev/ttyHS0");
|
||||
Pigeon *pigeon = Pigeon::connect("/dev/ttyHS0");
|
||||
#else
|
||||
Pigeon * pigeon = Pigeon::connect(panda);
|
||||
Pigeon *pigeon = Pigeon::connect(panda);
|
||||
#endif
|
||||
|
||||
std::unordered_map<char, uint64_t> last_recv_time;
|
||||
@@ -535,6 +532,10 @@ void pigeon_thread() {
|
||||
for (const auto& [msg_cls, dt] : cls_max_dt) {
|
||||
last_recv_time[msg_cls] = t;
|
||||
}
|
||||
} else if (!ignition && ignition_last) {
|
||||
// power off on falling edge of ignition
|
||||
LOGD("powering off pigeon\n");
|
||||
pigeon->set_power(false);
|
||||
}
|
||||
|
||||
ignition_last = ignition;
|
||||
|
||||
@@ -52,13 +52,12 @@ Panda::Panda(){
|
||||
if (err != 0) { goto fail; }
|
||||
|
||||
hw_type = get_hw_type();
|
||||
is_pigeon =
|
||||
(hw_type == cereal::PandaState::PandaType::GREY_PANDA) ||
|
||||
(hw_type == cereal::PandaState::PandaType::BLACK_PANDA) ||
|
||||
(hw_type == cereal::PandaState::PandaType::UNO) ||
|
||||
(hw_type == cereal::PandaState::PandaType::DOS);
|
||||
|
||||
assert((hw_type != cereal::PandaState::PandaType::WHITE_PANDA) &&
|
||||
(hw_type != cereal::PandaState::PandaType::GREY_PANDA));
|
||||
|
||||
has_rtc = (hw_type == cereal::PandaState::PandaType::UNO) ||
|
||||
(hw_type == cereal::PandaState::PandaType::DOS);
|
||||
(hw_type == cereal::PandaState::PandaType::DOS);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ class Panda {
|
||||
|
||||
std::atomic<bool> connected = true;
|
||||
cereal::PandaState::PandaType hw_type = cereal::PandaState::PandaType::UNKNOWN;
|
||||
bool is_pigeon = false;
|
||||
bool has_rtc = false;
|
||||
|
||||
// HW communication
|
||||
|
||||
@@ -133,7 +133,6 @@ void TTYPigeon::connect(const char * tty) {
|
||||
if (pigeon_tty_fd < 0){
|
||||
handle_tty_issue(errno, __func__);
|
||||
assert(pigeon_tty_fd >= 0);
|
||||
|
||||
}
|
||||
int err = tcgetattr(pigeon_tty_fd, &pigeon_tty);
|
||||
assert(err == 0);
|
||||
|
||||
Reference in New Issue
Block a user