Closed Pinnchus closed 2 years ago
Hi, think about that case: Just reading the temperature property. Buffer is empty, data is acquired from the sensor and written in the buffer. Temperature is calculated from the buffer. Minutes later your application reads the humidity property. Buffer has data, humidity is calculated from data and: maybe wrong. If buffer was used as cache you would have to implement some invalidation/ttl logic. There would only be a benefit of such an effort if 1) temperature and humidity are required the same time (otherwise it would be slower) and 2) there is time or resource critical application. 1) is something I can not know and if 2) would be the case, you won't use micropython. So I consider a shared buffer or cache as some kind of useless micro optimization, given that I want to have a simple interface for the driver, where you don't need any considerations regarding usage. Just get the data. Hope that answers you question. Best, Andreas
Hi, this is not really a issue but a question, why call _perform_measurement() two times for the same buffer, one call in relative_humidity() and another one in temperature(), why not fill the buffer in _perform_measurement() and use the same buffer saving time? Thanks, Pinnchus