patterns/wintec_tes: Slightly nicer formatting in a list of entries (#397)

slightly nicer formatting in a list of entries
This commit is contained in:
Claudius Coenen
2025-05-16 20:25:04 +02:00
committed by GitHub
parent bd06987e8e
commit 2ae0499293

View File

@@ -24,6 +24,7 @@
#include "std/mem.pat"
#include "std/string.pat"
using WBTLine;
using WBTTimestamp;
// helper to format latitude and longitude in a human-readable form
@@ -43,6 +44,11 @@ fn iso8601(WBTTimestamp input) {
};
// short format for overview in a list
fn shortString(WBTLine input) {
return std::format("{:02d}:{:02d}:{:02d} {:s},{:s}", input.timestamp.hours, input.timestamp.minutes, input.timestamp.seconds, stringDegrees(input.lat), stringDegrees(input.lon));
};
// This 16 bit field is barely used. Only these two are known.
bitfield WBTFlags {
split: 1 [[comment("start of a new file")]];
@@ -70,7 +76,7 @@ struct WBTLine {
s32 lat [[color("007FFF"), format("stringDegrees")]];
s32 lon [[color("7F00FF"), format("stringDegrees")]];
s16 alt [[color("0000FF")]];
} [[hex::visualize("coordinates", decimalDegrees(lat), decimalDegrees(lon))]];
} [[hex::visualize("coordinates", decimalDegrees(lat), decimalDegrees(lon)), format("shortString")]];
// parsing that whole file start to finish: