18
This commit is contained in:
+13
-5
@@ -8,7 +8,7 @@ from laser_manager import laser_manager
|
||||
from logger_manager import logger_manager
|
||||
from network import network_manager
|
||||
from triangle_target import load_camera_from_xml, load_triangle_positions, try_triangle_scoring
|
||||
from vision import estimate_distance, detect_circle_v3, enqueue_save_shot
|
||||
from vision import estimate_distance, detect_circle_v3, enqueue_save_shot, enqueue_save_raw_shot
|
||||
from maix import image, time
|
||||
|
||||
# 缓存相机标定与三角形位置,避免每次射箭重复读磁盘
|
||||
@@ -322,6 +322,11 @@ def process_shot(adc_val):
|
||||
try:
|
||||
frame = camera_manager.read_frame()
|
||||
|
||||
# 在任何检测和绘图之前复制原始帧;默认由配置关闭,不增加量产开销。
|
||||
from shot_id_generator import shot_id_generator
|
||||
shot_id = shot_id_generator.generate_id()
|
||||
enqueue_save_raw_shot(frame, shot_id)
|
||||
|
||||
# 网络事件移到拍照之后,避免阻塞拍照
|
||||
network_manager.safe_enqueue({"shoot_event": "start"}, msg_type=2, high=True)
|
||||
|
||||
@@ -380,10 +385,6 @@ def process_shot(adc_val):
|
||||
if dx is None and dy is None and logger:
|
||||
logger.warning("[MAIN] 未检测到偏移量(三角形与圆形均失败),但会保存图像")
|
||||
|
||||
# 生成射箭ID
|
||||
from shot_id_generator import shot_id_generator
|
||||
shot_id = shot_id_generator.generate_id()
|
||||
|
||||
if logger:
|
||||
logger.info(f"[MAIN] 射箭ID: {shot_id}")
|
||||
|
||||
@@ -441,6 +442,13 @@ def process_shot(adc_val):
|
||||
inner_data["ellipse_center_x"] = None
|
||||
inner_data["ellipse_center_y"] = None
|
||||
|
||||
upload_time_ms = int(time_std.time() * 1000)
|
||||
upload_time_sec, upload_time_millis = divmod(upload_time_ms, 1000)
|
||||
inner_data["upload_time"] = (
|
||||
time_std.strftime("%Y-%m-%d %H:%M:%S", time_std.localtime(upload_time_sec))
|
||||
+ f".{upload_time_millis:03d}"
|
||||
)
|
||||
|
||||
report_data = {"cmd": 1, "data": inner_data}
|
||||
if logger:
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user