mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 14:25:39 +00:00
Mass reindent and coding style cleanups.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4708 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -32,7 +32,7 @@ extern char degstr[5];
|
||||
|
||||
static inline float deg_ctof(float cel)
|
||||
{
|
||||
return ( cel * ( 9.0F / 5.0F ) + 32.0F );
|
||||
return cel * (9.0F / 5.0F) + 32.0F;
|
||||
}
|
||||
|
||||
/* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only;
|
||||
@@ -40,90 +40,93 @@ static inline float deg_ctof(float cel)
|
||||
for the current temp and the limits
|
||||
note: symbolic constants defined in chips.h */
|
||||
void print_temp_info(float n_cur, float n_over, float n_hyst,
|
||||
int minmax, int curprec, int limitprec)
|
||||
int minmax, int curprec, int limitprec)
|
||||
{
|
||||
/* note: deg_ctof() will preserve HUGEVAL */
|
||||
if (fahrenheit) {
|
||||
n_cur = deg_ctof(n_cur);
|
||||
n_over = deg_ctof(n_over);
|
||||
n_hyst = deg_ctof(n_hyst);
|
||||
}
|
||||
/* note: deg_ctof() will preserve HUGEVAL */
|
||||
if (fahrenheit) {
|
||||
n_cur = deg_ctof(n_cur);
|
||||
n_over = deg_ctof(n_over);
|
||||
n_hyst = deg_ctof(n_hyst);
|
||||
}
|
||||
|
||||
/* use %* to pass precision as an argument */
|
||||
if (n_cur != HUGE_VAL)
|
||||
printf("%+6.*f%s ", curprec, n_cur, degstr);
|
||||
else
|
||||
printf(" FAULT ");
|
||||
/* use %* to pass precision as an argument */
|
||||
if (n_cur != HUGE_VAL)
|
||||
printf("%+6.*f%s ", curprec, n_cur, degstr);
|
||||
else
|
||||
printf(" FAULT ");
|
||||
|
||||
if(minmax == MINMAX)
|
||||
printf("(low = %+5.*f%s, high = %+5.*f%s) ",
|
||||
limitprec, n_hyst, degstr,
|
||||
limitprec, n_over, degstr);
|
||||
else if(minmax == MAXONLY)
|
||||
printf("(high = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr);
|
||||
else if(minmax == CRIT)
|
||||
printf("(high = %+5.*f%s, crit = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr,
|
||||
limitprec, n_hyst, degstr);
|
||||
else if(minmax == HYST)
|
||||
printf("(high = %+5.*f%s, hyst = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr,
|
||||
limitprec, n_hyst, degstr);
|
||||
else if(minmax == HYSTONLY)
|
||||
printf("(hyst = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr);
|
||||
else if(minmax != SINGLE)
|
||||
printf("Unknown temperature mode!");
|
||||
if (minmax == MINMAX)
|
||||
printf("(low = %+5.*f%s, high = %+5.*f%s) ",
|
||||
limitprec, n_hyst, degstr,
|
||||
limitprec, n_over, degstr);
|
||||
else if (minmax == MAXONLY)
|
||||
printf("(high = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr);
|
||||
else if (minmax == CRIT)
|
||||
printf("(high = %+5.*f%s, crit = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr,
|
||||
limitprec, n_hyst, degstr);
|
||||
else if (minmax == HYST)
|
||||
printf("(high = %+5.*f%s, hyst = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr,
|
||||
limitprec, n_hyst, degstr);
|
||||
else if (minmax == HYSTONLY)
|
||||
printf("(hyst = %+5.*f%s) ",
|
||||
limitprec, n_over, degstr);
|
||||
else if (minmax != SINGLE)
|
||||
printf("Unknown temperature mode!");
|
||||
}
|
||||
|
||||
void print_label(const char *label, int space)
|
||||
{
|
||||
int len=strlen(label)+1;
|
||||
if (len > space)
|
||||
printf("%s:\n%*s", label, space, "");
|
||||
else
|
||||
printf("%s:%*s", label, space - len, "");
|
||||
int len = strlen(label)+1;
|
||||
if (len > space)
|
||||
printf("%s:\n%*s", label, space, "");
|
||||
else
|
||||
printf("%s:%*s", label, space - len, "");
|
||||
}
|
||||
|
||||
void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size)
|
||||
{
|
||||
char *label;
|
||||
double vid;
|
||||
char *label;
|
||||
double vid;
|
||||
|
||||
if ((label = sensors_get_label(name, f_vid))
|
||||
&& !sensors_get_value(name, f_vid, &vid)) {
|
||||
print_label(label, label_size);
|
||||
printf("%+6.3f V\n", vid);
|
||||
}
|
||||
free(label);
|
||||
if ((label = sensors_get_label(name, f_vid))
|
||||
&& !sensors_get_value(name, f_vid, &vid)) {
|
||||
print_label(label, label_size);
|
||||
printf("%+6.3f V\n", vid);
|
||||
}
|
||||
free(label);
|
||||
}
|
||||
|
||||
void print_chip_raw(const sensors_chip_name *name)
|
||||
{
|
||||
int a;
|
||||
const sensors_feature_data *data;
|
||||
char *label;
|
||||
double val;
|
||||
|
||||
a = 0;
|
||||
while((data=sensors_get_all_features(name, &a))) {
|
||||
if (!(label = sensors_get_label(name, data->number))) {
|
||||
printf("ERROR: Can't get feature `%s' data!\n",data->name);
|
||||
continue;
|
||||
}
|
||||
if (data->mode & SENSORS_MODE_R) {
|
||||
if (sensors_get_value(name, data->number, &val)) {
|
||||
printf("ERROR: Can't get feature `%s' data!\n",data->name);
|
||||
continue;
|
||||
}
|
||||
if (data->mapping != SENSORS_NO_MAPPING)
|
||||
printf(" %s: %.2f (%s)\n",label,val,data->name);
|
||||
else
|
||||
printf("%s: %.2f (%s)\n",label,val,data->name);
|
||||
} else
|
||||
printf("(%s)\n",label);
|
||||
free(label);
|
||||
}
|
||||
}
|
||||
int a;
|
||||
const sensors_feature_data *data;
|
||||
char *label;
|
||||
double val;
|
||||
|
||||
a = 0;
|
||||
while ((data = sensors_get_all_features(name, &a))) {
|
||||
if (!(label = sensors_get_label(name, data->number))) {
|
||||
printf("ERROR: Can't get feature `%s' data!\n",
|
||||
data->name);
|
||||
continue;
|
||||
}
|
||||
if (data->mode & SENSORS_MODE_R) {
|
||||
if (sensors_get_value(name, data->number, &val)) {
|
||||
printf("ERROR: Can't get feature `%s' data!\n",
|
||||
data->name);
|
||||
continue;
|
||||
}
|
||||
if (data->mapping != SENSORS_NO_MAPPING)
|
||||
printf(" %s: %.2f (%s)\n", label, val,
|
||||
data->name);
|
||||
else
|
||||
printf("%s: %.2f (%s)\n", label, val,
|
||||
data->name);
|
||||
} else
|
||||
printf("(%s)\n", label);
|
||||
free(label);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user