fixed min/max wrong set

This commit is contained in:
Gerold Gruber
2023-10-20 00:56:35 +02:00
parent 193cc8f0b2
commit dcef86fb0b

View File

@@ -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
{
@@ -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 )
/* not at all of interest */
if( c->temp1_input > c->temp1_highest )
{
c->temp1_max = c->temp1_input;
c->temp1_highest = c->temp1_input;
}
else
if( c->temp1_input < c->temp1_lowest )
{
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 )
{
c->temp1_min = c->temp1_input;
}
else
{
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
{