moving things around; won't build for now

This commit is contained in:
Sean C. Rhea
2006-09-07 00:11:06 +00:00
parent aae0d3c116
commit e345a93cbc
32 changed files with 0 additions and 188 deletions

View File

@@ -1,83 +0,0 @@
#!/usr/bin/perl -w
#
# $Id: compare_rows.pl,v 1.1 2006/05/12 21:50:51 srhea Exp $
#
# Copyright (c) 2006 Russ Cox (rsc@swtch.com) and Sean Rhea (srhea@srhea.net)
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
use strict;
if ($#ARGV < 1) {
print STDERR "usage: compare_rows.pl <file 1> <file 2> [column]\n";
exit 1;
}
my $file1 = $ARGV[0];
my $file2 = $ARGV[1];
my $start_col = 0;
my $stop_col = 8;
if ($#ARGV >= 2) {
my $stop_col = $ARGV[2];
my $start_col = $stop_col - 1;
}
open(FILE1, $file1) or die "Couldn't open $file1\n";
open(FILE2, $file2) or die "Couldn't open $file2\n";
my $row = 0;
while(<FILE1>) {
++$row;
$_ =~ s/^\s+//;
my @cols1 = split /\s+/, $_;
my $row2 = <FILE2>;
if ($row2) {
my @cols2 = split /\s+/, $row2;
my $col;
for ($col = $start_col; $col < $stop_col; ++$col) {
if (($cols1[$col] =~ m/[0-9.]+/) && ($cols2[$col] =~ m/[0-9.]+/)) {
if ($col == 0) {
# Times are sometimes off by a bit; just make sure they're
# within a tenth of a percent.
if (($cols1[$col] * 0.999 > $cols2[$col])
|| ($cols1[$col] * 1.001 < $cols2[$col])) {
print "$file1: @cols1\n";
print "$file2: @cols2\n";
}
}
else {
# All other columns should match exactly.
if ($cols1[$col] != $cols2[$col]) {
print "$file1: @cols1\n";
print "$file2: @cols2\n";
}
}
}
elsif (!($cols1[$col] eq $cols2[$col])) {
print "$file1: @cols1\n";
print "$file2: @cols2\n";
}
}
}
else {
print "$file1 is longer.\n";
}
}
if (<FILE2>) {
print "$file2 is longer.\n";
}

View File

@@ -1,75 +0,0 @@
Version header:
sometimes bytes added before 0x56
00 56 45 52 20 30 .VER 0
32 2e 32 31 20 50 2.21 P
52 4f 00 00 00 00 RO....
00 00 00 00 00 00 ......
00 00 00 00 0d 0a ....\r\n
Data:
Get 12 packets of 1542 (0x606) bytes each.
Where is that encoded?
Each row is 6 bytes.
Rows that start with 0x8? are the data for one period.
Column Meaning Format
1 ???
2, n1 torque 4 most sig bits, N m
2, n2 km/h 4 most sig bits, 0x24000 / value * 0.1
3 torque 8 least sig bits, N m
4 km/h 8 least sig bits, 0x24000 / value * 0.1
5 Cadence 1-byte integer
6 Heartrate 1-byte integer
First row is always:
57 56 55 64 02 15
Base period in thousands of a minute = 0x15...
A row starting with 0x60 encodes the time of day that measurements started.
This is always the second record in the stream. Also, when the computer goes
to sleep and then wakes up again, it writes one of these records first.
Example: 60 06 04 9c 2a 30
byte 2 year
byte 3 month
byte 4, bottom 5 bits day
byte 5, bottom 5 bits hour
byte 6, bottom 6 bits minute
top 3 bits of byte 4 followed by top 3 bits of byte 5 is pretty close to the
right seconds value, but not perfect...
A row starting with 0x40 encodes:
bytes 2-3 the wheel circumference in mm
byte 4 the interval number
byte 5 the recording interval, where
byte value interval
0x0 1
0x1 2
0x3 5
0x7 10
0x17 30
Example:
40 08 30 02 07 00
wheel size in mm = 0x0830
interval 2
recording interval 10

View File

View File

30
test.sh
View File

@@ -1,30 +0,0 @@
#!/bin/sh
#
# $Id: test.sh,v 1.2 2006/05/14 14:17:21 srhea Exp $
#
# Copyright (c) 2006 Russ Cox (rsc@swtch.com) and Sean Rhea (srhea@srhea.net)
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
grep 'Rider' $1.xml | sed -e 's/<[^>]*>/ /g' > win
if ! ./ptunpk -c < $1.raw | grep -v '^#' > mac
then
echo "Failed to unpack $1.raw";
exit 1
fi
./compare_rows.pl win mac $2
rm win mac