added new signal
This commit is contained in:
Submodule Application/CLS updated: 4620d0a7ed...4744762b4c
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
@@ -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
2
proto
Submodule proto updated: 2142d03586...4ff29f9d5b
Reference in New Issue
Block a user