Re: imonlcd: spinning disc and progess bars

Eric Pooch <[email protected]>
Newsgroups gmane.comp.sysutils.lcdproc
Message-ID <[email protected]>
I needed to make another small change.  try this patch instead:



patch on 0.5.4
  again, it complies but I did not test it.

--Eric

On Apr 20, 2011, at 4:16 PM, Eric Pooch wrote:

> Try this patch on 0.5.4:<imonlcd_output_bars_spin.patch>
>
> It will update the icons (including the spinning cd) even when the  
> client output request is to only update the bars.  However, it  
> retains the original 0.5.4 bug fix.
> It also cleans up some old unnecessary code in the output function.
>
>
> it compiles, but I did not test it.
>
> --Eric
>
> On Apr 20, 2011, at 3:25 PM, Eric Pooch wrote:
>
>> The change between 0.5.3 and 0.5.4 fixed a serious bug where the  
>> driver would continuously send commands to update the display  
>> icons, even when there were no changes needed.  As a result of  
>> this bug, I experienced display instability.  Your patch re- 
>> introduces the bug.  I have not noticed the 1 second delay you  
>> mention. However, I can see in the code where it only updates the  
>> bars when there is an output command made by the client.  As a  
>> result, it skips an opportunity to update the spinning disc.  This  
>> change should be relatively simple to implement.  I will make a  
>> patch.
>> In the mean time, you might want to check what is going on with  
>> your configuration that is causing 1 second delay to update the  
>> icons.  what kind of computer are you using?  Have you made  
>> configuration changes to slow down LCDproc?
>>
>> --Eric
>>
>> On Apr 20, 2011, at 2:29 PM, Karsten A. M. Günther wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hello lcdproc'ers,
>>>
>>> I would like to ask you a question regarding lcdproc 0.5.4 and the
>>> imonlcd driver. I am working on a patch for XBMC media center for  
>>> full
>>> icon support in combination with Soundgraph's IMON LCD display and
>>> lcdproc (http://trac.xbmc.org/ticket/8981). In fact, it is  
>>> working quite
>>> fine, but since lcdproc 0.5.4 there is an issue regarding the  
>>> spinning
>>> disc animation. Everytime, the progress bars are updated, the  
>>> animation
>>> stops for a short moment until the icons are updated again. I  
>>> wrote the
>>> attached perl script to verify this. This script executed with  
>>> lcdproc
>>> 0.5.3 shows the spinning disc and a second later all progress  
>>> bars and
>>> lines. The disc keeps spinning as expected. With lcdproc 0.5.4  
>>> the disc
>>> starts spinning, after a seconds it stops and the progress bars  
>>> come up
>>> and after another second it starts spinning again.
>>>
>>> For my needs I reverted some changes in imonlcd.c, see attached  
>>> patch file.
>>>
>>> My question: am I doing or understanding something wrong or is  
>>> this just
>>> a bug in the code cleanup and rework you did in imonlcd.c between  
>>> 0.5.3
>>> and 0.5.4?
>>>
>>> Best regards,
>>> Karsten Guenther
>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.10 (GNU/Linux)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>>
>>> iQEcBAEBAgAGBQJNr1A1AAoJEGeYm4AaNYHY1i4IAIDnk2KjUrIrq0363R3Kmez0
>>> nIJKlGbZNepvISGK1ATpnPd14HCDfbDo0UJi1PPc4PMZsDJ0XkJoOd4sVTrKLyxr
>>> unFQGBOxJFUBFXUUTvjjQG9mTZsrdAZagHmskt9C0oPBGZGJeCeu4JQUiegr3OvK
>>> zBAgQi0ms3Fx3kcSjQQmMZ9/GjXOSMGl4mJ0gB9g+Us5GWg3eC3w8+mq0FeXWdYU
>>> YFGD8a45kHxUDRM3PLv3vbWXB81D3hwyYaTzpEwSoGjmxJqvCLXIxtuwr1nHLfFw
>>> fEsprXN75kvOc9Jt9Z6odx+XWzZEGrlHRI2wF593BR3vpb2lWoyppP5agFPWeX8=
>>> =hzqM
>>> -----END PGP SIGNATURE----- 
>>> <imon_disc_and_progress.pl><imonlcd.c.diff>_________________________ 
>>> ______________________
>>> LCDproc mailing list
>>> [email protected]
>>> http://lists.omnipotent.net/mailman/listinfo/lcdproc
>>
>
> _______________________________________________
> LCDproc mailing list
> [email protected]
> http://lists.omnipotent.net/mailman/listinfo/lcdproc

_______________________________________________
LCDproc mailing list
[email protected]
http://lists.omnipotent.net/mailman/listinfo/lcdproc
imonlcd_output_bars_spin2.patch (application/octet-stream, 5.2 KB)
--- ./server/drivers/imonlcd.orig.c	2011-03-29 00:00:21.000000000 -0700
+++ ./server/drivers/imonlcd.c	2011-04-20 17:00:10.000000000 -0700
@@ -863,9 +863,31 @@
 	PrivateData *p = drvthis->private_data;
 	uint64_t icon = 0x0;
 
-	if (state == p->last_output_state)
+	if (state == p->last_output_state && !(state & IMON_OUTPUT_CD_MASK))
 		return;
 
+	/* bit 28 : Abuse this for progress bars. See above for usage. */
+	if ((state & IMON_OUTPUT_PBARS_MASK) && state > 0) {
+		/* extract the bar-values for each bar separately */
+		int topProgress = (state & 63);
+		int topLine = (state & (63 << 6)) >> 6;
+		int botProgress = (state & (63 << 12)) >> 12;
+		int botLine = (state & (63 << 18)) >> 18;
+
+		botProgress = botProgress > 32 ? -(botProgress - 32) : botProgress;
+		topProgress = topProgress > 32 ? -(topProgress - 32) : topProgress;
+		botLine = botLine > 32 ? -(botLine - 32) : botLine;
+		topLine = topLine > 32 ? -(topLine - 32) : topLine;
+
+		setLineLength(topLine, botLine, topProgress, botProgress, p);
+		
+		/* only if the cd is set to spin, continue to update the display with the previous icons. */
+		state = p->last_output_state;
+
+		if (! (state & IMON_OUTPUT_CD_MASK))
+			return;
+	}
+	
 	p->last_output_state = state;
 
 	if (state == -1) {	/* the value for "on" in the lcdproc-protocol */
@@ -881,22 +903,7 @@
 		setLineLength(0, 0, 0, 0, p);
 		return;
 	}
-	/* bit 28 : Abuse this for progress bars. See above for usage. */
-	else if ((state & IMON_OUTPUT_PBARS_MASK) != 0 && state > 0) {
-		/* extract the bar-values for each bar separately */
-		int topProgress = (state & 63);
-		int topLine = (state & (63 << 6)) >> 6;
-		int botProgress = (state & (63 << 12)) >> 12;
-		int botLine = (state & (63 << 18)) >> 18;
 
-		botProgress = botProgress > 32 ? -(botProgress - 32) : botProgress;
-		topProgress = topProgress > 32 ? -(topProgress - 32) : topProgress;
-		botLine = botLine > 32 ? -(botLine - 32) : botLine;
-		topLine = topLine > 32 ? -(topLine - 32) : topLine;
-
-		setLineLength(topLine, botLine, topProgress, botProgress, p);
-		return;
-	}
 	/* bit 0 : disc icon (0=off, 1='spin') */
 	if (state & IMON_OUTPUT_CD_MASK) {
 		/* Each icon bit represents a section of the cd,
@@ -917,19 +924,13 @@
 			tmp_cd_bitmap = ~tmp_cd_bitmap;
 
 		icon |= ((uint64_t)tmp_cd_bitmap) << 40;
-
-		/* Change the cached output state so that we will continue to
-		 * update / spin the cd. The set value makes a missed refresh
-		 * or clear very unusual.  The server core makes sure we get
-		 * the correct value next time around.
-		 */
-		p->last_output_state = (~IMON_OUTPUT_PBARS_MASK & ~IMON_OUTPUT_CD_MASK);
 	}
+	
 	/*
 	 * bit 1,2,3 : top row (0=none, 1=music, 2=movie, 3=photo, 4=CD/DVD,
 	 * 5=TV, 6=Web, 7=News/Weather)
 	 */
-	if (((state & IMON_OUTPUT_TOPROW_MASK) != 0)) {
+	if (state & IMON_OUTPUT_TOPROW_MASK) {
 		switch (((state & IMON_OUTPUT_TOPROW_MASK) >> 1)) {
 		case 1:
 			icon |= IMON_ICON_MUSIC;
@@ -987,7 +988,7 @@
 	 * bit 13,14,15: bottom-right icons (0=off, 1=MP3, 2=OGG, 3=WMA,
 	 * 4=WAV)
 	 */
-	if (((state & IMON_OUTPUT_BRICONS_MASK) != 0)) {
+	if (state & IMON_OUTPUT_BRICONS_MASK) {
 		switch (((state & IMON_OUTPUT_BRICONS_MASK) >> 13)) {
 		case 1:
 			icon |= IMON_ICON_MP3;
@@ -1009,7 +1010,7 @@
 	 * bit 16,17,18: bottom-middle icons (0=off, 1=MPG, 2=AC3, 3=DTS,
 	 * 4=WMA)
 	 */
-	if (((state & IMON_OUTPUT_BMICONS_MASK) != 0)) {
+	if (state & IMON_OUTPUT_BMICONS_MASK) {
 		switch (((state & IMON_OUTPUT_BMICONS_MASK) >> 16)) {
 		case 1:
 			icon |= IMON_ICON_MPG2;
@@ -1031,7 +1032,7 @@
 	 * bit 19,20,21: bottom-left icons (0=off, 1=MPG, 2=DIVX, 3=XVID,
 	 * 4=WMV)
 	 */
-	if (((state & IMON_OUTPUT_BLICONS_MASK) != 0)) {
+	if (state & IMON_OUTPUT_BLICONS_MASK) {
 		switch (((state & IMON_OUTPUT_BLICONS_MASK) >> 19)) {
 		case 1:
 			icon |= IMON_ICON_MPG;
@@ -1050,19 +1051,19 @@
 		}
 	}
 	/* bit 22 : 'VOL' (volume) */
-	icon = ((state & IMON_OUTPUT_VOL_MASK) != 0) ? (icon | IMON_ICON_VOL) : (icon & ~IMON_ICON_VOL);
+	if (state & IMON_OUTPUT_VOL_MASK)	icon |= IMON_ICON_VOL;
 	/* bit 23 : 'TIME' */
-	icon = ((state & IMON_OUTPUT_TIME_MASK) != 0) ? (icon | IMON_ICON_TIME) : (icon & ~IMON_ICON_TIME);
+	if (state & IMON_OUTPUT_TIME_MASK)	icon |= IMON_ICON_TIME;
 	/* bit 24 : 'ALARM' */
-	icon = ((state & IMON_OUTPUT_ALARM_MASK) != 0) ? (icon | IMON_ICON_ALARM) : (icon & ~IMON_ICON_ALARM);
+	if (state & IMON_OUTPUT_ALARM_MASK)	icon |= IMON_ICON_ALARM;
 	/* bit 25 : 'REC' (recording) */
-	icon = ((state & IMON_OUTPUT_REC_MASK) != 0) ? (icon | IMON_ICON_REC) : (icon & ~IMON_ICON_REC);
+	if (state & IMON_OUTPUT_REC_MASK)	icon |= IMON_ICON_REC;
 	/* bit 26 : 'REP' (repeat) */
-	icon = ((state & IMON_OUTPUT_REP_MASK) != 0) ? (icon | IMON_ICON_REP) : (icon & ~IMON_ICON_REP);
+	if (state & IMON_OUTPUT_REP_MASK)	icon |= IMON_ICON_REP;
 	/* bit 27 : 'SFL' (shuffle) */
-	icon = ((state & IMON_OUTPUT_SFL_MASK) != 0) ? (icon | IMON_ICON_SFL) : (icon & ~IMON_ICON_SFL);
+	if (state & IMON_OUTPUT_SFL_MASK)	icon |= IMON_ICON_SFL;
 	/* bit 29 : 'disc-in' */
-	icon = ((state & IMON_OUTPUT_DISK_IN_MASK) != 0) ? (icon | IMON_ICON_DISK_IN) : (icon & ~IMON_ICON_DISK_IN);
+	if (state & IMON_OUTPUT_DISK_IN_MASK)	icon |= IMON_ICON_DISK_IN;
 
 	send_command_data(COMMANDS_SET_ICONS | icon, p);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.