Skip to content

Commit

Permalink
Added faults integer to health packet
Browse files Browse the repository at this point in the history
  • Loading branch information
robbederks committed Nov 27, 2019
1 parent 2a093a3 commit ca39a5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.6.6
v1.6.7
5 changes: 4 additions & 1 deletion board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ int get_health_pkt(void *dat) {
uint32_t can_send_errs_pkt;
uint32_t can_fwd_errs_pkt;
uint32_t gmlan_send_errs_pkt;
uint32_t faults_pkt;
uint8_t ignition_line_pkt;
uint8_t ignition_can_pkt;
uint8_t controls_allowed_pkt;
Expand Down Expand Up @@ -161,9 +162,11 @@ int get_health_pkt(void *dat) {
health->car_harness_status_pkt = car_harness_status;
health->usb_power_mode_pkt = usb_power_mode;
health->safety_mode_pkt = (uint8_t)(current_safety_mode);
health->fault_status_pkt = 0U; // TODO: populate this field
health->power_save_enabled_pkt = (uint8_t)(power_save_status == POWER_SAVE_STATUS_ENABLED);

health->fault_status_pkt = 0U; // TODO: populate this field
health->faults_pkt = 0U; // TODO: populate this field

return sizeof(*health);
}

Expand Down
23 changes: 12 additions & 11 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,25 @@ def call_control_api(self, msg):
# ******************* health *******************

def health(self):
dat = self._handle.controlRead(Panda.REQUEST_IN, 0xd2, 0, 0, 33)
a = struct.unpack("IIIIIIBBBBBBBBB", dat)
dat = self._handle.controlRead(Panda.REQUEST_IN, 0xd2, 0, 0, 37)
a = struct.unpack("IIIIIIIBBBBBBBBB", dat)
return {
"uptime": a[0],
"voltage": a[1],
"current": a[2],
"can_send_errs": a[3],
"can_fwd_errs": a[4],
"gmlan_send_errs": a[5],
"ignition_line": a[6],
"ignition_can": a[7],
"controls_allowed": a[8],
"gas_interceptor_detected": a[9],
"car_harness_status": a[10],
"usb_power_mode": a[11],
"safety_mode": a[12],
"fault_status": a[13],
"power_save_enabled": a[14]
"faults": a[6],
"ignition_line": a[7],
"ignition_can": a[8],
"controls_allowed": a[9],
"gas_interceptor_detected": a[10],
"car_harness_status": a[11],
"usb_power_mode": a[12],
"safety_mode": a[13],
"fault_status": a[14],
"power_save_enabled": a[15]
}

# ******************* control *******************
Expand Down

0 comments on commit ca39a5d

Please sign in to comment.