Commit a7300fe1 authored by Tristan Gingold's avatar Tristan Gingold

sensors: minor refactoring

parent 1ea37179
...@@ -144,19 +144,16 @@ static int cmd_sensors(const char *args[]) ...@@ -144,19 +144,16 @@ static int cmd_sensors(const char *args[])
{ {
pp_printf("Sensors readout: \n"); pp_printf("Sensors readout: \n");
struct wrc_sensor *s = sensors; struct wrc_sensor *s;
while( s->flags ) for (s = sensors; s->flags; s++) {
{ if (!(s->flags & WRC_SENSOR_VALID))
if( s->flags & WRC_SENSOR_VALID ) continue;
{ pp_printf(" - %-20s %-20s : %05d %s\n",
pp_printf(" - %-20s %-20s : %05d %s\n", sensor_type_string( s->flags ),
sensor_type_string( s->flags ), s->name,
s->name, s->value,
s->value, sensor_unit_string( s->flags )
sensor_unit_string( s->flags )
); );
}
s++;
} }
return 0; return 0;
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
* *
* Released according to the GNU GPL, version 2 or any later version. * Released according to the GNU GPL, version 2 or any later version.
*/ */
#ifndef __TEMPERATURE_H__ #ifndef __SENSORS_H__
#define __TEMPERATURE_H__ #define __SENSORS_H__
#include <stdint.h> #include <stdint.h>
...@@ -59,4 +59,4 @@ struct wrc_sensor* wrc_sensor_find_by_name(char *name); ...@@ -59,4 +59,4 @@ struct wrc_sensor* wrc_sensor_find_by_name(char *name);
struct wrc_sensor* wrc_sensor_find_by_id(uint8_t id); struct wrc_sensor* wrc_sensor_find_by_id(uint8_t id);
struct wrc_sensor* wrc_sensor_find_by_type(uint8_t type); struct wrc_sensor* wrc_sensor_find_by_type(uint8_t type);
#endif /* __TEMPERATURE_H__ */ #endif /* __SENSORS_H__ */
Subproject commit 1ce9244c5c2b3bc8371333abc65e1be04c3fc2ea Subproject commit b9eb3b049d4eb4400426879bc4d225ed0ca7d5dc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment