Skip to content

Fix UV index #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions adafruit_si1145.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,23 @@ def uv_index_enabled(self):
def uv_index_enabled(self, enable):
chlist = self._param_query(_RAM_CHLIST)
if enable:
chlist |= 0b01000000
chlist |= 0b10000000
else:
chlist &= ~0b01000000
chlist &= ~0b10000000
self._param_set(_RAM_CHLIST, chlist)
self._als_enabled = enable

self._ucoeff_0 = 0x00
self._ucoeff_1 = 0x02
self._ucoeff_2 = 0x89
self._ucoeff_3 = 0x29
self._ucoeff_0 = (0x29,)
self._ucoeff_1 = (0x89,)
self._ucoeff_2 = (0x02,)
self._ucoeff_3 = (0x00,)

self._uv_index_enabled = enable

@property
def uv_index(self):
"""The UV Index value"""
self._send_command(_CMD_ALS_FORCE)
return self._aux_data[0] / 100

def reset(self):
Expand Down