zocker-160 / thinkfan-ui

A small gui app for Linux to control the fan speed and monitor temps on a ThinkPad
GNU General Public License v3.0
88 stars 8 forks source link

Regex fix for issue #5 #6

Closed blipk closed 1 year ago

blipk commented 1 year ago

There was a couple of issues with the updated regex from the last PR.

I've updated it to fix issue #5 and it should catch some other edge cases as well

Confirmed fix for provided output on #5: image

A better fix may be to use getTempInfo_json instead, then there doesn't have to be any regex involved, you just have to iterate through the devices and then its sensors to see which device has a sensor labelled "CPU", and filter zeroed values or such like.

I'm not sure if the slight performance hit from having to process json will make any difference or not. If you would like me to submit a PR for that I could.

zocker-160 commented 1 year ago

A better fix may be to use getTempInfo_json instead, then there doesn't have to be any regex involved, you just have to iterate through the devices and then its sensors to see which device has a sensor labelled "CPU", and filter zeroed values or such like.

Yes would probably be better, I don't think performance is an issue here, but I personally would leave it as is for now and revisit the json parsing when I do my fan curve implementation, since then I will need a better CPU temp reading anyway.

Currently the CPU temp display is more or less gimmicky anyway as it does not actually do anything regarding the fan.