You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fan script did not work properly after installation, so I had a look at the service:
pi@raspberrypi:~ $ sudo systemctl status x-c1-fan.service
● x-c1-fan.service - Daemon to monitor and control fan speed
Loaded: loaded (/lib/systemd/system/x-c1-fan.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2024-11-02 19:43:20 CET; 1h 38min ago
Main PID: 455 (bash)
Tasks: 2 (limit: 4164)
CGroup: /system.slice/x-c1-fan.service
├─ 455 bash /usr/local/bin/x-c1-fan.sh
└─2641 sleep 5
Nov 02 21:21:17 raspberrypi x-c1-fan.sh[455]: /usr/local/bin/x-c1-fan.sh: Zeile 184: printf: 46.74: Ungültige Zahl.
Nov 02 21:21:22 raspberrypi x-c1-fan.sh[455]: /usr/local/bin/x-c1-fan.sh: Zeile 184: printf: 44.79: Ungültige Zahl.
Nov 02 21:21:27 raspberrypi x-c1-fan.sh[455]: /usr/local/bin/x-c1-fan.sh: Zeile 184: printf: 46.74: Ungültige Zahl.
The printf function is used for conversion from float to int, but fails. So I used the builtin number manipulation capabilities of bash instead:
CUR_TEMP=${TEMP/.*} #This does now work as intended
#printf -v CUR_TEMP %0.0f "$TEMP" # Convert float to int, but does not work, original method, now commented out
Now the script works:
pi@raspberrypi:~ $ sudo systemctl status x-c1-fan.service
● x-c1-fan.service - Daemon to monitor and control fan speed
Loaded: loaded (/lib/systemd/system/x-c1-fan.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2024-11-02 21:40:50 CET; 12min ago
Main PID: 26993 (bash)
Tasks: 2 (limit: 4164)
CGroup: /system.slice/x-c1-fan.service
├─ 4042 sleep 5
└─26993 bash /usr/local/bin/x-c1-fan.sh
Nov 02 21:40:50 raspberrypi systemd[1]: Started Daemon to monitor and control fan speed.
Nov 02 21:40:50 raspberrypi x-c1-fan.sh[26993]: Fan speed changed to 45, temp is 46.74
Nov 02 21:42:40 raspberrypi x-c1-fan.sh[26993]: Fan speed changed to 50, temp is 50.63
Nov 02 21:42:55 raspberrypi x-c1-fan.sh[26993]: Fan speed changed to 45, temp is 48.20
The text was updated successfully, but these errors were encountered:
The fan script did not work properly after installation, so I had a look at the service:
The printf function is used for conversion from float to int, but fails. So I used the builtin number manipulation capabilities of bash instead:
Now the script works:
The text was updated successfully, but these errors were encountered: