[Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic

Ron ron at ...1740...
Sat Dec 5 16:55:21 CET 2009


Benoît Minisini schreef:
>> Benoît Minisini schreef:
>>     
>>> It should be ok with revision #2456!
>>>
>>> If it really works, can you check that changing the flow control between
>>> None and something else actually has an effect on CPU consumption?
>>>       
>> Benoît,
>>
>> no segfaults, but the system load when running my project with the patch
>> is alot higher than before.
>>
>> Before it was 0.2-0.3
>> Now it's 1.0-1.10
>>
>> I'm not using flowcontrol.
>>
>> $ grep FlowControl *
>> CCTX35.class:    .FlowControl = 0
>> CGPS.class:    .FlowControl = 0
>> CPlugwise.class:    .FlowControl = 0
>> CRFXComRX.class:    .FlowControl = 0
>> CRFXComTX.class:    .FlowControl = 0
>> CSMS.class:    .FlowControl = 0
>> CVISCA.class:    .FlowControl = 0
>> CWeeder.class:    .FlowControl = 0
>> CZWave.class:    .FlowControl = 0
>>
>> Six of these serialports are active.
>> And I presume 0 is the same as None.
>>
>> Regards,
>> Ron_2nd.
>>
>>     
>
> That would mean that the Read callback is called endlessly, as if there are 
> always bytes to read on the serial port.
>
> Do you use the read event? Can you check that by implementing a Read event 
> handler, check how much time it is called, and check what can be read on the 
> serial port?
>
> If there is something to read on the serial port, if there are data to read, 
> and if you don't read it, the Read callback will be called again and again.
>
> Regards,
>
>
>   
Almost all of them use a  Read event handler.

CRFXComRX receives the most number of bytes, as it receives data from 
all of my temp/energy sensors.

I have this defined:

PUBLIC SUB RFXComRXSer_Read()

  DIM sData AS Byte

  READ #hRFXComRXSer, sData
  ProcessReceivedChar(sData)

END

So it reads data byte by byte and process them.

Sure a continues flow of data, but before the latest rev. everything 
works with very low cpuload (with even higher serial loads) .
I don't want to loose that!

My guess is that now the Read event is called even when there is no 
data, otherwise I couldn't have a much lower load without changes to my 
code.

I remember having reported the same issue of high loads of serialport 
code, you fixed it here:

Revision: 1796
          http://gambas.svn.sourceforge.net/gambas/?rev=1796&view=rev
Author:   gambas
Date:     2009-01-12 21:24:47 +0000 (Mon, 12 Jan 2009)

Log Message:
-----------
[GB.NET]
* BUG: Serial port devices are now watched for reading, not for writing. So 
  the callback will not be called permanently.

Modified Paths:
--------------

    gambas/branches/2.0/gb.net/src/CSerialPort.c



Is this related to the fix you have put in now?


If you want I can run valgrind/kcachegrind, but I have to make some free 
time first.

Regards,
Ron_2nd.




More information about the User mailing list