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`.
stable
Rakshita 2024-12-16 17:07:07 +05:30
parent 9bf10d7bef
commit ff2fd2288a
3 changed files with 10 additions and 10 deletions

View File

@ -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"

View File

@ -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);
}
}

View File

@ -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;