[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)
Toon onderwerp - Draadloze temperatuur zender • nodo-domotica.nl

nodo-domotica.nl

Draadloze temperatuur zender

Hier alles over de hardware kant van de Nodo

Re: Draadloze temperatuur zender

Berichtdoor proza » 23 jul 2012, 18:36

- Jura Impressa F50 and a Starbucks MUG makes my day complete
Gebruikers-avatar
proza
 
Berichten: 420
Geregistreerd: 03 nov 2011, 22:44

Re: Draadloze temperatuur zender

Berichtdoor mvdbro » 23 jul 2012, 19:30

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
mvdbro
 
Berichten: 1092
Geregistreerd: 21 okt 2011, 12:06

Re: Draadloze temperatuur zender

Berichtdoor proza » 23 jul 2012, 19:58

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
- Jura Impressa F50 and a Starbucks MUG makes my day complete
Gebruikers-avatar
proza
 
Berichten: 420
Geregistreerd: 03 nov 2011, 22:44

Re: Draadloze temperatuur zender

Berichtdoor mvdbro » 23 jul 2012, 20:01

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;
}
mvdbro
 
Berichten: 1092
Geregistreerd: 21 okt 2011, 12:06

Re: Draadloze temperatuur zender

Berichtdoor proza » 23 jul 2012, 20:18

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
Laatst bijgewerkt door proza op 23 jul 2012, 20:31, in totaal 1 keer bewerkt.
- Jura Impressa F50 and a Starbucks MUG makes my day complete
Gebruikers-avatar
proza
 
Berichten: 420
Geregistreerd: 03 nov 2011, 22:44

Re: Draadloze temperatuur zender

Berichtdoor mvdbro » 23 jul 2012, 20:30

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...
mvdbro
 
Berichten: 1092
Geregistreerd: 21 okt 2011, 12:06

Re: Draadloze temperatuur zender

Berichtdoor proza » 23 jul 2012, 20:43

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.. :?
Laatst bijgewerkt door proza op 23 jul 2012, 20:56, in totaal 1 keer bewerkt.
- Jura Impressa F50 and a Starbucks MUG makes my day complete
Gebruikers-avatar
proza
 
Berichten: 420
Geregistreerd: 03 nov 2011, 22:44

Re: Draadloze temperatuur zender

Berichtdoor mvdbro » 23 jul 2012, 20:56

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...
mvdbro
 
Berichten: 1092
Geregistreerd: 21 okt 2011, 12:06

Re: Draadloze temperatuur zender

Berichtdoor proza » 23 jul 2012, 21:02

Duidelijk, net terug gezet.
- Jura Impressa F50 and a Starbucks MUG makes my day complete
Gebruikers-avatar
proza
 
Berichten: 420
Geregistreerd: 03 nov 2011, 22:44

Re: Draadloze temperatuur zender

Berichtdoor mvdbro » 23 jul 2012, 21:12

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...
mvdbro
 
Berichten: 1092
Geregistreerd: 21 okt 2011, 12:06

VorigeVolgende

Keer terug naar Nodo Hardware

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers. en 15 gasten

cron