Code

aquaero: Fix sensor names
authorAlex Deymo <deymo@chromium.org>
Tue, 13 Aug 2013 07:10:43 +0000 (00:10 -0700)
committerAlex Deymo <deymo@chromium.org>
Tue, 13 Aug 2013 07:10:43 +0000 (00:10 -0700)
This patch replaces some sensor names to more reasonable ones.

src/aquaero.c

index 1dc6640f6734c9880dc0e66d8caf549db42d3e3d..493fbde2757220303c0d7fd394eeba38c08705da 100644 (file)
@@ -19,8 +19,6 @@
  *   Alex Deymo
  **/
 
-#define _BSD_SOURCE
-
 #include "collectd.h"
 #include "common.h"
 #include "plugin.h"
@@ -148,28 +146,29 @@ static int aquaero_read (void)
        /* Fans */
        for (i = 0; i < AQ5_NUM_FAN; i++)
        {
-               if ((aq_sett.fan_data_source[i] != NONE) && (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF))
-               {
-                       snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
-                       aquaero_submit("fanspeed", type_instance, aq_data.fan_rpm[i]);
-                       snprintf(type_instance, sizeof(type_instance), "fan-vrm%d", i+1);
-                       aquaero_submit("temperature", type_instance, aq_data.fan_vrm_temp[i]);
-
-                       snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
-                       aquaero_submit("percentage", type_instance, aq_data.fan_duty[i]);
-
-                       snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
-                       aquaero_submit("voltage", type_instance, aq_data.fan_voltage[i]);
-                       snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
-                       aquaero_submit("current", type_instance, aq_data.fan_current[i]);
-               }
+               if ((aq_sett.fan_data_source[i] == NONE) || (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF))
+                       continue;
+
+               /* Always report fanthe fan VRM (Voltage Regulator) temp if a regulator is installed. */
+               snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
+               aquaero_submit("fanspeed", type_instance, aq_data.fan_rpm[i]);
+               snprintf(type_instance, sizeof(type_instance), "fan-vrm%d", i+1);
+               aquaero_submit("temperature", type_instance, aq_data.fan_vrm_temp[i]);
+
+               snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
+               aquaero_submit("percentage", type_instance, aq_data.fan_duty[i]);
+
+               snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
+               aquaero_submit("voltage", type_instance, aq_data.fan_voltage[i]);
+               snprintf(type_instance, sizeof(type_instance), "fan%d", i+1);
+               aquaero_submit("current", type_instance, aq_data.fan_current[i]);
        }
 
        /* Flow sensors */
        aquaero_submit_array("flow", "flow", aq_data.flow, AQ5_NUM_FLOW);
 
        /* Liquid level */
-       aquaero_submit_array("level", "level", aq_data.level, AQ5_NUM_LEVEL);
+       aquaero_submit_array("percentage", "waterlevel", aq_data.level, AQ5_NUM_LEVEL);
 
        return (0);
 }