diff --git a/core/dev/sht11.c b/core/dev/sht11.c index 957728193..815bf6aa5 100644 --- a/core/dev/sht11.c +++ b/core/dev/sht11.c @@ -250,7 +250,7 @@ sht11_off(void) static unsigned int scmd(unsigned cmd) { - unsigned long n; + unsigned int n; if(cmd != MEASURE_HUMI && cmd != MEASURE_TEMP) { PRINTF("Illegal command: %d\n", cmd); @@ -263,7 +263,7 @@ scmd(unsigned cmd) goto fail; } - for(n = 0; n < 250000; n++) { + for(n = 0; n < 20000; n++) { if(!SDA_IS_1) { unsigned t0, t1, rcrc; t0 = sread(1); @@ -285,8 +285,9 @@ scmd(unsigned cmd) #endif return (t0 << 8) | t1; } + /* short wait before next loop */ + clock_wait(1); } - fail: sreset(); return -1;