[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
nodo-domotica.nl • Toon onderwerp - Draadloze temperatuur zender - Afdrukweergave
nodo-domotica.nl
http://www.nodo-domotica.nl/forum/

Draadloze temperatuur zender
http://www.nodo-domotica.nl/forum/viewtopic.php?f=4&t=620
« Vorige  Pagina 2 van 24  Volgende »
Auteur:  proza [ 23 jul 2012, 18:36 ]
Titel:  Re: Draadloze temperatuur zender

Auteur:  mvdbro [ 23 jul 2012, 19:30 ]
Titel:  Re: Draadloze temperatuur zender

Oke, er komt in elk geval een signaal binnen met de juiste lengte. Ik zag al 1 fout in de code:

Zou je de volgende regel:

temperature = (bitstream >> 8) & 0xf;

kunnen vervangen door:

temperature = (bitstream >> 12) & 0xfff;
Mogelijk klopt de temperatuur dan al wel (is temp * 10, dus 25 graden levert 250 op)

De andere data die binnenkomt is iets anders, b.v. regen of windsterkte. Als het met de temperatuur klopt, dan heeft het zin om ook de rest uit te zoeken.

gr
Martinus
Auteur:  proza [ 23 jul 2012, 19:58 ]
Titel:  Re: Draadloze temperatuur zender

Het is nu 22,6 graden buiten :D

Alecto Raw data:655237805
Alecto Checksum:13
Alecto Temperature:226

Alecto Raw data:5804
Alecto Checksum:1
Alecto Temperature:1

Alecto Raw data:22427150
Alecto Checksum:10
Alecto Temperature:1379
Auteur:  mvdbro [ 23 jul 2012, 20:01 ]
Titel:  Re: Draadloze temperatuur zender

Probeer dan dit eens:

boolean UserPlugin_Receive(unsigned long Event)
{

unsigned long bitstream=0;
byte nibble0=0;
byte nibble1=0;
byte nibble2=0;
byte nibble3=0;
byte nibble4=0;
byte nibble5=0;
byte nibble6=0;
byte nibble7=0;
byte checksum=0;
long temperature=0;
unsigned long rain=0;
byte windspeed=0;
unsigned long winddirection=0;

if (RawSignal.Number != 74) return true;

for(byte x=2; x<=64; x=x+2)
{
if(RawSignal.Pulses[x] > 0xA00) bitstream = ((bitstream >> 1) |(0x1L << 31));
else bitstream = (bitstream >> 1);
}

for(byte x=66; x<=72; x=x+2)
{
if(RawSignal.Pulses[x] > 0xA00) checksum = ((checksum >> 1) |(0x1L << 3));
else checksum = (checksum >> 1);
}

nibble7 = (bitstream >> 28) & 0xf;
nibble6 = (bitstream >> 24) & 0xf;
nibble5 = (bitstream >> 20) & 0xf;
nibble4 = (bitstream >> 16) & 0xf;
nibble3 = (bitstream >> 12) & 0xf;
nibble2 = (bitstream >> 8) & 0xf;
nibble1 = (bitstream >> 4) & 0xf;
nibble0 = bitstream & 0xf;
temperature = (bitstream >> 12) & 0xfff;

Serial.print("Alecto Raw data:");
Serial.println(bitstream);
Serial.print("Alecto Checksum:");
Serial.println(checksum);

if ((nibble2 & 0x6) != 6) {
Serial.print("Alecto Temperature:");
Serial.println(temperature);
}
else
{
if (nibble3 == 3)
{
Serial.print("Alecto Raindata:");
rain = (bitstream >> 16) & 0xffff;
Serial.println(rain);
}
if (nibble3 == 1)
{
Serial.print("Alecto Windspeed:");
windspeed = (bitstream >> 24) & 0xff;
Serial.println(windspeed);
}
if ((nibble3 & 0x7) == 7)
{
Serial.print("Alecto Wind direction:");
winddirection = (bitstream >> 15) & 0x1ff;
Serial.println(winddirection);
}
}


// funktie kan op twee manieren worden verlaten:
// true = Nodo gaat verder met verwerking van het event
// false = Event wordt niet verder behandeld.
return true;
}
Auteur:  proza [ 23 jul 2012, 20:18 ]
Titel:  Re: Draadloze temperatuur zender

Alecto Raw data:822973101
Alecto Checksum:12
Alecto Temperature:217

Alecto Raw data:22427150
Alecto Checksum:10
Alecto Raindata:342

Alecto Raw data:839746221
Alecto Checksum:12
Alecto Temperature:216

Alecto Raw data:5928621
Alecto Checksum:12
Alecto Wind direction:180

Alleen weet ik nog niet hoe deze data te displayen is in de nodo webapp
Auteur:  mvdbro [ 23 jul 2012, 20:30 ]
Titel:  Re: Draadloze temperatuur zender

Met deze versie kun je de temperatuur richting webapp krijgen. Ik heb variable 10 even gebruikt als voorbeeld. Je kunt dit aanpassen door de #define tempVar te wijzigen.

#define tempVar 10

boolean UserPlugin_Receive(unsigned long Event)
{

unsigned long bitstream=0;
byte nibble0=0;
byte nibble1=0;
byte nibble2=0;
byte nibble3=0;
byte nibble4=0;
byte nibble5=0;
byte nibble6=0;
byte nibble7=0;
byte checksum=0;
long temperature=0;
unsigned long rain=0;
byte windspeed=0;
unsigned long winddirection=0;

if (RawSignal.Number != 74) return true;

for(byte x=2; x<=64; x=x+2)
{
if(RawSignal.Pulses[x] > 0xA00) bitstream = ((bitstream >> 1) |(0x1L << 31));
else bitstream = (bitstream >> 1);
}

for(byte x=66; x<=72; x=x+2)
{
if(RawSignal.Pulses[x] > 0xA00) checksum = ((checksum >> 1) |(0x1L << 3));
else checksum = (checksum >> 1);
}

nibble7 = (bitstream >> 28) & 0xf;
nibble6 = (bitstream >> 24) & 0xf;
nibble5 = (bitstream >> 20) & 0xf;
nibble4 = (bitstream >> 16) & 0xf;
nibble3 = (bitstream >> 12) & 0xf;
nibble2 = (bitstream >> 8) & 0xf;
nibble1 = (bitstream >> 4) & 0xf;
nibble0 = bitstream & 0xf;
temperature = (bitstream >> 12) & 0xfff;

Serial.print("Alecto Raw data:");
Serial.println(bitstream);
Serial.print("Alecto Checksum:");
Serial.println(checksum);

if ((nibble2 & 0x6) != 6) {
Serial.print("Alecto Temperature:");
Serial.println(temperature);
UserVar[tempVar-1] = temperature;
ProcessEvent(AnalogInt2event(UserVar[tempVar-1], tempVar, CMD_VARIABLE_EVENT), VALUE_DIRECTION_INTERNAL, VALUE_SOURCE_VARIABLE, 0, 0);
}
else
{
if (nibble3 == 3)
{
Serial.print("Alecto Raindata:");
rain = (bitstream >> 16) & 0xffff;
Serial.println(rain);
}
if (nibble3 == 1)
{
Serial.print("Alecto Windspeed:");
windspeed = (bitstream >> 24) & 0xff;
Serial.println(windspeed);
}
if ((nibble3 & 0x7) == 7)
{
Serial.print("Alecto Wind direction:");
winddirection = (bitstream >> 15) & 0x1ff;
Serial.println(winddirection);
}
}


// funktie kan op twee manieren worden verlaten:
// true = Nodo gaat verder met verwerking van het event
// false = Event wordt niet verder behandeld.
return true;
}


Volgens mij hebben we een begin van iets bruikbaars...
Auteur:  proza [ 23 jul 2012, 20:43 ]
Titel:  Re: Draadloze temperatuur zender

Er kwam ineens een bulk met data langs, 379 regels in een keer.... :( En is de nodo niet meer bereikbaar via de serial of telnet. Geen reactie op de prompt of status all

Nu twee keer gezien, alleen een powerreset/reboot geeft een fix. Nodo vind het nu niet leuk.. :?
Auteur:  mvdbro [ 23 jul 2012, 20:56 ]
Titel:  Re: Draadloze temperatuur zender

Ik zou even terug gaan naar de voorlaatse versie. Dan eerst even zien of die wel stabiel is.
Heb zo even snel geen idee wat er mis gaat...
Auteur:  proza [ 23 jul 2012, 21:02 ]
Titel:  Re: Draadloze temperatuur zender

Duidelijk, net terug gezet.
Auteur:  mvdbro [ 23 jul 2012, 21:12 ]
Titel:  Re: Draadloze temperatuur zender

Na enig onderzoek denk ik dat ik weet wat er fout gaat. Kan het zelf niet testen. De functie roept processevent aan, terwijl deze zelf vanuit processevent is aangeroepen. Gaat dus in een recursieve lus tot een stack overflow van de Nodo oid.

Ik denk dat het op te lossen is door de regel die begint met :

ProcessEvent

aan te passen in:

ProcessEvent2
er staat dan:
ProcessEvent2(AnalogInt2event(UserVar[tempVar-1], tempVar, CMD_VARIABLE_EVENT), VALUE_DIRECTION_INTERNAL, VALUE_SOURCE_VARIABLE, 0, 0);

Wellicht zou je dat nog kunnen testen. Anders moet ik ook even een beroep doen op de Nodo ontwikkelaars...
Pagina 2 van 24 Alle tijden zijn GMT + 1 uur