* Axel Sommerfeldt <axel.sommerfe...@f-m.fm> [2018-04-16 21:25]:
> 1) Done
> 2) "qcontrol fanspeed stop" makes the beeping stop

Thanks for confirming this!

> Creating /etc/qcontrol.d/90-no-fan.conf with the content above makes the 
> beeping stop, too.

Great!

Based on Ian's comments, I added a has_fan to the configuration file.
I believe the attached patch should do the trick.

Axel, can you test this (after restoring the original config).

> Maybe it's a good idea to overwrite the temp() function in
> /etc/qcontrol.d/90-no-fan.conf, too? It could create a log entry if

logtemp() is still being called, so you will get temperate logs.

> the temperature gets hot and make a beep (and a red blinking status
> led) if it gets too hot!?

Maybe, although the fanless devices are designed to work without a fan
so this shouldn't happen.  But what would you consider "too hot"?
Maybe thsi should be in a config variable.

-- 
Martin Michlmayr
http://www.cyrius.com/
diff --git a/examples/ts209.lua b/examples/ts209.lua
index da301a5..51991c8 100644
--- a/examples/ts209.lua
+++ b/examples/ts209.lua
@@ -37,6 +37,13 @@ register("system-status")
 
 -- Set to "false" to suppress the sounding of the buzzer
 buzzer = true
+-- Set to "false" if your device doesn't have a fan (TS-109 and TS-109 II)
+has_fan = true
+
+-- Turn off fan if there is no fan to avoid fan_error() being called
+if not has_fan then
+	piccmd("fanspeed", "stop")
+end
 
 function system_status( status )
 	logprint("System status: "..status)
@@ -88,6 +95,11 @@ end
 last_fan_setting = nil
 
 function setfan( speed )
+	-- Do nothing if there's no fan
+	if not has_fan then
+		return
+	end
+
 	if ( ( not last_fan_setting ) or
 	     ( last_fan_setting ~= speed ) ) then
 		logprint(string.format("ts209: setting fan to \"%s\"", speed))
diff --git a/examples/ts219.lua b/examples/ts219.lua
index ab28d93..97d9b8f 100644
--- a/examples/ts219.lua
+++ b/examples/ts219.lua
@@ -38,6 +38,14 @@ register("system-status")
 -- Set to "false" to suppress the sounding of the buzzer
 buzzer = true
 
+-- Set to "false" if your device doesn't have a fan (TS-119 and HS-210)
+has_fan = true
+
+-- Turn off fan if there is no fan to avoid fan_error() being called
+if not has_fan then
+	piccmd("fanspeed", "stop")
+end
+
 function system_status( status )
 	logprint("System status: "..status)
 	if status == "start" then
@@ -128,6 +136,11 @@ end
 last_fan_setting = nil
 
 function setfan( temp, speed )
+	-- Do nothing if there's no fan
+	if not has_fan then
+		return
+	end
+
 	if ( ( not last_fan_setting ) or
 	     ( last_fan_setting ~= speed ) ) then
 		logprint(string.format("ts219: temperature %d setting fan to \"%s\"", temp, speed))

Reply via email to