From dcef86fb0b752043d17ab1b694b520feaa8b2437 Mon Sep 17 00:00:00 2001 From: Gerold Gruber Date: Fri, 20 Oct 2023 00:56:35 +0200 Subject: [PATCH] fixed min/max wrong set --- src/hddtemp_scsi/get_scsi_temp.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/hddtemp_scsi/get_scsi_temp.c b/src/hddtemp_scsi/get_scsi_temp.c index 434e1d60..e36d3574 100644 --- a/src/hddtemp_scsi/get_scsi_temp.c +++ b/src/hddtemp_scsi/get_scsi_temp.c @@ -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 ) - { - 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 {