added new signal

This commit is contained in:
2024-05-28 04:21:39 +02:00
parent 766d5e9ca8
commit eb5733da97
6 changed files with 29 additions and 4 deletions

View File

@@ -245,7 +245,6 @@ void CarCanTask_func(void *argument) {
if (HAL_FDCAN_GetRxMessage(&hfdcan2, FDCAN_RX_FIFO1, &RxHeader, RxData) != HAL_OK) {
Error_Handler();
} else {
char msg[17] = {0};
Vehicle_Receive_CAN(RxHeader, RxData);

View File

@@ -58,6 +58,8 @@ bool Vehicle_isK15On() {
#include "CLS.h"
#include "CLS_BSP.h"
#include "CLSAddress.h"
@@ -73,6 +75,7 @@ void CLS_VehicleHeatbeat(void *argument) {
status.headlight = Vehicle_isHeadlightOn();
status.engine = Vehicle_isEngineRunning();
status.speed = (uint8_t)Vehicle_Speed();
status.unlocked = Vehicle_UnlockedSignal();
CLS_BSP_CAN_AddMessageToSend(&cls_vehicle_header, (uint8_t*)&status);

View File

@@ -19,4 +19,5 @@ void Vehicle_Receive_CAN( FDCAN_RxHeaderTypeDef header, uint8_t* data);
bool Vehicle_gotUnlockMessage();
uint8_t Vehicle_Brightness();
float Vehicle_Speed();
int Vehicle_DirectionIsForward();
int Vehicle_DirectionIsForward();
bool Vehicle_UnlockedSignal();

View File

@@ -107,4 +107,26 @@ float Vehicle_Speed() {
int Vehicle_DirectionIsForward() {
return car_can_direction == 0;
}
static bool unlocked = false;
bool Vehicle_UnlockedSignal() {
if (unlocked) {
if(Vehicle_isK15On()) {
unlocked = false;
last_unlock_message_time = UINT64_MAX;
}
}
if (!unlocked) {
if (Vehicle_gotUnlockMessage()) {
unlocked = true;
}
}
return unlocked;
}

2
proto

Submodule proto updated: 2142d03586...4ff29f9d5b