Skip to content

Commit 2ae0499

Browse files
authored
patterns/wintec_tes: Slightly nicer formatting in a list of entries (#397)
slightly nicer formatting in a list of entries
1 parent bd06987 commit 2ae0499

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

patterns/wintec_tes.hexpat

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "std/mem.pat"
2525
#include "std/string.pat"
2626

27+
using WBTLine;
2728
using WBTTimestamp;
2829

2930
// helper to format latitude and longitude in a human-readable form
@@ -43,6 +44,11 @@ fn iso8601(WBTTimestamp input) {
4344
};
4445

4546

47+
// short format for overview in a list
48+
fn shortString(WBTLine input) {
49+
return std::format("{:02d}:{:02d}:{:02d} {:s},{:s}", input.timestamp.hours, input.timestamp.minutes, input.timestamp.seconds, stringDegrees(input.lat), stringDegrees(input.lon));
50+
};
51+
4652
// This 16 bit field is barely used. Only these two are known.
4753
bitfield WBTFlags {
4854
split: 1 [[comment("start of a new file")]];
@@ -70,7 +76,7 @@ struct WBTLine {
7076
s32 lat [[color("007FFF"), format("stringDegrees")]];
7177
s32 lon [[color("7F00FF"), format("stringDegrees")]];
7278
s16 alt [[color("0000FF")]];
73-
} [[hex::visualize("coordinates", decimalDegrees(lat), decimalDegrees(lon))]];
79+
} [[hex::visualize("coordinates", decimalDegrees(lat), decimalDegrees(lon)), format("shortString")]];
7480

7581

7682
// parsing that whole file start to finish:

0 commit comments

Comments
 (0)