add safetyParam to health (#633)

* add safetyParam to health

* move copies together
master
Willem Melching 2021-03-17 14:19:22 +01:00 committed by GitHub
parent 9108b82fb0
commit d572c012cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -58,6 +58,7 @@ struct __attribute__((packed)) health_t {
uint8_t car_harness_status_pkt;
uint8_t usb_power_mode_pkt;
uint8_t safety_mode_pkt;
int16_t safety_param_pkt;
uint8_t fault_status_pkt;
uint8_t power_save_enabled_pkt;
};
@ -179,6 +180,7 @@ 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->safety_param_pkt = current_safety_param;
health->power_save_enabled_pkt = (uint8_t)(power_save_status == POWER_SAVE_STATUS_ENABLED);
health->fault_status_pkt = fault_status;

View File

@ -41,6 +41,7 @@
#define SAFETY_HYUNDAI_COMMUNITY 24U
uint16_t current_safety_mode = SAFETY_SILENT;
int16_t current_safety_param = 0;
const safety_hooks *current_hooks = &nooutput_hooks;
int safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push){
@ -291,7 +292,8 @@ int set_safety_hooks(uint16_t mode, int16_t param) {
for (int i = 0; i < hook_config_count; i++) {
if (safety_hook_registry[i].id == mode) {
current_hooks = safety_hook_registry[i].hooks;
current_safety_mode = safety_hook_registry[i].id;
current_safety_mode = mode;
current_safety_param = param;
set_status = 0; // set
}