build(boards): xpython板卡执行 npm run build:prod

This commit is contained in:
王立帮
2025-12-14 21:18:41 +08:00
parent 26bae5da89
commit 0ff5878d5f
416 changed files with 12404 additions and 48341 deletions

View File

@@ -1,18 +1,16 @@
"""
mixgo_sant Onboard resources(v1.9)
mixgo_sant Onboard resources(v2.0)
Micropython library for the mixgo_sant Onboard resources
=======================================================
@dahanzimin From the Mixly Team
"""
import gc
import time
import math
from machine import *
from music import MIDI
from ws2812x import NeoPixel
from machine import *
import time
import gc
import st7789_cf
import math
'''RTC'''
rtc_clock = RTC()
@@ -33,6 +31,7 @@ except Exception as e:
print("Warning: Failed to communicate with BOT035 (Coprocessor) or", e)
'''TFT/240*240'''
import st7789_cf
onboard_tft = st7789_cf.ST7789(onboard_spi, 240, 240, dc_pin=45, reset=onboard_bot.tft_reset, backlight=onboard_bot.tft_brightness, font_address=0xF00000)
'''ACC-Sensor'''
@@ -83,8 +82,6 @@ onboard_rgb = NeoPixel(onboard_bot.rgb_sync, 4)
onboard_music = MIDI(46, pa_ctrl=onboard_bot.spk_en)
'''5KEY_Sensor'''
class KEYSensor:
def __init__(self, pin, range):
self.pin = pin
@@ -122,10 +119,7 @@ class KEYSensor:
def irq(self, handler, trigger):
Pin(self.pin, Pin.IN).irq(handler=handler, trigger=trigger)
'''1KEY_Button'''
class Button(KEYSensor):
def __init__(self, pin):
self.pin = pin
@@ -135,7 +129,6 @@ class Button(KEYSensor):
def _value(self):
return not self.key.value()
B1key = Button(0)
B2key = KEYSensor(17, 0)
A1key = KEYSensor(17, 1600)
@@ -144,8 +137,6 @@ A3key = KEYSensor(17, 550)
A4key = KEYSensor(17, 2100)
'''2-LED'''
class LED:
def __init__(self, func):
self._func = func
@@ -168,10 +159,8 @@ class LED:
def getonoff(self, index):
return True if self.getbrightness(index) > 50 else False
onboard_led = LED(onboard_bot.led_pwm)
class Voice_Energy:
def read(self, samples=10):
values = []
@@ -180,10 +169,8 @@ class Voice_Energy:
0x08, 3)[:2], 'little')) # 在语音识别里获取
return sorted(values)[samples // 2]
onboard_sound = Voice_Energy()
class Clock:
def __init__(self, x, y, radius, color, oled=onboard_tft): # 定义时钟中心点和半径
self.display = oled
@@ -254,6 +241,5 @@ class Clock:
def clear(self, color=0): # 清除
self.display.ellipse(self.xc, self.yc, self.r, self.r, color, True)
'''Reclaim memory'''
gc.collect()