Please enable JavaScript to view this site.

Waijung 2 User Guide

How this block appears in a Simulink model?

esp_log_1

What can be configured?

ESP LOG Setup block

Log to Serial Interface

esp_log_2

Log to SD card/SPIFFS with circular file system

esp_log_3

Log to SD card/SPIFFS without circular file system

esp_log_4

 

Configuration Parameter

Selectable Option/Value

Description

Log to

Serial interface--SD card--SPIFFS

Select where the messages/data should be logged to

Enable circular file system

Check--Uncheck

Enable or disable circular file system. If it is enable the data will be logged in to a circular file system with the given max file size, max files and prefix file name

File path

 

Select the full file path to log the data

Max file size(bytes)

 

Maximum size of a file in bytes

Max files

3 to 10

Select the maximum number file to be circulated

Prefix file name

 

The prefix name for the file system. The file name will be prefix_name_file number

Log timestamp

Milliseconds since boot--System time

Type of the time stamp whether it is in milliseconds or system time format

ESP LOG Write block

esp_log_5

Configuration Parameter

Selectable Option/Value

Description

Log level

Info--Warning--Error

Select the log level

Tag

 

Log system consists with three sections. Time stamp, Log tag and Log message.

(time stamp) log_tag : log_message

e.g. esp_log_6

Sample time

 

Set the sample time

INPUT Port

Port Name

Port Type

Date Type

Description

Message

Vector

uint8

Log message

ESP LOG Config block

INPUT Port

Port Name

Port Type

Date Type

Description

Max files

Scalar

int32

Configure the maximum number of files for the circular file system

Max file size

Scalar

int32

Maximum file size in bytes per file

When to use this block?

These blocks can be used to configure the ESP Log library to send log messages to serial monitor, to SD card or SPIFFS. If it is set to write the log messages tp SD card or SPIFFS, it can be write to s single file or it can be used as a circular file system. These block can be used not only to write new log messages but also direct all the log messages from the libraries to the preferred interface (Serial interface, SD card or SPIFFS).

How does this block work?

ESP LOG Setup block

This will initialize the log system according to the given configuration settings. The SD card setup block or SPIFFS setup block is required if it is set to SD card or SPIFFS

ESP LOG Write block

This will outputs the log message according to the selected interface

ESP LOG Config block

This block can only be used when log messages are sent to SD card or SPIFFS when the circular file system is enabled. This will change the maximum number of file and the maximum file size on the fly.

Demo1

Demo file: esp32_log_demo1.slx

esp_log_7

Description

This demo shows how to use String_processing_block to generate a string and log the messages to the serial monitor.

What should be happening?

The serial monitor(color messages will only on ESP32 serial monitor on CMD or on VS Code extension) shows information message, one warning message and one error message as below.

esp_log_9

Demo2

Demo file: esp32_log_demo2.slx

esp_log_8

Description

This demo shows how to use String_processing_block to generate a string and log the messages to the SD card. The log1.txt file will be created in /sdcard/log_wj2 folder path and all the log messages will be written to that file.

What should be happening?

After the model is successfully downloaded in to ESP32, wait about 10 seconds and remove the sd card. Plug into the computer and goto the above the above folder location and check the log1.txt file.

esp_log_10

Copyright 2024 Aimagin Co.,Ltd. Rev.1659