From 6f589af43af6ef52a47c8038600a4854c8bfe69d Mon Sep 17 00:00:00 2001 From: Gregg Date: Tue, 23 Feb 2021 09:56:45 -0600 Subject: [PATCH] Update DEV_Sensors.h --- examples/12-ServiceLoops/DEV_Sensors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/12-ServiceLoops/DEV_Sensors.h b/examples/12-ServiceLoops/DEV_Sensors.h index 59eb3ca..f7f012c 100644 --- a/examples/12-ServiceLoops/DEV_Sensors.h +++ b/examples/12-ServiceLoops/DEV_Sensors.h @@ -16,7 +16,7 @@ struct DEV_TempSensor : Service::TemperatureSensor { // A standalone Tempera // of Celsius or Fahrenheit for each Service, it does not appear to work as advertised. temp=new Characteristic::CurrentTemperature(30.0); // instantiate the Current Temperature Characteristic - new SpanRange(-50,100,0.5); // expand the range from the HAP default of 0-100 to -50 to 100 to allow for negative temperatures + new SpanRange(-50,100,1); // expand the range from the HAP default of 0-100 to -50 to 100 to allow for negative temperatures Serial.print("Configuring Temperature Sensor"); // initialization message Serial.print("\n"); @@ -39,7 +39,7 @@ struct DEV_TempSensor : Service::TemperatureSensor { // A standalone Tempera void loop(){ if(temp->timeVal()>5000){ // check time elapsed since last update and proceed only if greater than 5 seconds - float temperature=temp->getVal()+0.5; // "simulate" a half-degree temperature change... + float temperature=temp->getVal()+0.5; // "simulate" a half-degree temperature change (it's okay that we set step size in SpanRange to 1)... if(temperature>35.0) // ...but cap the maximum at 35C before starting over at -30C temperature=-30.0;