catdog2/mpy_bh1750fvi_esp8266

OP_SINGLE_HRES2 gets lux doubled

sullivanzheng opened this issue · 0 comments

    return ((raw[0] << 24) | (raw[1] << 16)) // 78642

This segment of code is incorrect since under mode == OP_SINGLE_HRES2, the reading is doubled. So the result need to be divided by 2.

    if mode == OP_SINGLE_HRES2:
      return ((raw[0] << 24) | (raw[1] << 16)) // 78642 //2
    else:
    # we must divide the end result by 1.2 to get the lux
      return ((raw[0] << 24) | (raw[1] << 16)) // 78642