Since finishing the Hourai file format for RC logs I've been wanting to have my TX automatically generate such log files to save the effort of doing it manually, especially when there may have been multiple "sessions" before I was able to reset the flight timers for each model.
Since I use a Taranis running OpenTX this was a fairly simple task as the logger can be scripted as a telemetry screen using Lua.
Initially I'd coded a more complex logger that used a telemetry screen for monitoring and two special function scripts that would be attached to whatever indicated if a model was in use or not, however this ate up a lot more memory than it really should of so I simplified this to a single telemetry script and a couple of support libraries.
The finished script is available here: https://github.com/DanNixon/Hourai-OpenTX
Active lg. switch is the number of a logical switch that denotes the model being "in use" when the switch value is high. This is set on a per model basis.
The session name defaults to a sanitised version of the timestamp of the start of the session.
In the state they are created the log files produced by this logger fail validation against the Hourai session schema as they lack any location information, however it is usually not possible to obtain this information from the radio unless flying a model with GPS in which case the first reported set of coordinates can be used.
The log files are saved to the
\HOURAI\LOGS\ directory of the SD card, there are a few additional support files in this directory as shown below.
config.json is generated by the script and contains the logical switch assignment for each model the logger has been used with, if you version control your config files this would be one worth including.
. ├── HOURAI │ ├── config.json │ ├── LOGS │ │ └── 2016-07-16T19_03_02Z.json │ └── session_template.json
The additional libraries used by the logging script are in a separate repository here, the JSON library is a modified version of an existing plain Lua implementation. The most significant change is replacing pretty much all string append operations with IO operations, rather than generating a single JSON string containing the entire document then writing it to a file.
Whilst this version of the script will run when uploaded to the Taranis as source files, ideally they would be compiled first as the JSON parsing and generation library is fairly large to include as source in a limited environment such as OpenTX.