LCOV - code coverage report
Current view: top level - message - msg_recovery.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 33 0
Test Date: 2026-02-15 13:08:52 Functions: 0.0 % 4 0
Branches: 0.0 % 18 0

             Branch data     Line data    Source code
       1                 :             : #include <stdbool.h>
       2                 :             : #include <stdint.h>
       3                 :             : 
       4                 :             : #include "can.h"
       5                 :             : #include "message_types.h"
       6                 :             : #include "msg_common.h"
       7                 :             : #include "msg_recovery.h"
       8                 :             : 
       9                 :           0 : bool build_alt_arm_cmd_msg(can_msg_prio_t prio, uint16_t timestamp, can_altimeter_id_t alt_id,
      10                 :             :                                                    can_alt_arm_state_t arm_cmd, can_msg_t *output) {
      11         [ #  # ]:           0 :         if (!output) {
      12                 :             :                 return false;
      13                 :             :         }
      14                 :             : 
      15                 :           0 :         output->sid = build_sid(prio, MSG_ALT_ARM_CMD, alt_id);
      16                 :           0 :         write_timestamp(timestamp, output);
      17                 :             : 
      18                 :           0 :         output->data[2] = arm_cmd;
      19                 :           0 :         output->data_len = 3;
      20                 :             : 
      21                 :           0 :         return true;
      22                 :             : }
      23                 :             : 
      24                 :           0 : bool build_alt_arm_status_msg(can_msg_prio_t prio, uint16_t timestamp, can_altimeter_id_t alt_id,
      25                 :             :                                                           can_alt_arm_state_t arm_state, uint16_t v_drogue, uint16_t v_main,
      26                 :             :                                                           can_msg_t *output) {
      27         [ #  # ]:           0 :         if (!output) {
      28                 :             :                 return false;
      29                 :             :         }
      30                 :             : 
      31                 :           0 :         output->sid = build_sid(prio, MSG_ALT_ARM_STATUS, alt_id);
      32                 :           0 :         write_timestamp(timestamp, output);
      33                 :             : 
      34                 :           0 :         output->data[2] = arm_state;
      35                 :             :         // drogue voltage
      36                 :           0 :         output->data[3] = v_drogue >> 8; // 8 msb
      37                 :           0 :         output->data[4] = v_drogue & 0x00FF; // 8 lsb
      38                 :             :         // main voltage
      39                 :           0 :         output->data[5] = v_main >> 8; // 8 msb
      40                 :           0 :         output->data[6] = v_main & 0x00FF; // 8 lsb
      41                 :             : 
      42                 :           0 :         output->data_len = 7;
      43                 :             : 
      44                 :           0 :         return true;
      45                 :             : }
      46                 :             : 
      47                 :           0 : bool get_alt_arm_state(const can_msg_t *msg, can_altimeter_id_t *alt_id,
      48                 :             :                                            can_alt_arm_state_t *arm_state) {
      49   [ #  #  #  # ]:           0 :         if (!msg || !alt_id || !arm_state) {
      50                 :             :                 return false;
      51                 :             :         }
      52   [ #  #  #  # ]:           0 :         if ((get_message_type(msg) != MSG_ALT_ARM_CMD) &&
      53                 :           0 :                 (get_message_type(msg) != MSG_ALT_ARM_STATUS)) {
      54                 :             :                 return false;
      55                 :             :         }
      56                 :           0 :         *alt_id = get_message_metadata(msg);
      57                 :           0 :         *arm_state = msg->data[2];
      58                 :             : 
      59                 :           0 :         return true;
      60                 :             : }
      61                 :             : 
      62                 :           0 : bool get_pyro_voltage_data(const can_msg_t *msg, uint16_t *v_drogue, uint16_t *v_main) {
      63   [ #  #  #  # ]:           0 :         if (!msg || !v_drogue || !v_main) {
      64                 :             :                 return false;
      65                 :             :         }
      66         [ #  # ]:           0 :         if (get_message_type(msg) != MSG_ALT_ARM_STATUS) {
      67                 :             :                 return false;
      68                 :             :         }
      69                 :             : 
      70                 :           0 :         *v_drogue = (msg->data[3] << 8);
      71                 :           0 :         *v_drogue += msg->data[4];
      72                 :           0 :         *v_main = (msg->data[5] << 8);
      73                 :           0 :         *v_main += msg->data[6];
      74                 :             : 
      75                 :           0 :         return true;
      76                 :             : }
      77                 :             : 
        

Generated by: LCOV version 2.0-1