Skip to content

Commit

Permalink
fixed min/max wrong set
Browse files Browse the repository at this point in the history
  • Loading branch information
ggruber committed Oct 19, 2023
1 parent 193cc8f commit dcef86f
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions src/hddtemp_scsi/get_scsi_temp.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ int nwipe_init_scsi_temperature( nwipe_context_t* c )
c->temp1_lcrit = -40; /* just to give it a value with some kind of sense */
c->temp1_highest = dsk->value;
c->temp1_lowest = dsk->value;
c->temp1_min = dsk->value;
c->temp1_max = dsk->value;
c->temp1_max = dsk->refvalue - 5; /* seems to be kind of useful */
}
else
{
Expand All @@ -116,30 +115,19 @@ int nwipe_get_scsi_temperature( nwipe_context_t* c )
if( scsi_get_temperature( dsk ) == GETTEMP_SUCCESS )
{
c->temp1_input = dsk->value;
if( c->temp1_max == NO_TEMPERATURE_DATA )
{
c->temp1_max = c->temp1_input;
}
else
{
if( c->temp1_input > c->temp1_max )
{
c->temp1_max = c->temp1_input;
c->temp1_highest = c->temp1_input;
}
}
if( c->temp1_min == NO_TEMPERATURE_DATA )

/* not at all of interest */
if( c->temp1_input > c->temp1_highest )
{
c->temp1_min = c->temp1_input;
c->temp1_highest = c->temp1_input;
}
else
if( c->temp1_input < c->temp1_lowest )
{
if( c->temp1_input < c->temp1_min )
{
c->temp1_min = c->temp1_input;
c->temp1_lowest = c->temp1_input;
}
c->temp1_lowest = c->temp1_input;
}

/* end not at all of interest ;-) */

}
else
{
Expand Down

0 comments on commit dcef86f

Please sign in to comment.