Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed min/max wrong set #504

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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