eskimo
June 17, 2020, 7:23am
1
Can @Setq help to advise on which areas of the code to adjust for more fan steps? I’m looking at 0%, 20%, 40%, 60%, 80% and 100%… this is to help a more granulated approach to the cooling solution and to help balance acoustics if possible…
Editing the file misc.py by inputing the command sudo nano /usr/bin/rockpi-sata/misc.py
change lv2dc = {'lv3': 100, 'lv2': 75, 'lv1': 50, 'lv0': 25}
to lv2dc = {'lv4': 100, 'lv3': 80, 'lv2': 60, 'lv1': 40, 'lv0': 20}
add conf['fan']['lv4'] = cfg.getfloat('fan', 'lv4')
to after conf['fan']['lv3'] = cfg.getfloat('fan', 'lv3')
changing the following values:
conf['fan']['lv0'] = 35
conf['fan']['lv1'] = 40
conf['fan']['lv2'] = 45
conf['fan']['lv3'] = 50
conf['fan']['lv4'] = 55
Also remember to edit the conf file to add lv4
Anything else I am missing?
setq
June 17, 2020, 10:40am
2
Hello, eskimo
There’s nothing missing. That’s all.
eskimo
June 17, 2020, 11:17am
3
What do I need to modify or add if I want to display fan speed in % on the oled display together with CPU/mem usage?
Prefer in the format “Fan Speed: 50%”…
setq
June 17, 2020, 11:21am
4
Modify the gen_pages function of oled.py
eskimo
June 17, 2020, 11:25am
5
What’s the arguments needed to display? I can’t really figure it out what calls to make… (I’m an architect, not a programmer… lol)
edit: after modifying the misc.py, now the OLED display only shows loading…
setq
June 17, 2020, 4:13pm
6
I’ll add it when I have time, and I’ll let you know.
eskimo
June 17, 2020, 4:50pm
7
I figured it out after like 50 trial and errors… reproducing what i did below for those who also want to display the fan speed on your oled…
i added import fan to the header portion, then changed the gen_pages() to this:
def gen_pages():
fanspeed = fan.get_dc()
pages = {
0: [
{'xy': (0, -2), 'text': misc.get_info('up'), 'fill': 255, 'font': font['11']},
{'xy': (0, 10), 'text': misc.get_cpu_temp(), 'fill': 255, 'font': font['11']},
{'xy': (0, 21), 'text': misc.get_info('ip'), 'fill': 255, 'font': font['11']},
],
1: [
{'xy': (0, -2), 'text': misc.get_info('cpu'), 'fill': 255, 'font': font['11']},
{'xy': (0, 10), 'text': misc.get_info('men'), 'fill': 255, 'font': font['11']},
{'xy': (0, 21), 'text': 'Fan Speed: {}%'.format(fanspeed), 'fill': 255, 'font': font['11']},
],
2: put_disk_info()
}
1 Like
eskimo
June 18, 2020, 11:44am
9
@setq , wanna check with you if it is possible to independently control the fan speed of the cpu?
eskimo
June 24, 2020, 8:09am
10
Quad Sata hat been running more than a day now… noticed that the “Uptime” display on the oled will get cut off to show "1day 10:" and the balance text is all cut off… i think the script command may not be effectively crimping the uptime output correctly…
suggest replace
uptime | sed 's/^.* up \+\(.\+\), \+[0-9] user.*$/\\1/' | awk '{printf \"Uptime: %s\", $0}'
with
uptime | cut -c 14- | cut -b -12 | sed 's/day/d/g;s/\:/h/g' | awk '{print "Uptime: " $1 $2 $3 "m"}'
the second command will give me an output of "Uptime: 1d,9h14m" which should fit into the display even up to 100days uptime… havent tested it out yet though, maybe will test it over the weekend… @setq maybe can give some comments on this?
EDIT: DO NOT USE THE ABOVE… IT CRASHED THE SYSTEM HARD! still need to figure out what went wrong…
edit2: did a tiny python script to debug where it went wrong… forgotten some syntax…
uptime | cut -c 14- | cut -b -12 | sed 's/day/d/g;s/\:/h/g' | awk '{print \"Uptime: \" $1 $2 $3 \"m\"}'
setq
June 24, 2020, 8:13am
11
Thank you for your advice.
setq
June 24, 2020, 8:15am
12
It can be controlled independently, and I’ll add it in the next version.
eskimo
June 25, 2020, 2:46am
13
To reply to myself.. i found a more elegant solution after poking around python script and shell commands (i never did programming in my life, EVER)..
uptime2 = subprocess.getoutput("uptime -p | sed 's/day,/d/g;s/hour,/h/g;s/minutes/m/g;s/minute/m/g' | awk '{print \"Uptime: \" $2 $3,$4 $5 $6 $7}'")
which properly outputs Uptime: 1h 39m and should also catch the day portion..
explanation thought process:
uptime -p command produces up 1 hour, 45 minutes as opposed to having to parse the full output from just uptime alone.
using sed command to replace day, with d, hour, with h and minutes/minute with m
use awk to piece the whole thing together. will test again when my system hits more than 1day.
setq
June 25, 2020, 6:47am
14
Amazing! Thank you for trying.
7bpm
June 25, 2020, 10:30pm
15
eskimo:
uptime2 = subprocess.getoutput(“uptime -p | sed ‘s/day,/d/g;s/hour,/h/g;s/minutes/m/g;s/minute/m/g’ | awk ‘{print "Uptime: " $2 $3,$4 $5 $6 $7}’”)
Hi eskimo.!
So in the file
/usr/bin/rockpi-sata/misc.py
we can replace:
‘up’: “uptime | sed ‘s/^.* up +(.+), +[0-9] user.*$/\1/’ | awk ‘{printf "Uptime: %s", $0}’”,
with:
‘up’: “uptime -p | sed ‘s/day,/d/g;s/hour,/h/g;s/minutes/m/g;s/minute/m/g’ | awk ‘{print "Uptime: " $2 $3,$4 $5 $6 $7}’”,
Just checking with you, so i don’t do anything ‘stupid’ on my setup…!
eskimo
June 26, 2020, 1:59am
16
U might wanna hold off changing for a while first till I can get it tested on my nas… been having strange reboots occuring almost daily around 5-7am…
edit: i suspected by strange reboots happen because of watchdog and OMV… disabled watchdog, things seems normal now…
edit2: nope, disabling watchdog doesnt help… still random reboots…
eskimo
June 26, 2020, 4:35pm
17
ok, i tested it out on my system, didnt crash.. so it should work.. here’s the steps:
open the oled.py for edit using sudo nano /usr/bin/rockpi-sata/oled.py
under import fan, add import subprocess
under def gen_pages(): add the line uptime = subprocess.getoutput("uptime -p | sed 's/years,/yr/g;s/year,/yr/g;s/year/yr/g;s/months,/M/g;s/month,/M/g;s/month/M/g;s/weeks,/w/g;s/week,/w/g;s/week/w/g;s/days,/d/g;s/day,/d/g;s/day/d/g;s/hours,/h/g;s/hour,/h/g;s/hour/h/g;s/minutes/m/g;s/minute/m/g' | awk '{print \"Up: \" $2 $3,$4 $5 $6 $7 $8 $9 $10 $11}'")
replace {'xy': (0, -2), 'text': misc.get_info('up'), 'fill': 255, 'font': font['11']},
with {'xy': (0, -2), 'text': '{}'.format(uptime), 'fill': 255, 'font': font['11']},
reboot
edit: if the text gets too long, can consider replacing “Uptime:” with just “Up:”
edit2: realised that uptime -p also uses weeks months and years for uptime, edited the code to take these into consideration..