SBB Micro
Source code for the self-balancing-bike microcontroller unit (Teensy 4.1-based). 🚀️
Loading...
Searching...
No Matches
logger.h File Reference

Definitions of logger functions and variables. More...

Go to the source code of this file.

Macros

#define DOLOG   1
 Enable or disable logging (1/0).
 
#define LOG_SAMPLING_FAC   1
 Sampling factor of data logging (expressed in units of SAMPLING_TIME).
 
#define sd   SD.sdfs
 SD fat object (uses sd fat included in SD library).
 
#define SD_CONFIG   SdioConfig(FIFO_SDIO)
 Configuration type of sd card.
 
#define PREALLOC   1024L*1024L*1024L
 Log file preallocation (in bytes).
 
#define DATAPACKET_SIZE   sizeof(float)*64
 Size of logged data packet (in bytes).
 
#define RING_BUF_SIZE   DATAPACKET_SIZE*10
 Size of the ring buffer.
 
#define SDSECTOR_SIZE   512
 Size of the SD sector (in bytes).
 
#define FILENAME_MAXSIZE   32
 Max length of the name of the log file.
 
#define FILENAME_FORMAT   "log_%04d-%02d-%02d_%02d.%02d.%02d.sbb"
 Log filename format.
 
#define FILENAME_ENTRIES   year(), month(), day(), hour(), minute(), second()
 Entries of the log filename format.
 
#define FILENAME_REPORT   "report.log"
 Filename for report log.
 

Functions

void print_report (int mode)
 Print the report.
 
void start_logger (void)
 Initialize the logger.
 
void log_closer (void)
 Close the log file.
 
void do_logger (void)
 Log signals.
 

Variables

boolean doLog = false
 True when logging.
 
char filename [FILENAME_MAXSIZE] = { 0 }
 Log filename.
 
float fill_packet [(DATAPACKET_SIZE - sizeof(ControlClass::controlModel_U) - sizeof(ControlClass::controlModel_Y))/sizeof(float)]
 Fill the data packet.
 
uint64_t logSampleWritten = 0
 Number of logged bytes.
 
FsFile logFile
 Log file object.
 
FsFile reportFile
 File for report log.
 
RingBuf< FsFile, RING_BUF_SIZElog_buf
 Ring buffer object.
 

Detailed Description

Definitions of logger functions and variables.

File to defined the logger functions and variables. Function prototypes are in prototypes.h.

See also
Data logging prototypes.h

Macro Definition Documentation

◆ FILENAME_REPORT

#define FILENAME_REPORT   "report.log"

Filename for report log.