hopefully fix log messages
This commit is contained in:
parent
b9f937d78c
commit
d86cc50caf
@ -28,7 +28,7 @@ static bool buffer_message(const log_message_t* message) {
|
|||||||
if (message == NULL || message->message_length == 0) {
|
if (message == NULL || message->message_length == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have enough space - select the appropriate buffer */
|
/* Check if we have enough space - select the appropriate buffer */
|
||||||
uint32_t* write_pos = using_buffer_2 ? &message_buffer.write_pos_2 : &message_buffer.write_pos;
|
uint32_t* write_pos = using_buffer_2 ? &message_buffer.write_pos_2 : &message_buffer.write_pos;
|
||||||
|
|
||||||
@ -145,8 +145,10 @@ static void isotp_backend_write(const log_message_t *message) {
|
|||||||
|
|
||||||
/* Process buffered log messages and send them via ISO-TP */
|
/* Process buffered log messages and send them via ISO-TP */
|
||||||
void isotp_log_process(void) {
|
void isotp_log_process(void) {
|
||||||
/* Process ISO-TP updates to send any pending messages */
|
/* Check if we have data to send */
|
||||||
isotp_update();
|
if (message_buffer.write_pos > 0 || message_buffer.write_pos_2 > 0) {
|
||||||
|
isotp_backend_flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the ISO-TP backend */
|
/* Flush the ISO-TP backend */
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
#define MAX_MESSAGE_LENGTH 384
|
#define MAX_MESSAGE_LENGTH 384
|
||||||
#define USE_ANSI_ESCAPE_CODES true // if true, log messages will be colored according to their log level
|
#define USE_ANSI_ESCAPE_CODES false // if true, log messages will be colored according to their log level
|
||||||
#define PRINT_TIMESTAMP false // if true, timestamp (from HAL_GetTick) is printed before each log message
|
#define PRINT_TIMESTAMP false // if true, timestamp (from HAL_GetTick) is printed before each log message
|
||||||
|
|
||||||
/* Maximum number of backends that can be registered */
|
/* Maximum number of backends that can be registered */
|
||||||
|
@ -217,6 +217,7 @@ int main(void)
|
|||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
isotp_log_process();
|
||||||
isotp_update();
|
isotp_update();
|
||||||
//left over from slave communication test, could be nicer and in an additional function !!
|
//left over from slave communication test, could be nicer and in an additional function !!
|
||||||
if (error_count > 25) {
|
if (error_count > 25) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user