added Function to create CAN-Traces from WebUI
Some checks failed
CI-Build/Kettenoeler/pipeline/head There was a failure building this commit
Some checks failed
CI-Build/Kettenoeler/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -23,9 +23,23 @@ struct CanHalConfig {
|
||||
// ==== Universeller Filter-Descriptor ====
|
||||
struct CanFilter {
|
||||
uint32_t id; // 11-bit oder 29-bit Roh-ID
|
||||
bool ext; // false=STD(11-bit), true=EXT(29-bit)
|
||||
bool ext; // false = STD(11-bit), true = EXT(29-bit)
|
||||
};
|
||||
|
||||
// =====================
|
||||
// Trace / Logging Types
|
||||
// =====================
|
||||
struct CanLogFrame {
|
||||
uint32_t ts_ms;
|
||||
uint32_t id;
|
||||
bool ext;
|
||||
bool rx; // true = RX, false = TX
|
||||
uint8_t dlc;
|
||||
uint8_t data[8];
|
||||
};
|
||||
|
||||
using CanTraceSink = void (*)(const CanLogFrame& f);
|
||||
|
||||
// ==== API ====
|
||||
|
||||
// 1) Einmalige Hardware-Initialisierung + integrierter Loopback-Selftest.
|
||||
@@ -51,9 +65,14 @@ bool CAN_HAL_AddFilter(const CanFilter& f);
|
||||
bool CAN_HAL_SetFilters(const CanFilter* list, size_t count);
|
||||
|
||||
// Non-blocking IO
|
||||
bool CAN_HAL_Read(unsigned long& id, uint8_t& len, uint8_t data[8]); // true=Frame gelesen
|
||||
bool CAN_HAL_Read(unsigned long& id, uint8_t& len, uint8_t data[8]); // true = Frame gelesen
|
||||
uint8_t CAN_HAL_Send(unsigned long id, bool ext, uint8_t len, const uint8_t* data); // CAN_OK bei Erfolg
|
||||
|
||||
// Diagnose/Utilities (nutzen MCP-APIs)
|
||||
uint8_t CAN_HAL_GetErrorFlags(); // Intern: getError()
|
||||
// Diagnose/Utilities
|
||||
uint8_t CAN_HAL_GetErrorFlags(); // Intern: getError()
|
||||
void CAN_HAL_GetErrorCounters(uint8_t& tec, uint8_t& rec); // TX/RX Error Counter
|
||||
|
||||
// Trace / Sniffer
|
||||
void CAN_HAL_SetTraceSink(CanTraceSink sink);
|
||||
void CAN_HAL_EnableRawSniffer(bool enable);
|
||||
bool CAN_HAL_IsRawSnifferEnabled();
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include "can_hal.h"
|
||||
|
||||
// Initialisiert das OBD2-CAN-Profil:
|
||||
// - setzt Masken/Filter für 0x7E8..0x7EF (ECU-Antworten)
|
||||
|
@@ -46,4 +46,6 @@ void Webserver_Shutdown();
|
||||
void Websocket_PushLiveDebug(String Message);
|
||||
void Websocket_PushNotification(String Message, NotificationType_t type);
|
||||
|
||||
void TRACE_OnObdFrame(uint32_t id, bool rx, const uint8_t *d, uint8_t dlc, const char *note);
|
||||
|
||||
#endif // _WEBUI_H_
|
||||
|
Reference in New Issue
Block a user