thermocouple: Minor fixes
Send the temperature before checking for an out of range error (that makes it easier to debug). The query_thermocouple clock parameter is unpredictable and a value of zero can't be used to disable the query - use rest_ticks instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7d0f3649f3
commit
7a9553b38a
|
@ -68,9 +68,9 @@ command_query_thermocouple(uint32_t *args)
|
||||||
|
|
||||||
sched_del_timer(&spi->timer);
|
sched_del_timer(&spi->timer);
|
||||||
spi->timer.waketime = args[1];
|
spi->timer.waketime = args[1];
|
||||||
if (! spi->timer.waketime)
|
|
||||||
return;
|
|
||||||
spi->rest_time = args[2];
|
spi->rest_time = args[2];
|
||||||
|
if (! spi->rest_time)
|
||||||
|
return;
|
||||||
spi->min_value = args[3];
|
spi->min_value = args[3];
|
||||||
spi->max_value = args[4];
|
spi->max_value = args[4];
|
||||||
sched_add_timer(&spi->timer);
|
sched_add_timer(&spi->timer);
|
||||||
|
@ -83,12 +83,11 @@ static void
|
||||||
thermocouple_respond(struct thermocouple_spi *spi, uint32_t next_begin_time
|
thermocouple_respond(struct thermocouple_spi *spi, uint32_t next_begin_time
|
||||||
, uint32_t value, uint8_t fault, uint8_t oid)
|
, uint32_t value, uint8_t fault, uint8_t oid)
|
||||||
{
|
{
|
||||||
/* check the result and stop if below or above allowed range */
|
|
||||||
if (value < spi->min_value || value > spi->max_value) {
|
|
||||||
try_shutdown("Thermocouple ADC out of range");
|
|
||||||
}
|
|
||||||
sendf("thermocouple_result oid=%c next_clock=%u value=%u fault=%c",
|
sendf("thermocouple_result oid=%c next_clock=%u value=%u fault=%c",
|
||||||
oid, next_begin_time, value, fault);
|
oid, next_begin_time, value, fault);
|
||||||
|
/* check the result and stop if below or above allowed range */
|
||||||
|
if (value < spi->min_value || value > spi->max_value)
|
||||||
|
try_shutdown("Thermocouple ADC out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue