aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Lohr <lohr85@gmail.com>2016-12-04 02:47:47 -0500
committerCharles Lohr <lohr85@gmail.com>2016-12-04 02:47:47 -0500
commit7dbb0dbf81d740ffa1461cab4a2d87974b091719 (patch)
treeca31c242335598ea561e4d74254da0692c289578
parent7d5b2dc6ab70c6a1ba66acbbedfcafbee7be7055 (diff)
downloadlibsurvive-7dbb0dbf81d740ffa1461cab4a2d87974b091719.tar.gz
libsurvive-7dbb0dbf81d740ffa1461cab4a2d87974b091719.tar.bz2
Update tools based on newest tests.
-rw-r--r--src/survive_data.c54
-rw-r--r--tools/avr_codegen/test.c6
-rwxr-xr-xtools/avr_codegen/test.elfbin6908 -> 6832 bytes
-rw-r--r--tools/avr_codegen/test.hex9
4 files changed, 59 insertions, 10 deletions
diff --git a/src/survive_data.c b/src/survive_data.c
index 8fef4dc..026bbb6 100644
--- a/src/survive_data.c
+++ b/src/survive_data.c
@@ -232,7 +232,7 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
// code = 0x91 = ???? ... 25 bytes?
-#if 0
+#if 1
static int lasttime;
// good good maybe? probably wrong
int mytimex = (time1<<24)|(time2<<16)|(readdata[4]<<8)|(readdata[5]);
@@ -288,7 +288,56 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
return;
}
+ //What I think I know:
+ // 2 pulses: mytime pulse? deltime? deltime? pulse? deltime?
+ // 3 pulses: mytime pulse? deltime? deltime? pulse? deltime? deltime? pulse deltime?
+ // Maybe pulse codes are change in masks?
+ //One light on then off. Events (1358180290): 50/( 112/ 1714)50/( 107/ -1)
+ // LED 50 / LED 60
+ // 5a/(7 >< 90)60/( 7 <> 1719)5a/(7/90)60/(7/-1)
+ // 50 then
+ // 7 later) 60 on
+ // 90 later, 60 only
+ // 7 later, 60 off.
+ // 1719 later, 50 on
+ // 7 later, 60 on.
+ // 90 later, 50 off
+ // 7 later, 60 off.
+
+ //TODO: Try to undertand multiple code.
+ //TODO: Make sure order of on/off is correct.
+ //TODO: Get some sleepeeepepepeppeepeppeepppepepepepepeppp
+
+
+ //I think the format is:
+ // mytime = start of events
+ // mask = LEDs on.
+ // parameter = delta
+ // mask = Led mask switching
static int olddel = 0;
+
+ int lightmask = lights[lightno-1];
+
+ //
+ //
+ //
+
+ //Operting on mytime
+ printf( "Events (%10d): ", mytime );
+ for( i = 0; i < lightno; i++ )
+ {
+ int deltaA = parameters[parplace-i*2-1];
+ int deltaB = -1;
+ if( parplace-i*2-2 >= 0 )
+ deltaB = parameters[parplace-i*2-2];
+
+ printf( "%02x/(%5d/%5d)", lightmask, deltaA, deltaB );
+ if( lightno-i-2 >= 0 )
+ lightmask = lights[lightno-i-2];
+ }
+ printf( "\n");
+
+/*
for( i = 0; i < lightno; i++ )
{
struct LightcapElement le;
@@ -298,7 +347,6 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
le.timestamp = mytime;
handle_lightcap( w, &le );
-
int delta = le.timestamp - olddel;
olddel = le.timestamp;
@@ -308,6 +356,8 @@ static void handle_watchman( struct SurviveObject * w, uint8_t * readdata )
if( pl>=0 )
mytime += parameters[parplace-i*2-2];
}
+*/
+
#if 0
printf( " SRR: " );
diff --git a/tools/avr_codegen/test.c b/tools/avr_codegen/test.c
index 45f6962..ad01747 100644
--- a/tools/avr_codegen/test.c
+++ b/tools/avr_codegen/test.c
@@ -56,21 +56,21 @@ int main( )
marker--;
PORTB = 0;
} while( marker );
- _delay_us(8);
+ _delay_us(80);
marker = 10;
do{
PORTB = _BV(4);
marker--;
PORTB = 0;
} while( marker );
- _delay_us(16);
+/* _delay_us(16);
marker = 20;
do{
PORTB = _BV(4);
marker--;
PORTB = 0;
} while( marker );
-
+*/
// t b6 b5 b4 b3 b2 b1 b0 t b13 b12 b11 b10 b9 b8 b7
// 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0
// 8 5 0 8
diff --git a/tools/avr_codegen/test.elf b/tools/avr_codegen/test.elf
index c5bc028..458f910 100755
--- a/tools/avr_codegen/test.elf
+++ b/tools/avr_codegen/test.elf
Binary files differ
diff --git a/tools/avr_codegen/test.hex b/tools/avr_codegen/test.hex
index 8b3bb1a..7c9a4cb 100644
--- a/tools/avr_codegen/test.hex
+++ b/tools/avr_codegen/test.hex
@@ -1,12 +1,11 @@
:100000000EC015C014C013C012C011C010C00FC064
:100010000EC00DC00CC00BC00AC009C008C011241E
-:100020001FBECFE5D2E0DEBFCDBF1AD03FC0E8CFC4
+:100020001FBECFE5D2E0DEBFCDBF1AD037C0E8CFCC
:100030000F931F9300E010E0980106171707280799
:10004000390759F0EFECF7E03197F1F700C0000005
:100050000F5F1F4F2F4F3F4FF0CF1F910F9108950C
:10006000F89480E886BD16BC80E681BF80E187BB3E
-:100070009AE088BB18BA9150E1F795E19A95F1F7AB
-:1000800000009AE088BB18BA9150E1F7EAE2EA95DD
-:10009000F1F700C094E188BB18BA9150E1F7EFE1A5
-:1000A000FEE43197F1F700C00000E2CFF894FFCFF3
+:1000700090E18AE098BB18BA8150E1F785ED8A9546
+:10008000F1F700008AE098BB18BA8150E1F7EFE180
+:10009000FEE43197F1F700C00000EBCFF894FFCFFA
:00000001FF