From 0688777f009c09f75ec4953b15662594f7b89678 Mon Sep 17 00:00:00 2001 From: Michael Specht Date: Sun, 11 Feb 2018 22:35:43 +0100 Subject: [PATCH] yay --- parse_watches.rb | 21 +++++++++++++++++++++ watches.h | 20 +++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100755 parse_watches.rb diff --git a/parse_watches.rb b/parse_watches.rb new file mode 100755 index 0000000..54f0872 --- /dev/null +++ b/parse_watches.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +vars = {} + +File::open(ARGV.first) do |f| + f.each_line do |line| + parts = line.split(' ') + name = parts[1] + value = parts[2].to_i + vars[name] ||= [] + vars[name] << value + end +end + +vars.keys.sort.each do |name| + vars[name].sort! + format_str = "%-#{vars.keys.map { |x| x.size }.max}s assigned %8d times, min. %6d, max. %6d, median %6d" + puts sprintf(format_str, + name, vars[name].size, vars[name].first, vars[name].last, + vars[name][vars[name].size / 2]) +end diff --git a/watches.h b/watches.h index 2335c50..1028a66 100644 --- a/watches.h +++ b/watches.h @@ -1,19 +1,37 @@ -const uint16_t WATCH_COUNT = 3; +const uint16_t WATCH_COUNT = 9; #define WATCH_U8 1 #define WATCH_U16 2 #define WATCH_S8 3 #define WATCH_S16 4 const char* WATCH_LABELS[] = { + "SINX", + "COSX", + "SINY", + "COSY", + "SINZ", + "COSZ", "RX", "RY", "RZ" }; const uint16_t WATCH_ADDRESSES[] = { + 0x007b, + 0x007c, + 0x007d, + 0x007e, + 0x007f, + 0x0080, 0x008d, 0x008f, 0x0091 }; const uint8_t WATCH_TYPES[] = { + 3, + 3, + 3, + 3, + 3, + 3, 4, 4, 4