New here and a programming problem
lau_l99 at yahoo.com.au
Sat Dec 11 15:00:16 CST 2010
Thanks a lot for your replies. I am happy to say I have got it to work in an acceptable manner! I have my data coming in at 19200 and a send buffer (currently) of 22 bytes. I wound up not using ncurses at all (though I did play around some more with it). It turned out to be a bit of a combination of how I was receiving serial data into my buffer and as Daryl said, a small delay. In my while loop, I now firstly delay by usleep(1000) then check for the start byte. If its there, fill the buffer, reassemble the 16bit values, do some other junk, clear the screen and then print it out. Fortunately, it is currently only 3 lines of updating text, so thus far all seems well. Thanks again for all your help! If anyone wants to take a look at my code, just ask. Even though it is a filthy mess!
--- On Thu, 9/12/10, Daryl Tester <dt-linuxsa at handcraftedcomputers.com.au> wrote:
> From: Daryl Tester <dt-linuxsa at handcraftedcomputers.com.au>
> Subject: Re: New here and a programming problem
> To: "Linux SA" <linuxsa at linuxsa.org.au>
> Received: Thursday, 9 December, 2010, 7:14 AM
> (* Warning - pre-coffee *)
> On 08/12/10 19:37, l m wrote:
> > Currently, there is no set time for the updates - I
> just have a while
> > loop cutting sick recieving (serial), reconstructiong
> and printing
> > the variables.. Every way I try, it winds up being
> ummm.. blinky?
> > flashy!!?
> Without knowing specifically why you're getting this effect
> (and perhaps
> the way ncurses is being used may be the reason why), or
> knowing the rate
> of updates, perhaps you could delay the refresh by half
> second or so
> after receiving an initial update in order to batch the
> updates and not
> be continually repainting the screen. ncurses, however,
> should only be
> refreshing those parts of the screen that's changed, so it
> may be
> worthwhile to run script to capture the output of your
> program and check
> that it's really only doing that, and not something like
> clearing and
> rewriting the whole screen on every pass.
> > I am hoping there are a couple of other embedded
> programmers out there
> > who have come across this,
> I don't see this as being specific to embedded systems.
> Daryl Tester
> "It's bad enough to have two heads, but it's worse when
> one's unoccupied."
> -- Scatterbrain, "I'm with Stupid."
> LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa
> on irc.freenode.net
> To unsubscribe or change your options:
More information about the linuxsa