Funk wetterstations Analyse Programm: Unterschied zwischen den Versionen
Kiwi (Diskussion | Beiträge) K |
Veyron (Diskussion | Beiträge) |
||
Zeile 10: | Zeile 10: | ||
<source lang="c"> | <source lang="c"> | ||
dnl ################################################################################ | dnl ################################################################################ | ||
+ | dnl # # | ||
+ | dnl # Daten Analyse und Programm Erstellung: # | ||
+ | dnl # Copyright (c) 08/2009 - Michael Schultz <ethersex@keyb.de> # | ||
+ | dnl # Mit viel unterstuetzung/Geduld von: stesie, veyron und DanielW # | ||
+ | dnl # # | ||
dnl # This program is free software; you can redistribute it and/or modify it # | dnl # This program is free software; you can redistribute it and/or modify it # | ||
dnl # under the terms of the GNU General Public License (either version 2 or # | dnl # under the terms of the GNU General Public License (either version 2 or # | ||
Zeile 31: | Zeile 36: | ||
dnl # Protokoll analyse siehe: # | dnl # Protokoll analyse siehe: # | ||
dnl # http://www.ethersex.de/index.php/Funk-wetterstations-protokoll # | dnl # http://www.ethersex.de/index.php/Funk-wetterstations-protokoll # | ||
− | |||
− | |||
− | |||
− | |||
dnl # # | dnl # # | ||
dnl ################################################################################ | dnl ################################################################################ | ||
− | + | ||
− | + | ||
− | |||
− | |||
dnl Logging Destination Host: 10.0.0.77 on Port 95 | dnl Logging Destination Host: 10.0.0.77 on Port 95 | ||
Zeile 47: | Zeile 46: | ||
#define US_TO_TICKS(n) ((n) * 1000UL / NS_PER_TICK) | #define US_TO_TICKS(n) ((n) * 1000UL / NS_PER_TICK) | ||
− | + | #define WEATHERVERBOSE 1 | |
− | |||
− | + | uint8_t data[310]; | |
− | dnl Timing Timer Count Timer C. Hex Decode | + | uint16_t counter; |
− | uint8_t Time0 = US_TO_TICKS(1920); dnl L space 1920 bis 1999us | + | |
− | uint8_t Time1 = US_TO_TICKS(3990); dnl H space 3990 bis 4049us | + | |
− | uint8_t Time2 = US_TO_TICKS(2060); dnl End-l space 2060 bis 2089us | + | dnl Timing @16mhz: Timer Count Timer C. Hex Decode |
− | uint8_t Time3 = US_TO_TICKS(4130); dnl End-h space 4130 bis 4169us | + | uint8_t Time0 = US_TO_TICKS(1920); dnl L space 1920 bis 1999us 30-31,2 0x1E 0x1F 0 |
− | uint8_t Time4 = US_TO_TICKS(8890); dnl Start space 8890 bis 8939us | + | uint8_t Time1 = US_TO_TICKS(3990); dnl H space 3990 bis 4049us 62,3-63,2 0x3E 0x3F 1 |
− | uint8_t Time5 = US_TO_TICKS(360); dnl End- pulse 360 bis 369us | + | uint8_t Time2 = US_TO_TICKS(2060); dnl End-l space 2060 bis 2089us 32,1-32,6 0x20 0x21 2 |
− | uint8_t Time6 = US_TO_TICKS(440); dnl _ pulse 440 bis 519us | + | uint8_t Time3 = US_TO_TICKS(4130); dnl End-h space 4130 bis 4169us 64,5-65,1 0x40 0x41 3 |
+ | uint8_t Time4 = US_TO_TICKS(8890); dnl Start space 8890 bis 8939us 138,9-139,6 0x8A 0x8B 4 | ||
+ | uint8_t Time5 = US_TO_TICKS(360); dnl End- pulse 360 bis 369us 5,6-5,7 0x05 5 | ||
+ | uint8_t Time6 = US_TO_TICKS(440); dnl _ pulse 440 bis 519us 6,8-8,1 0x06 0x08 6 | ||
dnl Pause | dnl Pause | ||
− | + | dnl | |
− | uint8_t BitPos = 0; | + | uint8_t BitPos = 0; dnl Bit Position innerhalb eines 36 bit worts (1 bis 37) |
− | uint8_t WordCound = 0; | + | uint8_t WordCound = 0; dnl Daten Wort Count (1 bis 9) |
− | uint8_t WordData[45]; | + | uint8_t WordData[45]; dnl 1 Data Word = 5 Byte / Max 8 Data Words |
− | uint8_t WordPos = 0; | + | uint8_t WordPos = 0; dnl Byte Pos in WordData |
− | + | dnl | |
− | uint16_t Temp = 0; | + | uint16_t Temp = 0; dnl Temperatur Wert (-)76,8 bis (+)127,9 °C, Vorzeichen wird erst bei der ausgabe gesetzt. |
− | uint16_t Feuchte = 0; | + | uint16_t Feuchte = 0; dnl Luftfeuchte Wert 20-99 % |
− | uint8_t timer_0 = 0; | + | uint8_t timer_0 = 0; dnl Timer Wert für zeitbestimming zwichen 2 Pegel änderungen (Interrupts) |
− | uint8_t Temp1 = 0; | + | uint8_t Temp1 = 0; dnl Temperatur wert, einer stelle --> 0,n °C |
− | uint8_t Temp10 = 0; | + | uint8_t Temp10 = 0; dnl Temperatur wert, zener stelle --> n,0 °C |
− | + | dnl | |
− | uint8_t Analysis[10] ; | + | uint8_t Analysis[10] ; dnl Daten Analyse array |
− | + | dnl Analysis[0 bis 7] Treffer der Daten Packets Übereinstimmung. | |
− | + | dnl Analysis[8] - bit(0) = 1 Daten Liegen an und können vearbeitete werden | |
− | + | dnl Analysis[8] - bit(1) = 1 Datenanalyse erfolgreich, Mindestens 3 Übereinstimmungen | |
− | + | dnl Analysis[8] - bit(2) = 1 Daten sind Verarbeitet und können gesendet werden | |
− | + | dnl Analysis[9] Array Positions Counter fuer analyse | |
+ | |||
+ | |||
+ | |||
+ | CONTROL_START | ||
+ | ON STARTUP DO | ||
+ | _TCCR0_PRESCALE |= _BV(CS02); dnl TCCR0B(CS02)=1 | ||
+ | _TCCR0_PRESCALE &= ~_BV(CS01); dnl TCCR0B(CS01)=0 | ||
+ | _TCCR0_PRESCALE |= _BV(CS00); dnl TCCR0B(CS00)=1 | ||
+ | _EIMSK |= _BV(INT0); dnl EIMSK(INT0) = 1 | ||
+ | _EICRA &= ~_BV(ISC01); dnl EICRA(ISC01) = 0 | ||
+ | _EICRA |= _BV(ISC00); dnl EICRA(ISC00) = 1 | ||
+ | _TIMSK_TIMER0 |= _BV(TOIE0); dnl TIMSK0(TOIE0) = 1 Interrupt on Timer Overflow aktivieren | ||
+ | TCP_CONNECT(10.0.0.77, 95, message_handler); | ||
+ | END | ||
+ | TCP_HANDLER_PERSIST(message_handler) | ||
+ | for (;;) | ||
+ | { | ||
+ | WordData[40] = WordData[0] ; | ||
+ | WordData[41] = WordData[1] ; | ||
+ | WordData[42] = WordData[2] ; | ||
+ | WordData[43] = WordData[3] ; | ||
+ | WordData[44] = WordData[4] ; | ||
+ | |||
+ | dnl for( uint8_t i=0, uint8_t j = 8 ; i < j ; i++, j+=2) | ||
+ | dnl if ( WordData[Analysis[9]] == WordData[Analysis[9] + 5] ) { | ||
+ | dnl for{ init; match; do } {anweisung;} | ||
+ | dnl for( zahl = 0 ; zahl < 20 ; zahl += 5 ) | ||
+ | dnl Array[zahl] = 1; | ||
+ | dnl for (int i=0;i<5;i++) Arrayzahl[i*5]=1; | ||
+ | |||
+ | |||
+ | dnl Analysis[8] - bit(2) = 1 Daten sind Verarbeitet und können gesendet werden | ||
+ | if ( Analysis[8] & ( 1 << 2 ) ) | ||
+ | { | ||
+ | Temp = 0 ; | ||
+ | if ( WordData[41] & ( 1 << 3 ) ) { Temp = Temp + 1 ; } | ||
+ | if ( WordData[41] & ( 1 << 2 ) ) { Temp = Temp + 2 ; } | ||
+ | if ( WordData[41] & ( 1 << 1 ) ) { Temp = Temp + 4 ; } | ||
+ | if ( WordData[41] & ( 1 << 0 ) ) { Temp = Temp + 8 ; } | ||
+ | if ( WordData[42] & ( 1 << 7 ) ) { Temp = Temp + 16 ; } | ||
+ | if ( WordData[42] & ( 1 << 6 ) ) { Temp = Temp + 32 ; } | ||
+ | if ( WordData[42] & ( 1 << 5 ) ) { Temp = Temp + 64 ; } | ||
+ | if ( WordData[42] & ( 1 << 4 ) ) { Temp = Temp + 128 ; } | ||
+ | if ( WordData[42] & ( 1 << 3 ) ) { Temp = Temp + 256 ; } | ||
+ | if ( WordData[42] & ( 1 << 2 ) ) { Temp = Temp + 512 ; } | ||
+ | if ( WordData[42] & ( 1 << 1 ) ) { Temp = Temp + 1024 ; } | ||
+ | Temp10=( Temp / 10 ); | ||
+ | Temp1=( Temp - ( ( Temp / 10 ) * 10 ) ); | ||
+ | Feuchte = 0 ; | ||
+ | if ( WordData[43] & ( 1 << 7 ) ) { Feuchte = Feuchte + 1 ; } | ||
+ | if ( WordData[43] & ( 1 << 6 ) ) { Feuchte = Feuchte + 2 ; } | ||
+ | if ( WordData[43] & ( 1 << 5 ) ) { Feuchte = Feuchte + 4 ; } | ||
+ | if ( WordData[43] & ( 1 << 4 ) ) { Feuchte = Feuchte + 8 ; } | ||
+ | if ( WordData[43] & ( 1 << 3 ) ) { Feuchte = Feuchte + 10 ; } | ||
+ | if ( WordData[43] & ( 1 << 2 ) ) { Feuchte = Feuchte + 20 ; } | ||
+ | if ( WordData[43] & ( 1 << 1 ) ) { Feuchte = Feuchte + 40 ; } | ||
+ | if ( WordData[43] & ( 1 << 0 ) ) { Feuchte = Feuchte + 80 ; } | ||
+ | |||
+ | TCP_SEND("<27>"); | ||
+ | if ( CLOCK_MONTH() == 8 ) { TCP_SEND("Aug "); } | ||
+ | TCP_SEND("%d %02d:%02d:%02d %s ethersex: Sender=", CLOCK_DAY(), CLOCK_HOUR(), CLOCK_MIN(), CLOCK_SEC(), CONF_HOSTNAME); | ||
+ | |||
+ | dnl TCP_SEND("%d %02d:%02d:%02d %s -- Sender=", CLOCK_DAY(), CLOCK_HOUR(), CLOCK_MIN(), CLOCK_SEC(), CONF_HOSTNAME); | ||
+ | if ( WordData[40] & ( 1 << 3 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[40] & ( 1 << 2 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); } | ||
+ | if ( WordData[40] & ( 1 << 7 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[40] & ( 1 << 6 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[40] & ( 1 << 5 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[40] & ( 1 << 4 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); } | ||
+ | if ( WordData[40] & ( 1 << 1 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[40] & ( 1 << 0 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); } | ||
+ | if ( WordData[41] & ( 1 << 7 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[41] & ( 1 << 6 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | if ( WordData[41] & ( 1 << 5 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | TCP_SEND(" Temp="); | ||
+ | if ( WordData[42] & ( 1 << 0 ) ) { TCP_SEND("-"); } else { TCP_SEND("+"); } | ||
+ | TCP_SEND("%d.%d Feuchte=%d%% SonderSendung=", Temp10, Temp1, Feuchte); | ||
+ | if ( WordData[41] & ( 1 << 4 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); } | ||
+ | TCP_SEND(" (%02x%02x%02x%02x%02x)\n", WordData[40], WordData[41], WordData[42], WordData[43], WordData[44]); | ||
+ | #if WEATHERVERBOSE == 1 | ||
+ | TCP_SEND("00 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[0], WordData[1], WordData[2], WordData[3], WordData[4], Analysis[0]); | ||
+ | TCP_SEND("01 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[5], WordData[6], WordData[7], WordData[8], WordData[9], Analysis[1]); | ||
+ | TCP_SEND("02 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[10], WordData[11], WordData[12], WordData[13], WordData[14], Analysis[2]); | ||
+ | TCP_SEND("03 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[15], WordData[16], WordData[17], WordData[18], WordData[19], Analysis[3]); | ||
+ | TCP_SEND("04 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[20], WordData[21], WordData[22], WordData[23], WordData[24], Analysis[4]); | ||
+ | TCP_SEND("05 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[25], WordData[26], WordData[27], WordData[28], WordData[29], Analysis[5]); | ||
+ | TCP_SEND("06 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[30], WordData[31], WordData[32], WordData[33], WordData[34], Analysis[6]); | ||
+ | TCP_SEND("07 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[35], WordData[36], WordData[37], WordData[38], WordData[39], Analysis[7]); | ||
+ | TCP_SEND("Out --> %02x%02x%02x%02x%02x\n", WordData[40], WordData[41], WordData[42], WordData[43], WordData[44]); | ||
+ | TCP_SEND(" \n"); | ||
+ | TCP_SEND(" \n"); | ||
+ | #endif | ||
+ | #if WEATHERVERBOSE > 1 | ||
+ | |||
+ | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39]); | ||
+ | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59], data[60], data[61], data[62], data[63], data[64], data[65], data[66], data[67], data[68], data[69], data[70], data[71], data[72], data[73], data[74], data[75], data[76], data[77], data[78], data[79]); | ||
+ | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[80], data[81], data[82], data[83], data[84], data[85], data[86], data[87], data[88], data[89], data[100], data[101], data[102], data[103], data[104], data[105], data[106], data[107], data[108], data[109], data[110], data[111], data[112], data[113], data[114], data[115], data[116], data[117], data[118], data[119], data[120], data[121], data[122], data[123], data[124], data[125], data[126], data[127], data[128], data[129]); | ||
− | + | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[130], data[131], data[132], data[133], data[134], data[135], data[136], data[137], data[138], data[139], data[140], data[141], data[142], data[143], data[144], data[145], data[146], data[147], data[148], data[149], data[150], data[151], data[152], data[153], data[154], data[155], data[156], data[157], data[158], data[159], data[160], data[161], data[162], data[163], data[164], data[165], data[166], data[167], data[168], data[169]); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[170], data[171], data[172], data[173], data[174], data[175], data[176], data[177], data[178], data[179], data[180], data[181], data[182], data[183], data[184], data[185], data[186], data[187], data[188], data[189], data[190], data[191], data[192], data[193], data[194], data[195], data[196], data[197], data[198], data[199], data[200], data[201], data[202], data[203], data[204], data[205], data[206], data[207], data[208], data[209]); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[210], data[211], data[212], data[213], data[214], data[215], data[216], data[217], data[218], data[219], data[220], data[221], data[222], data[223], data[224], data[225], data[226], data[227], data[228], data[229], data[230], data[231], data[232], data[233], data[234], data[235], data[236], data[237], data[238], data[239], data[240], data[241], data[242], data[243], data[244], data[245], data[246], data[247], data[248], data[249]); | |
− | |||
− | |||
− | + | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[250], data[251], data[252], data[253], data[254], data[255], data[256], data[257], data[258], data[259], data[260], data[261], data[262], data[263], data[264], data[265], data[266], data[267], data[268], data[269], data[270], data[271], data[272], data[273], data[274], data[275], data[276], data[277], data[278], data[279], data[280], data[281], data[282], data[283], data[284], data[285], data[286], data[287], data[288], data[289]); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[290], data[291], data[292], data[293], data[294], data[295], data[296], data[297], data[298], data[299], data[300], data[301], data[302], data[303], data[304], data[305], data[306], data[307], data[308], data[309], data[290], data[291], data[292], data[293], data[294], data[295], data[296], data[297], data[298], data[299], data[300], data[301], data[302], data[303], data[304], data[305], data[306], data[307], data[308], data[309]); | ||
− | + | TCP_SEND(" \n"); | |
− | + | TCP_SEND(" \n"); | |
− | + | #endif | |
− | + | Analysis[8] &= ~(1 << 2); dnl deaktivieren der Daten sendung | |
− | + | } | |
− | + | Analysis[9] = 0; | |
+ | PT_YIELD(pt); | ||
+ | |||
+ | dnl Analysis[0 bis 7] Treffer der Daten Packets Übereinstimmung. | ||
+ | dnl Analysis[8] - bit(0) = 1 Daten Liegen an und können vearbeitete werden | ||
+ | dnl Analysis[8] - bit(1) = 1 Datenanalyse erfolgreich, Mindestens 3 Übereinstimmungen | ||
+ | dnl Analysis[8] - bit(2) = 1 Daten sind Verarbeitet und können gesendet werden | ||
+ | } | ||
+ | TCP_HANDLER_END(); | ||
CONTROL_END | CONTROL_END | ||
− | + | ||
ISR(INT0_vect) | ISR(INT0_vect) | ||
{ | { | ||
− | + | timer_0 = TCNT0; | |
− | + | counter ++; | |
− | + | if ( counter >= 310 ) | |
− | + | { | |
− | + | counter = 1 ; | |
− | + | } | |
− | + | WordPos=(( BitPos / 8 ) + ( WordCound * 5 )); | |
− | + | ||
− | + | if ( WordPos >= 40 ) | |
− | + | { | |
− | + | BitPos = 0 ; | |
− | + | WordCound = 0 ; | |
− | + | } | |
− | + | ||
− | + | if ( timer_0 >= Time6 && timer_0 <= ( Time6 + 2 ) ) | |
− | + | { | |
− | + | counter -- ; | |
− | + | } else if ( timer_0 == Time0 || timer_0 == ( Time0 + 1 ) ) | |
− | + | { | |
− | + | dnl L 0 (L - Bit - Normal) | |
− | + | data[counter] = 0; | |
− | + | WordData[WordPos] &= ~(1 << ( 7 - (BitPos % 8))); dnl WordData[n] = 0; | |
− | + | BitPos ++ ; | |
− | + | } else if ( timer_0 == Time1 || timer_0 == ( Time1 + 1 ) ) | |
− | + | { | |
− | + | dnl H 1 (H - Bit - Normal) | |
− | + | data[counter] = 1; | |
− | + | WordData[WordPos] |= 1 << ( 7 - (BitPos % 8)); dnl WordData[n] = 1; | |
− | + | BitPos ++ ; | |
− | + | } else if ( timer_0 == Time2 || timer_0 == ( Time2 + 1 ) ) | |
− | + | { | |
− | + | dnl End-l 2 (Ende Datenwort L) | |
− | + | data[counter] = 2; | |
− | + | WordData[WordPos] &= ~(1 << ( 7 - (BitPos % 8))); dnl WordData[n] = 0; | |
− | + | BitPos ++ ; | |
− | + | } else if ( timer_0 == Time3 || timer_0 == ( Time3 + 1 ) ) | |
− | + | { | |
− | + | dnl End-h 3 (Ende Datenwort H) | |
− | + | data[counter] = 3; | |
− | + | WordData[WordPos] |= 1 << ( 7 - (BitPos % 8)); dnl WordData[n] = 1; | |
− | + | BitPos ++ ; | |
− | + | } else if ( timer_0 >= ( Time4 -2 ) && timer_0 <= ( Time4 + 3 ) ) | |
− | + | { | |
− | + | dnl Start 4 (Start Datenwort) | |
− | + | data[counter] = 4; | |
− | + | if ( BitPos != 1 ) | |
− | + | { | |
− | + | WordCound ++ ; | |
− | + | WordData[ WordPos ] = 0 ; | |
− | + | WordData[ WordPos + 1 ] = 0 ; | |
+ | WordData[ WordPos + 2 ] = 0 ; | ||
+ | WordData[ WordPos + 3 ] = 0 ; | ||
+ | WordData[ WordPos + 4 ] = 0 ; | ||
+ | } | ||
+ | BitPos = 0; | ||
+ | } else if ( timer_0 == Time5 || timer_0 == ( Time5 + 1 ) ) | ||
+ | { | ||
+ | dnl End- 5 (Daten Sendung Ende) | ||
+ | data[counter] = 5; | ||
+ | } else | ||
+ | { | ||
+ | dnl ? 8 (Nicht Erkanntes Timing) | ||
+ | data[counter] = 8; | ||
+ | BitPos ++ ; | ||
+ | } | ||
+ | TCNT0 = 0; | ||
+ | |||
dnl | dnl | ||
dnl L 0 (L - Bit) 30 | dnl L 0 (L - Bit) 30 | ||
Zeile 257: | Zeile 289: | ||
dnl uint8_t WordData[40]; dnl 1 Data Word = 5 Byte / Max 8 Data Words | dnl uint8_t WordData[40]; dnl 1 Data Word = 5 Byte / Max 8 Data Words | ||
dnl | dnl | ||
− | + | ||
dnl WordData[0] WordData[1] WordData[2] WordData[3] WordData[4] | dnl WordData[0] WordData[1] WordData[2] WordData[3] WordData[4] | ||
dnl | dnl | ||
Zeile 265: | Zeile 297: | ||
dnl RRRR CCBB ???S TTTT TTTT TTTT LLLL LLLL cccc ---- | dnl RRRR CCBB ???S TTTT TTTT TTTT LLLL LLLL cccc ---- | ||
dnl | dnl | ||
− | + | ||
} | } | ||
− | + | ||
ISR(TIMER0_OVF_vect) | ISR(TIMER0_OVF_vect) | ||
− | { | + | { |
− | + | if ( WordCound >= 3 ) | |
− | + | { | |
− | + | Analysis[8] |= (1 << 2); | |
− | + | } | |
− | + | counter = 0; | |
− | + | data[counter] = 7; | |
− | + | TIFR0 &= ~_BV(TOV0); dnl TIFR0(TOV0) = 0 | |
− | + | BitPos = 0; | |
− | + | WordCound = 0; | |
− | |||
} | } | ||
− | + | ||
− | + | ||
dnl gummi:~# | dnl gummi:~# | ||
dnl gummi:~# while true ; do socat stdio tcp4-listen:4444 ; echo "##########" ; sleep 1 ; done | dnl gummi:~# while true ; do socat stdio tcp4-listen:4444 ; echo "##########" ; sleep 1 ; done |
Version vom 3. August 2009, 19:33 Uhr
dnl ################################################################################
dnl # #
dnl # Daten Analyse und Programm Erstellung: #
dnl # Copyright (c) 08/2009 - Michael Schultz <ethersex@keyb.de> #
dnl # Mit viel unterstuetzung/Geduld von: stesie, veyron und DanielW #
dnl # #
dnl # This program is free software; you can redistribute it and/or modify it #
dnl # under the terms of the GNU General Public License (either version 2 or #
dnl # version 3) as published by the Free Software Foundation. #
dnl # #
dnl # This program is distributed in the hope that it will be useful, #
dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of #
dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
dnl # GNU General Public License for more details. #
dnl # #
dnl # You should have received a copy of the GNU General Public License #
dnl # along with this program; if not, write to the Free Software #
dnl # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
dnl # #
dnl # For more information on the GPL, please go to: #
dnl # http://www.gnu.org/copyleft/gpl.html #
dnl # #
dnl # #
dnl # Wetter-Funk-Daten Analyse Programm für Wetter Station der Firma #
dnl # Krippl Watches GmbH -- http://www.produktservice.info #
dnl # Protokoll analyse siehe: #
dnl # http://www.ethersex.de/index.php/Funk-wetterstations-protokoll #
dnl # #
dnl ################################################################################
dnl Logging Destination Host: 10.0.0.77 on Port 95
#define PRESCALER 1024
#define NS_PER_TICK (PRESCALER * 1000000UL / F_CPU * 1000)
#define US_TO_TICKS(n) ((n) * 1000UL / NS_PER_TICK)
#define WEATHERVERBOSE 1
uint8_t data[310];
uint16_t counter;
dnl Timing @16mhz: Timer Count Timer C. Hex Decode
uint8_t Time0 = US_TO_TICKS(1920); dnl L space 1920 bis 1999us 30-31,2 0x1E 0x1F 0
uint8_t Time1 = US_TO_TICKS(3990); dnl H space 3990 bis 4049us 62,3-63,2 0x3E 0x3F 1
uint8_t Time2 = US_TO_TICKS(2060); dnl End-l space 2060 bis 2089us 32,1-32,6 0x20 0x21 2
uint8_t Time3 = US_TO_TICKS(4130); dnl End-h space 4130 bis 4169us 64,5-65,1 0x40 0x41 3
uint8_t Time4 = US_TO_TICKS(8890); dnl Start space 8890 bis 8939us 138,9-139,6 0x8A 0x8B 4
uint8_t Time5 = US_TO_TICKS(360); dnl End- pulse 360 bis 369us 5,6-5,7 0x05 5
uint8_t Time6 = US_TO_TICKS(440); dnl _ pulse 440 bis 519us 6,8-8,1 0x06 0x08 6
dnl Pause
dnl
uint8_t BitPos = 0; dnl Bit Position innerhalb eines 36 bit worts (1 bis 37)
uint8_t WordCound = 0; dnl Daten Wort Count (1 bis 9)
uint8_t WordData[45]; dnl 1 Data Word = 5 Byte / Max 8 Data Words
uint8_t WordPos = 0; dnl Byte Pos in WordData
dnl
uint16_t Temp = 0; dnl Temperatur Wert (-)76,8 bis (+)127,9 °C, Vorzeichen wird erst bei der ausgabe gesetzt.
uint16_t Feuchte = 0; dnl Luftfeuchte Wert 20-99 %
uint8_t timer_0 = 0; dnl Timer Wert für zeitbestimming zwichen 2 Pegel änderungen (Interrupts)
uint8_t Temp1 = 0; dnl Temperatur wert, einer stelle --> 0,n °C
uint8_t Temp10 = 0; dnl Temperatur wert, zener stelle --> n,0 °C
dnl
uint8_t Analysis[10] ; dnl Daten Analyse array
dnl Analysis[0 bis 7] Treffer der Daten Packets Übereinstimmung.
dnl Analysis[8] - bit(0) = 1 Daten Liegen an und können vearbeitete werden
dnl Analysis[8] - bit(1) = 1 Datenanalyse erfolgreich, Mindestens 3 Übereinstimmungen
dnl Analysis[8] - bit(2) = 1 Daten sind Verarbeitet und können gesendet werden
dnl Analysis[9] Array Positions Counter fuer analyse
CONTROL_START
ON STARTUP DO
_TCCR0_PRESCALE |= _BV(CS02); dnl TCCR0B(CS02)=1
_TCCR0_PRESCALE &= ~_BV(CS01); dnl TCCR0B(CS01)=0
_TCCR0_PRESCALE |= _BV(CS00); dnl TCCR0B(CS00)=1
_EIMSK |= _BV(INT0); dnl EIMSK(INT0) = 1
_EICRA &= ~_BV(ISC01); dnl EICRA(ISC01) = 0
_EICRA |= _BV(ISC00); dnl EICRA(ISC00) = 1
_TIMSK_TIMER0 |= _BV(TOIE0); dnl TIMSK0(TOIE0) = 1 Interrupt on Timer Overflow aktivieren
TCP_CONNECT(10.0.0.77, 95, message_handler);
END
TCP_HANDLER_PERSIST(message_handler)
for (;;)
{
WordData[40] = WordData[0] ;
WordData[41] = WordData[1] ;
WordData[42] = WordData[2] ;
WordData[43] = WordData[3] ;
WordData[44] = WordData[4] ;
dnl for( uint8_t i=0, uint8_t j = 8 ; i < j ; i++, j+=2)
dnl if ( WordData[Analysis[9]] == WordData[Analysis[9] + 5] ) {
dnl for{ init; match; do } {anweisung;}
dnl for( zahl = 0 ; zahl < 20 ; zahl += 5 )
dnl Array[zahl] = 1;
dnl for (int i=0;i<5;i++) Arrayzahl[i*5]=1;
dnl Analysis[8] - bit(2) = 1 Daten sind Verarbeitet und können gesendet werden
if ( Analysis[8] & ( 1 << 2 ) )
{
Temp = 0 ;
if ( WordData[41] & ( 1 << 3 ) ) { Temp = Temp + 1 ; }
if ( WordData[41] & ( 1 << 2 ) ) { Temp = Temp + 2 ; }
if ( WordData[41] & ( 1 << 1 ) ) { Temp = Temp + 4 ; }
if ( WordData[41] & ( 1 << 0 ) ) { Temp = Temp + 8 ; }
if ( WordData[42] & ( 1 << 7 ) ) { Temp = Temp + 16 ; }
if ( WordData[42] & ( 1 << 6 ) ) { Temp = Temp + 32 ; }
if ( WordData[42] & ( 1 << 5 ) ) { Temp = Temp + 64 ; }
if ( WordData[42] & ( 1 << 4 ) ) { Temp = Temp + 128 ; }
if ( WordData[42] & ( 1 << 3 ) ) { Temp = Temp + 256 ; }
if ( WordData[42] & ( 1 << 2 ) ) { Temp = Temp + 512 ; }
if ( WordData[42] & ( 1 << 1 ) ) { Temp = Temp + 1024 ; }
Temp10=( Temp / 10 );
Temp1=( Temp - ( ( Temp / 10 ) * 10 ) );
Feuchte = 0 ;
if ( WordData[43] & ( 1 << 7 ) ) { Feuchte = Feuchte + 1 ; }
if ( WordData[43] & ( 1 << 6 ) ) { Feuchte = Feuchte + 2 ; }
if ( WordData[43] & ( 1 << 5 ) ) { Feuchte = Feuchte + 4 ; }
if ( WordData[43] & ( 1 << 4 ) ) { Feuchte = Feuchte + 8 ; }
if ( WordData[43] & ( 1 << 3 ) ) { Feuchte = Feuchte + 10 ; }
if ( WordData[43] & ( 1 << 2 ) ) { Feuchte = Feuchte + 20 ; }
if ( WordData[43] & ( 1 << 1 ) ) { Feuchte = Feuchte + 40 ; }
if ( WordData[43] & ( 1 << 0 ) ) { Feuchte = Feuchte + 80 ; }
TCP_SEND("<27>");
if ( CLOCK_MONTH() == 8 ) { TCP_SEND("Aug "); }
TCP_SEND("%d %02d:%02d:%02d %s ethersex: Sender=", CLOCK_DAY(), CLOCK_HOUR(), CLOCK_MIN(), CLOCK_SEC(), CONF_HOSTNAME);
dnl TCP_SEND("%d %02d:%02d:%02d %s -- Sender=", CLOCK_DAY(), CLOCK_HOUR(), CLOCK_MIN(), CLOCK_SEC(), CONF_HOSTNAME);
if ( WordData[40] & ( 1 << 3 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[40] & ( 1 << 2 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); }
if ( WordData[40] & ( 1 << 7 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[40] & ( 1 << 6 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[40] & ( 1 << 5 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[40] & ( 1 << 4 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); }
if ( WordData[40] & ( 1 << 1 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[40] & ( 1 << 0 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); }
if ( WordData[41] & ( 1 << 7 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[41] & ( 1 << 6 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
if ( WordData[41] & ( 1 << 5 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
TCP_SEND(" Temp=");
if ( WordData[42] & ( 1 << 0 ) ) { TCP_SEND("-"); } else { TCP_SEND("+"); }
TCP_SEND("%d.%d Feuchte=%d%% SonderSendung=", Temp10, Temp1, Feuchte);
if ( WordData[41] & ( 1 << 4 ) ) { TCP_SEND("1"); } else { TCP_SEND("0"); }
TCP_SEND(" (%02x%02x%02x%02x%02x)\n", WordData[40], WordData[41], WordData[42], WordData[43], WordData[44]);
#if WEATHERVERBOSE == 1
TCP_SEND("00 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[0], WordData[1], WordData[2], WordData[3], WordData[4], Analysis[0]);
TCP_SEND("01 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[5], WordData[6], WordData[7], WordData[8], WordData[9], Analysis[1]);
TCP_SEND("02 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[10], WordData[11], WordData[12], WordData[13], WordData[14], Analysis[2]);
TCP_SEND("03 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[15], WordData[16], WordData[17], WordData[18], WordData[19], Analysis[3]);
TCP_SEND("04 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[20], WordData[21], WordData[22], WordData[23], WordData[24], Analysis[4]);
TCP_SEND("05 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[25], WordData[26], WordData[27], WordData[28], WordData[29], Analysis[5]);
TCP_SEND("06 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[30], WordData[31], WordData[32], WordData[33], WordData[34], Analysis[6]);
TCP_SEND("07 --> %02x%02x%02x%02x%02x Match:%d\n", WordData[35], WordData[36], WordData[37], WordData[38], WordData[39], Analysis[7]);
TCP_SEND("Out --> %02x%02x%02x%02x%02x\n", WordData[40], WordData[41], WordData[42], WordData[43], WordData[44]);
TCP_SEND(" \n");
TCP_SEND(" \n");
#endif
#if WEATHERVERBOSE > 1
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59], data[60], data[61], data[62], data[63], data[64], data[65], data[66], data[67], data[68], data[69], data[70], data[71], data[72], data[73], data[74], data[75], data[76], data[77], data[78], data[79]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[80], data[81], data[82], data[83], data[84], data[85], data[86], data[87], data[88], data[89], data[100], data[101], data[102], data[103], data[104], data[105], data[106], data[107], data[108], data[109], data[110], data[111], data[112], data[113], data[114], data[115], data[116], data[117], data[118], data[119], data[120], data[121], data[122], data[123], data[124], data[125], data[126], data[127], data[128], data[129]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[130], data[131], data[132], data[133], data[134], data[135], data[136], data[137], data[138], data[139], data[140], data[141], data[142], data[143], data[144], data[145], data[146], data[147], data[148], data[149], data[150], data[151], data[152], data[153], data[154], data[155], data[156], data[157], data[158], data[159], data[160], data[161], data[162], data[163], data[164], data[165], data[166], data[167], data[168], data[169]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[170], data[171], data[172], data[173], data[174], data[175], data[176], data[177], data[178], data[179], data[180], data[181], data[182], data[183], data[184], data[185], data[186], data[187], data[188], data[189], data[190], data[191], data[192], data[193], data[194], data[195], data[196], data[197], data[198], data[199], data[200], data[201], data[202], data[203], data[204], data[205], data[206], data[207], data[208], data[209]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[210], data[211], data[212], data[213], data[214], data[215], data[216], data[217], data[218], data[219], data[220], data[221], data[222], data[223], data[224], data[225], data[226], data[227], data[228], data[229], data[230], data[231], data[232], data[233], data[234], data[235], data[236], data[237], data[238], data[239], data[240], data[241], data[242], data[243], data[244], data[245], data[246], data[247], data[248], data[249]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[250], data[251], data[252], data[253], data[254], data[255], data[256], data[257], data[258], data[259], data[260], data[261], data[262], data[263], data[264], data[265], data[266], data[267], data[268], data[269], data[270], data[271], data[272], data[273], data[274], data[275], data[276], data[277], data[278], data[279], data[280], data[281], data[282], data[283], data[284], data[285], data[286], data[287], data[288], data[289]);
TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[290], data[291], data[292], data[293], data[294], data[295], data[296], data[297], data[298], data[299], data[300], data[301], data[302], data[303], data[304], data[305], data[306], data[307], data[308], data[309], data[290], data[291], data[292], data[293], data[294], data[295], data[296], data[297], data[298], data[299], data[300], data[301], data[302], data[303], data[304], data[305], data[306], data[307], data[308], data[309]);
TCP_SEND(" \n");
TCP_SEND(" \n");
#endif
Analysis[8] &= ~(1 << 2); dnl deaktivieren der Daten sendung
}
Analysis[9] = 0;
PT_YIELD(pt);
dnl Analysis[0 bis 7] Treffer der Daten Packets Übereinstimmung.
dnl Analysis[8] - bit(0) = 1 Daten Liegen an und können vearbeitete werden
dnl Analysis[8] - bit(1) = 1 Datenanalyse erfolgreich, Mindestens 3 Übereinstimmungen
dnl Analysis[8] - bit(2) = 1 Daten sind Verarbeitet und können gesendet werden
}
TCP_HANDLER_END();
CONTROL_END
ISR(INT0_vect)
{
timer_0 = TCNT0;
counter ++;
if ( counter >= 310 )
{
counter = 1 ;
}
WordPos=(( BitPos / 8 ) + ( WordCound * 5 ));
if ( WordPos >= 40 )
{
BitPos = 0 ;
WordCound = 0 ;
}
if ( timer_0 >= Time6 && timer_0 <= ( Time6 + 2 ) )
{
counter -- ;
} else if ( timer_0 == Time0 || timer_0 == ( Time0 + 1 ) )
{
dnl L 0 (L - Bit - Normal)
data[counter] = 0;
WordData[WordPos] &= ~(1 << ( 7 - (BitPos % 8))); dnl WordData[n] = 0;
BitPos ++ ;
} else if ( timer_0 == Time1 || timer_0 == ( Time1 + 1 ) )
{
dnl H 1 (H - Bit - Normal)
data[counter] = 1;
WordData[WordPos] |= 1 << ( 7 - (BitPos % 8)); dnl WordData[n] = 1;
BitPos ++ ;
} else if ( timer_0 == Time2 || timer_0 == ( Time2 + 1 ) )
{
dnl End-l 2 (Ende Datenwort L)
data[counter] = 2;
WordData[WordPos] &= ~(1 << ( 7 - (BitPos % 8))); dnl WordData[n] = 0;
BitPos ++ ;
} else if ( timer_0 == Time3 || timer_0 == ( Time3 + 1 ) )
{
dnl End-h 3 (Ende Datenwort H)
data[counter] = 3;
WordData[WordPos] |= 1 << ( 7 - (BitPos % 8)); dnl WordData[n] = 1;
BitPos ++ ;
} else if ( timer_0 >= ( Time4 -2 ) && timer_0 <= ( Time4 + 3 ) )
{
dnl Start 4 (Start Datenwort)
data[counter] = 4;
if ( BitPos != 1 )
{
WordCound ++ ;
WordData[ WordPos ] = 0 ;
WordData[ WordPos + 1 ] = 0 ;
WordData[ WordPos + 2 ] = 0 ;
WordData[ WordPos + 3 ] = 0 ;
WordData[ WordPos + 4 ] = 0 ;
}
BitPos = 0;
} else if ( timer_0 == Time5 || timer_0 == ( Time5 + 1 ) )
{
dnl End- 5 (Daten Sendung Ende)
data[counter] = 5;
} else
{
dnl ? 8 (Nicht Erkanntes Timing)
data[counter] = 8;
BitPos ++ ;
}
TCNT0 = 0;
dnl
dnl L 0 (L - Bit) 30
dnl H 1 (H - Bit) 62
dnl End-l 2 (Ende Datenwort L) 32
dnl End-h 3 (Ende Datenwort H) 64
dnl Start 4 (Start Datenwort) 138
dnl End- 5 (Daten Sendung Ende) 5
dnl _ 6 (puls) 6
dnl Pause 7 (Timer Overflow)
dnl ? 8 (Nicht Erkanntes Timing)
dnl
dnl uint8_t BitPos = 0; dnl Bit Position innerhalb eines 36 bit worts (0 bis 36)
dnl uint8_t WordCound = 0; dnl Daten Wort Count (0 bis 7)
dnl uint8_t WordData[40]; dnl 1 Data Word = 5 Byte / Max 8 Data Words
dnl
dnl WordData[0] WordData[1] WordData[2] WordData[3] WordData[4]
dnl
dnl 0 0 1 1 2 2 3 3 4 4
dnl 5 D 0 0 4 8 E 4 7 0
dnl 0101 1101 0000 0000 0100 1000 1110 0100 0111 0000
dnl RRRR CCBB ???S TTTT TTTT TTTT LLLL LLLL cccc ----
dnl
}
ISR(TIMER0_OVF_vect)
{
if ( WordCound >= 3 )
{
Analysis[8] |= (1 << 2);
}
counter = 0;
data[counter] = 7;
TIFR0 &= ~_BV(TOV0); dnl TIFR0(TOV0) = 0
BitPos = 0;
WordCound = 0;
}
dnl gummi:~#
dnl gummi:~# while true ; do socat stdio tcp4-listen:4444 ; echo "##########" ; sleep 1 ; done
dnl
dnl gummi:/usr/src/ethersex/090730_wichtel_ac:de:48:d3:99:5f/ethersex/control6#
dnl cd .. ; make clean ; make ; scp ethersex.bin 10.33.0.10:/srv/tftp/ACDE48D3995F ; cd control6/ ;
dnl echo "bootloader" | socat stdio tcp4:10.0.0.40:2701
dnl
dnl gummi:/usr/src/ethersex/090730_wichtel_ac:de:48:d3:99:5f/ethersex/control6#
dnl cat funk_temp_und_feuchte_daten.src | sed 's/dnl[\ \t]*.*//g' | sed 's/^\t\+$//' | grep -v '^$'
dnl
dnl gummi:~#
dnl while true ; do socat stdio tcp4-listen:4444 | while read Line ; do
dnl if [ "$(echo $Line | grep -c '^--')" = "1" ] ; then echo ; echo ; else
dnl echo -en "$Line" | sed 's/^_//' ; fi ; done | sed 's/\(8[bc]0[78]\)/\n\1/g' ;
dnl echo "##########" ; sleep 1 ; done
dnl
dnl Timing Timer Count Timer C. Hex Decode
dnl L space 1920 bis 1999us 30-31,2 0x1E 0x1F 0
dnl H space 3990 bis 4049us 62,3-63,2 0x3E 0x3F 1
dnl End-l space 2060 bis 2089us 32,1-32,6 0x20 0x21 2
dnl End-h space 4130 bis 4169us 64,5-65,1 0x40 0x41 3
dnl Start space 8890 bis 8939us 138,9-139,6 0x8A 0x8B 4
dnl End- pulse 360 bis 369us 5,6-5,7 0x05 5
dnl _ pulse 440 bis 519us 6,8-8,1 0x06 0x08 6
dnl Pause 7
dnl
dnl
dnl
dnl
Emfangen der "Wetter" Daten Mittels Syslog-NG
Sample "/etc/syslog-ng/syslog-ng.conf" File
################################################################################
# Speicherung der "Wetter" Daten (Temp und Feuchte)
################################################################################
source src_net_t95 { tcp( ip(10.0.0.77) port(95) max_connections(1000) ); };
destination dst_file_t95 { file("/mnt/log/current/$YEAR/$MONTH/$DAY/$HOUR/$HOST/$PROGRAM/$FACILITY.$PRIORITY.log"); };
log { source(src_net_t95); destination(dst_file_t95); };
################################################################################
So sehen die daten dann gespeichert aus:
(/mnt/log/current/2009/08/03/08/wichtel/ethersex/daemon.err.log
Aug 3 08:15:29 wichtel ethersex: Sender=01-0101-11-001 Temp=+26.4 Feuchte=32% SonderSendung=1 (5731084c00)
Aug 3 08:15:29 wichtel ethersex: Sender=01-0101-11-001 Temp=+26.4 Feuchte=32% SonderSendung=1 (5731084c00)
Aug 3 08:16:21 wichtel ethersex: Sender=01-0101-11-001 Temp=+26.6 Feuchte=32% SonderSendung=1 (5735084c00)
Aug 3 08:16:21 wichtel ethersex: Sender=01-0101-11-001 Temp=+26.6 Feuchte=32% SonderSendung=1 (5735084c00)
Aug 3 08:16:52 wichtel ethersex: Sender=01-0101-11-001 Temp=+26.7 Feuchte=31% SonderSendung=0 (572d088c00)