Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.
This repository was archived by the owner on May 26, 2025. It is now read-only.

Log System #39

@jia-xie

Description

@jia-xie

Add customized log logic. Possible interface could be:

Log_Info("msg");
Log_Error("msg");
Log_Warning("msg");

The log system gives detialed runtime information and therefore with help with debug. Some examples:

Consider a logic that waits for CAN bus mailbox availability, if the wait time exceeds threshold, it means something goes wrong. The only noticeable behavior in such case might just be a non-working motor. However given only the external behavior would be hard to precisely and efficiently locate the issue.

This is how it used to be like

while (HAL_CAN_GetTxMailboxesFreeLevel(&hcan2) == 0);

possible implementation of logging system

while (HAL_CAN_GetTxMailboxesFreeLevel(&hcan2) == 0) {
    Log_Warning("[can bsp] can mailbox full. CAN send data pending.");
    if (pending_time > PENDING_ERROR_THRESHOLD_TIME) {
        Log_Error("[can bsp] can mailbox is really unhappy for %f s.", pending_time);
    }
}

another example would be receiving CAN frame with unregistered CAN id

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions