From ff2fd2288a27d1dd894ea467a33ef3416cf15cfd Mon Sep 17 00:00:00 2001 From: Rakshita Date: Mon, 16 Dec 2024 17:07:07 +0530 Subject: [PATCH] fix: Corrected relay order for 9-bit status word - Reversed the relay order to align with the correct mapping. - Bit 0 now corresponds to `charger1_en` instead of `charger9_en`. --- ivec_ECU/ivec_ecu_uart/src/ivec_ecu_uart.c | 2 +- ivec_RTE/src/ivec_rte.c | 16 ++++++++-------- utils/utils.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ivec_ECU/ivec_ecu_uart/src/ivec_ecu_uart.c b/ivec_ECU/ivec_ecu_uart/src/ivec_ecu_uart.c index 1c3588e..dd18754 100644 --- a/ivec_ECU/ivec_ecu_uart/src/ivec_ecu_uart.c +++ b/ivec_ECU/ivec_ecu_uart/src/ivec_ecu_uart.c @@ -1,7 +1,7 @@ #include "../ivec_ECU/ivec_ecu_uart/inc/ivec_ecu_uart.h" #include "ivec_cmplx_queue.h" #include "../Core/Include/ivec_mcal_uart.h" -#include <..\Core\Include\ivec_mcal_timer.h> +//#include <..\Core\Include\ivec_mcal_timer.h> //#include "ivec_mcal_uart.h" #define LOG_STRING "ivec-ecu-UART" diff --git a/ivec_RTE/src/ivec_rte.c b/ivec_RTE/src/ivec_rte.c index 753ddf7..89e5b7e 100644 --- a/ivec_RTE/src/ivec_rte.c +++ b/ivec_RTE/src/ivec_rte.c @@ -489,31 +489,31 @@ void control_relays(uint16_t relay_status) // Check each bit of relay_status and set the corresponding relay pin if ((relay_status & 0x01) != 0) { // Bit 0: Relay 1 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_1_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_9_PIN); } if ((relay_status & 0x02) != 0) { // Bit 1: Relay 2 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_2_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_8_PIN); } if ((relay_status & 0x04) != 0) { // Bit 2: Relay 3 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_3_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_7_PIN); } if ((relay_status & 0x08) != 0) { // Bit 3: Relay 4 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_4_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_6_PIN); } if ((relay_status & 0x10) != 0) { // Bit 4: Relay 5 DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_5_PIN); } if ((relay_status & 0x20) != 0) { // Bit 5: Relay 6 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_6_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_4_PIN); } if ((relay_status & 0x40) != 0) { // Bit 6: Relay 7 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_7_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_3_PIN); } if ((relay_status & 0x80) != 0) { // Bit 7: Relay 8 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_8_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_2_PIN); } if ((relay_status & 0x100) != 0) { // Bit 8: Relay 9 - DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_9_PIN); + DL_GPIO_setPins(GPIOB, GPIO_relay_pin_relay_1_PIN); } } diff --git a/utils/utils.h b/utils/utils.h index 1dcf443..3b77902 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -38,7 +38,7 @@ typedef enum // 1 - Basil Battery Smart // 2 - Basil // 3 - Battery Swapping Station -#define UART_PIN_SELECTION 3 // Set the desired UART configuration here +#define UART_PIN_SELECTION 2 // Set the desired UART configuration here volatile int i32TickCnt;