[Lcdproc] imon and horizontal progress bar
Peter Marschall
peter@adpm.de
Tue Nov 7 17:13:02 2006
Hi,
I guess I found the cause of the issues:
- cellwidth was wrongly initialized with..._HEIGHT (sic!)
- pixels should only be decreased by cellwidth
per loop instance in hbar.
They are fixed now in CVS and will be in tonight's tar ball.
Please test
Peter
On Saturday, 7. October 2006 21:22, Otto Kolsi wrote:
> Hi,
>
> Peter Marschall wrote:
> > I am also wondering a bit about the cell size you give for the imon
> > driver. According to the sources the cell width is fixed to 5 pixels.
>
> I'm a little puzzled with this too. I can also see the fixed 5 pixel
> definition in the code, but for some reason when I run LCDd and connect
> with telnet and execute hello, LCDd reports back cellwidth 8. But it's
> working fine now with the fix below, so I'm not sure if I'm going to dig
> this any deeper.
>
> > So, if you speak a little C, then you might want to have a look at the
> > imon_hbar() function in the file server/drivers/imon.c.
> > It should be modeled loosely after the hbar function in the curses
> > driver.
>
> Well, I think I've nailed it down. In imon.c in imon_hbar() this
> statement is flawed:
>
> pixels -= p->cellwidth * pos;
>
> This decrement in every round should be done from the original pixels
> value calculated at the beginning of the function, not to decrease from
> the already decreased value.
>
> Here's one possible way to fix the for() loop in imon_hbar():
>
> for (pos = 0; pos < len; pos++) {
> if (pixels - (p->cellwidth * pos) >= p->cellwidth) {
> /* write a "full" block to the screen... */
> //drvthis->icon (drvthis, x+pos, y, ICON_BLOCK_FILLED);
>
>
> imon_chr (drvthis, x+pos, y, '#');
> }
> else if (pixels - (p->cellwidth * pos) > 0) {
> /* write a "partial" block to the screen... */
> imon_chr (drvthis, x+pos, y, '-');
> break;
> }
> else {
> ; // write nothing (not even a space)
>
>
> }
> }
--
Peter Marschall
peter@adpm.de