Code Overview 4: Data Logs​​​​​

A project log for HEXABITZ - Modular Electronics for REAL

A new kind of electronic prototyping!

HexabitzHexabitz 04/03/2018 at 03:100 Comments

Some modules like the mircoSD memory card module H1BR60 (previously H05R00) feature permanent logging functionality to a micro-SD card. You can create up to 10 simultaneous logs with up to 30 different variables across all logs. Logs are tabulated text files that consist of a header section, a bunch of columns, each representing a single logged variable and a bunch of rows, each representing the variables’ value at a given moment. Logs have two types: RATE and EVENT. The former type logs variable state periodically at a fixed rate, while the latter logs only a state change. Below is an example of RATE log

Datalog created by BOS V0.1.0 on H05R0Log type: Rate @ 10.00 Hz
Count    Float    UINT 32
1    120.400002    1123077325
2    120.400002    1123077325
3    120.400002    1123077325
4    120.400002    1123077325
5    120.400002    1123077325
6    120.400002    1123077325

And this is an example of an EVENT log:

Datalog created by BOS V0.1.0 on H05R0Log type: Events
Count,Switch 3 (E-stop)

Use this API to create a new log:

Module_Status CreateLog(const char* logName, logType_t type, float rate, delimiterFormat_t delimiterFormat, indexColumnFormat_t indexColumnFormat,const char* indexColumnLabel)


This API returns:

Once a log has been created, you can add new variables to the log using this API:

Module_Status LogVar(const char* logName, logVarType_t type, uint32_t source, const char* ColumnLabel)


This API returns:

Adding a variable to a log does not start the logging process automatically. You can use the StartLog()StopLog()PauseLog() and ResumeLog() APIs to control the logging process for each log independently. You can also delete a log from the uSD card using DeleteLog() API. Note: If the module booted without a uSD card (or with a malfunctioning one), the logging functionality will be aborted and the indicator LED will blink indefinitely. Just replace the card and reboot again to resume normal operation.