Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: MBEDTemperature.cpp
- Revision:
- 158:0cecb265bb18
- Parent:
- 135:7f3f963cd159
- Child:
- 192:54b758a8eaaa
--- a/MBEDTemperature.cpp Tue May 13 20:27:11 2014 +0000 +++ b/MBEDTemperature.cpp Mon Jun 30 17:38:36 2014 +0000 @@ -26,6 +26,11 @@ LM75B temp_sensor(TEMP_SENSOR_PIN1,TEMP_SENSOR_PIN2); #include "MBEDTemperature.h" + + // Multitech temp probe: if used, probe the LM75B once only... the multitech unit will drive future temp updates... + #ifdef MULTITECH_TEMP_PROBE + bool oneshot = false; + #endif // default constructor MBEDTemperature::MBEDTemperature(ErrorHandler *error_handler,Resource *resource) : MBEDio(error_handler,resource) { @@ -37,5 +42,9 @@ // update our value void MBEDTemperature::update() { +#ifdef MULTITECH_TEMP_PROBE + if (!oneshot) { if (this->resource() != NULL && this->resource()->getValuePointer() != NULL) sprintf(this->resource()->getValuePointer(),"%.1f",temp_sensor.read()); oneshot = true; } +#else if (this->resource() != NULL && this->resource()->getValuePointer() != NULL) sprintf(this->resource()->getValuePointer(),"%.1f",temp_sensor.read()); +#endif }