From: Ian D. <gal...@bt...> - 2001-03-24 21:15:38
|
Hi Bruce I have just upgraded to 2.47 and tested the serial port routine. It does work in that '0' is detected but data is always true even when no data is received. If I enable Debug=serial with 2.47 code when MH is run the screen scrolls with the debug info data2=... By adding the defined statement no data being received is taken as data has been received. Like wise if I turn debug off and use the following code: my $s_data; if (defined ($s_data = said $serial_out)) { print_log $s_data; } Again the screen scrolls with the date and time with no data. If I use: my $s_data; if (defined ($s_data = said $serial_out)) { if ($s_data eq "0" or $s_data gt ""){ print_log $s_data; } } Then all works fine but I still believe that MH needs to be altered as it is processing data that does not exist causing extra load when it is not necessary, it also makes Debug=serial unusable. Like I mentioned earlier my Perl is still poor, I am sure there is a better test than ($s_data eq "0" or $s_data gt "") but there does seem to be a need for some other test if 'defined' is used. If you want me to do any other tests then just let me know. regards Ian ----- Original Message ----- From: "Bruce Winter" <br...@mi...> To: <mis...@li...> Sent: Saturday, March 24, 2001 5:40 PM Subject: RE: [misterhouse-users] Serial i/p strange happenings > > Below is the modified code that works OK feel > > free to make it more elegant, as I'm sure your aware my Perl skills are > > still beginner level ! > > > > $Serial_Ports{$port_name}{data} .= $data if defined ($data eq "0" or $data > > gt "") ; #added defined and '0' test > > hmmm, I still don't see why a simple ... if defined($data) would not work. > I think the gt "" test could get us into trouble with some data. I'm just > finishing the current release, so lets see if you still have problems with > that. If so, let me know and I'll try to re-create the problem here with > coupled serial ports like you have. > > > Tried the plant talk text and it worked fine. I kept in the > > different way of > > defining $plant_talk, and my code again works and increments. > > That'll cheer > > the kids up now that Melissa (the computer name ...do not ask..) > > is leaving the cute little bunny rabbitt alone ! > > Ok good deal. My boys (15 year olds) have a slightly different view on what > would be fun to do with cute little bunny rabbits. Fortunately, the wild > rabbits that wonder into our yard have been too fast for them to catch :) > > Bruce > > > ________________________________________________________ > To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365 > > |