added new signal
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user