refine power module

This commit is contained in:
gcw_4spBpAfv
2026-04-28 16:58:51 +08:00
parent fe3e26e21d
commit 4a3b111ce4
7 changed files with 93 additions and 90 deletions

16
main.py
View File

@@ -14,6 +14,7 @@ from maix.peripheral import adc
import _thread
import os
import json
import time as wall_time
# 导入新模块
import config
@@ -96,12 +97,25 @@ def cmd_str():
# 3. 初始化激光模块(串口 + 开机关闭激光防误触发)
laser_manager.init()
# 3. 初始化 INA226 电量监测芯片
# 3. 初始化 INA226 电量监测芯片(与后续相机启动之间的耗时,便于定位启动卡顿)
_w_boot = wall_time.time()
print(f"[BOOT] init_ina226 开始 wall_s={_w_boot:.3f}")
init_ina226()
print(f"[BOOT] init_ina226 结束 wall +{int(round((wall_time.time() - _w_boot) * 1000))} ms")
# 4. 初始化显示和相机
_w_boot = wall_time.time()
print(
f"[BOOT] init_camera({getattr(config, 'CAMERA_WIDTH', 640)}x{getattr(config, 'CAMERA_HEIGHT', 480)}) "
f"开始 wall_s={_w_boot:.3f}"
)
camera_manager.init_camera(getattr(config, "CAMERA_WIDTH", 640), getattr(config, "CAMERA_HEIGHT", 480))
print(f"[BOOT] init_camera 结束 wall +{int(round((wall_time.time() - _w_boot) * 1000))} ms")
_w_boot = wall_time.time()
print(f"[BOOT] init_display 开始 wall_s={_w_boot:.3f}")
camera_manager.init_display()
print(f"[BOOT] init_display 结束 wall +{int(round((wall_time.time() - _w_boot) * 1000))} ms")
# ==================== 第二阶段:软件初始化 ====================