From 2ae0499293ab5e0a9c95685f0cc463b3c62412bb Mon Sep 17 00:00:00 2001 From: Claudius Coenen Date: Fri, 16 May 2025 20:25:04 +0200 Subject: [PATCH] patterns/wintec_tes: Slightly nicer formatting in a list of entries (#397) slightly nicer formatting in a list of entries --- patterns/wintec_tes.hexpat | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patterns/wintec_tes.hexpat b/patterns/wintec_tes.hexpat index ca2bb8b..bfe99e9 100644 --- a/patterns/wintec_tes.hexpat +++ b/patterns/wintec_tes.hexpat @@ -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: