After a long break (seasonal, really) I am finally back with yet another good news ~ I have finally saved time and devoted rainy afternoons and many sleepless nights to the long-promised feature – the data logging.
It had had been such a long run mainly due to my initial intention the code must be original, based on “pure” STL and every part must be clearly explainable, no black boxes and fuzzy libraries. Hence, to make the FAT live on the uSD connected via SPI was anyhow close to a piece of cake (as obviously is for the other folks our there). There were virtually no clues how to bend Chan’s FatFS library to my needs. Until after a considerably long desperate days of hopeless searching I have discovered this site which old version contains a treasure box in form of these two blog entries that really made my day. Cheers buddy, whoever you are!! 🙂
After having mastered the FatFS operations there was another riddle to solve – the format in which to store the data. Initially, the .IGC seemed to be a natural choice (and also many suggested so) but as we need to store some more information than the IGC format supports (e.g. acceleration data), this was not the right one. Additionally, the IGC seems to be rather verbose and since there is no plan or vision to make the OGN Cubes certified FAI recorder we do not need the record to be signed and processed in the traditional way. On the contrary, human readability of the recorded files would be beneficial.
For that reason we came to the conclusion a simple CSV file with meaningful header could be the best choice. It can be easily read by a spreadsheet processor, converted to various formats (GPX for example) and the resulting files are of reasonable size also in case of considerably long flights.
You can see an example of selected recording lines right here:
$OGNR;HHMMSS;gpsFix;pressure[Pa];lat;lon;gpsAlt[m];gpsSpeed[m/s];gpsTrackCourse[deg];ax;ay;az*CRC
$OGNR;112332;3;92884;49.860138;17.613463;727;56.4;327.2;0.222;-0.886;1.370*2a
$OGNR;112341;3;92917;49.864000;17.609517;726;57.7;326.6;0.598;-0.640;1.093*28
$OGNR;113317;3;91468;49.898227;17.543775;852;46.2;246.3;0.592;-1.177;1.069*25
$OGNR;114233;3;93324;49.815882;17.234948;686;52.5;78.9;-0.697;-1.389;1.520*3f
Each flight record starts with a header describing consequent lines. There can be multiple flights in one file which are separated by a header. Flight start and finish are controlled by certain conditions in the tracker’s code (ground speed & interval of inactivity). The data is stored on the SD card in single file per day with its filename in formatted as 20181022.ogn (i.e. YYYYMMDD.ogn).
As the logging feature is finally in its mature state can been released to the wild. Those of you who have a tracker box with the uSD card slot present will receive firmware update shortly. The update procedure is as described in the leaflet. You will need to use the firmwareLoader to upload the new binary to the unit from your laptop via bluetooth.
The work on further releases is still not done, however. In the upcoming weeks and months the plan is to implement:
- Android app to download and flash the firmware updates seamlessly,
- to download the flight logs from the unit using the same app so we don’t need to remove and put back the tiny uSD card every time,
- to integrate the accelerometer to the PCB (there is still a lot of work, experimenting and decisions to be made),
- and finally, one day, to add the you-know-whose protocol support.
And that’s all for this time! 🙂