diff --git a/examples/osd/arduino-climate3/resources/res-dtemp1.c b/examples/osd/arduino-climate3/resources/res-dtemp1.c index e8e36c656..f19889774 100644 --- a/examples/osd/arduino-climate3/resources/res-dtemp1.c +++ b/examples/osd/arduino-climate3/resources/res-dtemp1.c @@ -53,6 +53,8 @@ RESOURCE(res_dtemp1, NULL, NULL); +extern char d_temp_s[8]; + static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) { @@ -62,12 +64,12 @@ res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferr if(accept == -1 || accept == REST.type.TEXT_PLAIN) { REST.set_header_content_type(response, REST.type.TEXT_PLAIN); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "%s", ds1820[0].stemp); + snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "%s", d_temp_s); REST.set_response_payload(response, buffer, strlen((char *)buffer)); } else if(accept == REST.type.APPLICATION_JSON) { REST.set_header_content_type(response, REST.type.APPLICATION_JSON); - snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "{'temperature':%s}", ds1820[0].stemp); + snprintf((char *)buffer, REST_MAX_CHUNK_SIZE, "{'temperature':%s}", d_temp_s); REST.set_response_payload(response, buffer, strlen((char *)buffer)); } else { diff --git a/examples/osd/arduino-climate3/sketch.pde b/examples/osd/arduino-climate3/sketch.pde index 8abb13ed7..fd1bee2c0 100644 --- a/examples/osd/arduino-climate3/sketch.pde +++ b/examples/osd/arduino-climate3/sketch.pde @@ -127,21 +127,21 @@ void setup (void) } // at project-conf.h -// LOOP_INTERVAL (10 * CLOCK_SECOND) +// LOOP_INTERVAL (20 * CLOCK_SECOND) void loop (void) { mcusleepcycle=0; // dont sleep // call sensors.requestTemperatures() to issue a global temperature // request to all devices on the bus - printf("Requesting temperatures..."); +// printf("Requesting temperatures..."); dsensors.requestTemperatures(); - printf("DONE\n"); +// printf("DONE\n"); // print the device information printData(outsideThermometer,0); htu21d_temp = htu.readTemperature(); htu21d_hum = htu.readHumidity(); - mcusleepcycle=32; // sleep, wakeup every 32 cycles + dtostrf(htu21d_temp , 6, 2, htu21d_temp_s ); dtostrf(htu21d_hum , 6, 2, htu21d_hum_s ); // remove space @@ -155,4 +155,6 @@ void loop (void) // debug only printf("Temp: %s",htu21d_temp_s); printf("\t\tHum: %s\n",htu21d_hum_s); + + mcusleepcycle=32; // sleep, wakeup every 32 cycles }