Update lightd code to get lux value without timeout
| | |
| | | |
| | | int rv; |
| | | float lux = 0.0; |
| | | time_t last_time = 0; |
| | | iotd_ctx_t ctx; |
| | | hwinfo_t *hwinfo = &ctx.hwinfo; |
| | | |
| | |
| | | goto nextloop; |
| | | } |
| | | |
| | | /* TSL2561 update lux in every 10 minutes */ |
| | | if(check_timeout(&last_time, 600)) |
| | | /* TSL2561 update lux value now */ |
| | | if( tsl2561_get_lux(&lux) < 0 ) |
| | | { |
| | | if( tsl2561_get_lux(&lux) < 0 ) |
| | | { |
| | | log_error("TSL2561 sample failed, do not turn on the light\n"); |
| | | goto nextloop; |
| | | } |
| | | log_error("TSL2561 sample failed, do not turn on the light\n"); |
| | | goto nextloop; |
| | | } |
| | | |
| | | /* Check need auto light or not */ |