更新 mini固件,RGB 支持老版本21812,LED灯颜色立即生效

This commit is contained in:
dahanzimin
2024-09-13 14:51:32 +08:00
parent 6185efc550
commit c195171ae9
6 changed files with 98 additions and 97 deletions

View File

@@ -228,6 +228,7 @@ class BOT035(FrameBuffer):
"""Reset SPK, PWM, HID registers to default state""" """Reset SPK, PWM, HID registers to default state"""
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_SPK, b'\x0A\x00\x00\x00\x20\x4E\x64\x64') self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_SPK, b'\x0A\x00\x00\x00\x20\x4E\x64\x64')
if self._version: self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_KB, bytes(9)) if self._version: self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_KB, bytes(9))
def get_brightness(self): def get_brightness(self):
return self._brightness return self._brightness

View File

@@ -164,6 +164,7 @@ class LED:
def setcolor(self, index, color): def setcolor(self, index, color):
self._col[index-1] = color self._col[index-1] = color
self.setbrightness(index, 100)
def getcolor(self, index): def getcolor(self, index):
return self._col[index-1] return self._col[index-1]

View File

@@ -37,9 +37,8 @@ class NeoPixel:
def write(self): def write(self):
self.pin.init(self.pin.OUT, value=0) self.pin.init(self.pin.OUT, value=0)
sleep_us(40) bitstream(self.pin, 0, self.timing, bytes(3) + self.rgb_buf)
bitstream(self.pin, 0, self.timing, bytes(3)+self.rgb_buf) sleep_us(150)
sleep_us(40)
self.pin.init(self.pin.IN) self.pin.init(self.pin.IN)
def color_chase(self,R, G, B, wait): def color_chase(self,R, G, B, wait):