UveosOnNation_VEGA_Can/CanMain.h

108 lines
2.8 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Created by cfif on 21.02.2025.
//
#ifndef UVEOS_ON_NATION_CANMAIN_H
#define UVEOS_ON_NATION_CANMAIN_H
#include "CmsisRtosThreadUtils.h"
#include "SerialPortFrameIO.h"
#include "LoggerInterface.h"
#include "LoggerToSerialPort.h"
#define NUM_ACC_COUNT_MAX (5)
typedef struct {
volatile uint32_t engineSpeed; //обороты двигателя
volatile uint8_t engineOXTemperature; // Температура ОХ двигателя
volatile float externalTemperature; // Внешняя температура, С
volatile uint8_t fuelLevel; // Уровень топлива, л
volatile uint8_t engineHours; // Моточасы
volatile uint8_t speed; // Скорость
volatile uint8_t tripSpentFuel; // Ср. расход за поездку
volatile uint16_t numberAccelerations; // Количество ускорений за поездку
volatile uint16_t numberBraking;// Количество торможений за поездку
uint16_t ABS_VehicleSpeed;
} tCanData;
typedef struct {
tSerialPortFrameIO *CanIO;
tLoggerToSerialPort *slog;
tCanData canData;
tStaticThreadBlock(512) T_can_Main;
} tCanMain;
typedef struct {
tSerialPortFrameIO *CanIO;
tLoggerToSerialPort *slog;
uint8_t filterIdCount;
uint32_t filterReqId[16];
uint32_t filterRespId[16];
uint8_t filterDirReq[16];
uint32_t EngineSpeed;
uint32_t timeID;
uint32_t time380_1;
uint32_t time380_2;
uint32_t time3E8_1;
uint32_t time3E8_2;
uint32_t timeCan;
uint8_t RND;
bool invalidKey;
uint8_t invalidKeyAttempts;
uint32_t invalidKeyIsDelay;
tCanMain *canMain;
uint32_t timeAbsSpeedOnSecond;
uint32_t timeAbsSpeed;
uint32_t Counter_SENSORS_AN_TripMileage_MM;
uint32_t Counter_SENSORS_AN_TripMileage_MICRO_L;
struct {
float acc_last[NUM_ACC_COUNT_MAX];
uint8_t index;
float old_speed;
bool data_erase;
} calc_scoring;
struct {
uint32_t acc_calc_time;
uint32_t gnss_course_speed;
uint32_t reference_speed;
uint32_t diff_speed_up;
uint32_t diff_speed_down;
} gnss_config;
struct {
uint32_t trip_braking;
uint32_t trip_acceleration;
} state_get;
struct {
uint32_t total_acceleration;
uint32_t acceleration;
uint32_t total_braking;
uint32_t braking;
} bc_get;
uint32_t isTimeSENSORS_DIG_BodyCanBusStatus;
void *envEgtsProcessing;
bool *isEnableTelematicaSendPoints;
tStaticThreadBlock(1024) T_can_MainAdditional;
} tCanMainAdditional;
void CanMain_Init(
tCanMain *env,
tSerialPortFrameIO *CanIO,
tLoggerToSerialPort *slog
);
void CanMain_Start(tCanMain *env);
#endif //UVEOS_ON_NATION_CANMAIN_H