helmuthdu / conky_colors

CONKY-colors is an easier way to configure Conky
GNU General Public License v3.0
123 stars 39 forks source link

Insonsistent CPU temperature reading behaviour #2

Closed android-808 closed 12 years ago

android-808 commented 12 years ago

I've managed to get it to read the CPU temperature correctly but only if I remove --cpu=2 on default style. When specifying cpu=2 the temperature reading cuts of the unit digit e.g. 28 becomes 2, 18 becomes 1 etc.

I was specifying this as the Atom N270 features Hyperthreading. CPU load on both threads can be different which was why I was using it. It only prints the temperature on CPU 1 in this scenario but thats fine as it really is only one CPU.

After working out that lm_sensors was working correctly, I've tracked down the issue to the CPU temp section of the conkyrc. When one cpu is specified the relevant section becomes:

execi 30 sensors | grep 'Core 0' | cut -c16-17

When two cpus are specified it becomes cut -c15-16, threfore cutting off the second digit.

Looking into the source there appears to be a lot of inconsistancy in the values used for each style, some 16-17 or 15-17 with +/-, some 15-16 and 14-16.

android-808 commented 12 years ago

There seems to be an intermittant problem with the temperature readings now. Every now and again the temperature disappears. Happens with --cpu=2 and without.

Posted here as opposed to a new bug as it was likely caused by the recent change. MIght be worth reverting the change and adjusting the cut params.

helmuthdu commented 12 years ago

I think we gonna wait until monday because i'm not with a linux computer in this weekend...

android-808 commented 12 years ago

I've never delved into sed but I read '.' on its own has some special meaning like match one character. I'm wondering if it disappears only when temperature is a multiple of 10. After some experimenting, I tried escaping the '.' in your last sed command and it seems to be working ok. I've also updated my patch so that it applies the same processing on all other modes.

diff -u src/conkyrc_cairo.c mysrc/conkyrc_cairo.c --- conky_colors.orig/src/conkyrc_cairo.c 2012-03-23 15:03:30.000000000 +0000 +++ conky_colors/src/conkyrc_cairo.c 2012-03-25 17:49:35.421068454 +0100 @@ -195,18 +195,18 @@ fprintf(fp,"${goto 100}${font Ubuntu:style=Bold:size=8}${color2}${freq_g}${color} GHZ${font}\n"); fprintf(fp,"${goto 100}CPU: ${font Ubuntu:style=Bold:size=8}${color1}${cpu cpu0}%%${color}${font}\n"); if (unit == True)

helmuthdu commented 12 years ago

Thx for the patch :) I think theres a way to summit the patch ready to include it instead of plain text... need to check how to do it.