mirror of https://github.com/commaai/panda.git
enable misra-c2012-10.4 (#1796)
* enable misrac-10.4 * changes * cleaner
This commit is contained in:
parent
3ef9c3f9ef
commit
817d68f6a6
|
@ -112,7 +112,9 @@ void process_can(uint8_t can_number) {
|
|||
fifo = (canfd_fifo *)(TxFIFOSA + (tx_index * FDCAN_TX_FIFO_EL_SIZE));
|
||||
|
||||
fifo->header[0] = (to_send.extended << 30) | ((to_send.extended != 0U) ? (to_send.addr) : (to_send.addr << 18));
|
||||
fifo->header[1] = (to_send.data_len_code << 16) | (bus_config[can_number].canfd_enabled << 21) | (bus_config[can_number].brs_enabled << 20);
|
||||
uint32_t canfd_enabled_header = bus_config[can_number].canfd_enabled ? (1 << 21) : 0;
|
||||
uint32_t brs_enabled_header = bus_config[can_number].brs_enabled ? (1 << 20) : 0;
|
||||
fifo->header[1] = (to_send.data_len_code << 16) | canfd_enabled_header | brs_enabled_header;
|
||||
|
||||
uint8_t data_len_w = (dlc_to_len[to_send.data_len_code] / 4U);
|
||||
data_len_w += ((dlc_to_len[to_send.data_len_code] % 4U) > 0U) ? 1U : 0U;
|
||||
|
|
|
@ -22,7 +22,7 @@ int do_bitstuff(char *out, char *in, int in_len) {
|
|||
j++;
|
||||
|
||||
// do the stuffing
|
||||
if (bit == last_bit) {
|
||||
if (bit == (char)last_bit) {
|
||||
bit_cnt++;
|
||||
if (bit_cnt == 5) {
|
||||
// 5 in a row the same, do stuff
|
||||
|
@ -205,7 +205,7 @@ void TIM12_IRQ_Handler(void) {
|
|||
bool retry = 0;
|
||||
// in send loop
|
||||
if ((gmlan_sending > 0) && // not first bit
|
||||
((read == 0) && (pkt_stuffed[gmlan_sending-1] == 1)) && // bus wrongly dominant
|
||||
((read == 0) && (pkt_stuffed[gmlan_sending-1] == (char)1)) && // bus wrongly dominant
|
||||
(gmlan_sending != (gmlan_sendmax - 11))) { //not ack bit
|
||||
print("GMLAN ERR: bus driven at ");
|
||||
puth(gmlan_sending);
|
||||
|
|
|
@ -39,7 +39,7 @@ void set_intercept_relay(bool intercept, bool ignition_relay) {
|
|||
}
|
||||
|
||||
// wait until we're not reading the analog voltages anymore
|
||||
while (harness.sbu_adc_lock == true) {}
|
||||
while (harness.sbu_adc_lock) {}
|
||||
|
||||
if (harness.status == HARNESS_STATUS_NORMAL) {
|
||||
set_gpio_output(current_board->harness_config->GPIO_relay_SBU1, current_board->harness_config->pin_relay_SBU1, !ignition_relay);
|
||||
|
@ -59,7 +59,7 @@ bool harness_check_ignition(void) {
|
|||
bool ret = false;
|
||||
|
||||
// wait until we're not reading the analog voltages anymore
|
||||
while (harness.sbu_adc_lock == true) {}
|
||||
while (harness.sbu_adc_lock) {}
|
||||
|
||||
switch(harness.status){
|
||||
case HARNESS_STATUS_NORMAL:
|
||||
|
|
|
@ -104,7 +104,7 @@ static bool nissan_tx_hook(CANPacket_t *to_send) {
|
|||
bool lka_active = (GET_BYTE(to_send, 6) >> 4) & 1U;
|
||||
|
||||
// Factor is -0.01, offset is 1310. Flip to correct sign, but keep units in CAN scale
|
||||
desired_angle = -desired_angle + (1310 * NISSAN_STEERING_LIMITS.angle_deg_to_can);
|
||||
desired_angle = -desired_angle + (1310.0f * NISSAN_STEERING_LIMITS.angle_deg_to_can);
|
||||
|
||||
if (steer_angle_cmd_checks(desired_angle, lka_active, NISSAN_STEERING_LIMITS)) {
|
||||
violation = true;
|
||||
|
|
|
@ -37,7 +37,6 @@ misra-c2012-8.6
|
|||
misra-c2012-10.1
|
||||
misra-c2012-10.6
|
||||
misra-c2012-10.3
|
||||
misra-c2012-10.4
|
||||
misra-c2012-10.5
|
||||
misra-c2012-10.7
|
||||
misra-c2012-12.2
|
||||
|
|
Loading…
Reference in New Issue