Compare commits
2
Commits
v0.5.0
..
0a8f7bcf90
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a8f7bcf90
|
||
|
|
1b1fa0f35b
|
No files matched your search
@@ -200,6 +200,7 @@ pub struct ArmorHealthStore {
|
||||
sink: Mutex<Option<ArmorSink>>,
|
||||
assignments: Mutex<Vec<(u32, u8)>>,
|
||||
match_sink: Mutex<Option<MatchSink>>,
|
||||
mirror_sink: Mutex<Option<Arc<dyn Fn(protocol::CameraMirror) + Send + Sync>>>,
|
||||
match_result_sink: Mutex<Option<MatchResultSink>>,
|
||||
damage_participants: Mutex<HashSet<u32>>,
|
||||
reset: Mutex<Option<crate::armor_reset::ArmorResetTracker>>,
|
||||
@@ -219,6 +220,7 @@ impl ArmorHealthStore {
|
||||
sink: Mutex::new(None),
|
||||
assignments: Mutex::new(Vec::new()),
|
||||
match_sink: Mutex::new(None),
|
||||
mirror_sink: Mutex::new(None),
|
||||
match_result_sink: Mutex::new(None),
|
||||
damage_participants: Mutex::new(HashSet::new()),
|
||||
reset: Mutex::new(None),
|
||||
@@ -278,6 +280,17 @@ impl ArmorHealthStore {
|
||||
|
||||
/// 处理一条上报。测试从这里喂字节。
|
||||
pub fn datagram(&self, bytes: &[u8], from: SocketAddr) {
|
||||
if let Some(packet) = protocol::CameraMirror::decode(bytes) {
|
||||
if let Some(sink) = self
|
||||
.mirror_sink
|
||||
.lock()
|
||||
.expect("mirror sink poisoned")
|
||||
.clone()
|
||||
{
|
||||
sink(packet);
|
||||
}
|
||||
return;
|
||||
}
|
||||
let SocketAddr::V4(addr) = from else {
|
||||
return;
|
||||
};
|
||||
@@ -418,6 +431,9 @@ impl ArmorHealthStore {
|
||||
pub fn set_match_sink(&self, sink: MatchSink) {
|
||||
*self.match_sink.lock().expect("match sink poisoned") = Some(sink);
|
||||
}
|
||||
pub fn set_mirror_sink(&self, sink: Arc<dyn Fn(protocol::CameraMirror) + Send + Sync>) {
|
||||
*self.mirror_sink.lock().expect("mirror sink poisoned") = Some(sink);
|
||||
}
|
||||
pub fn set_match_result_sink(&self, sink: MatchResultSink) {
|
||||
*self
|
||||
.match_result_sink
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct CameraOrientation {
|
||||
pub revision: u64,
|
||||
pub origin: u64,
|
||||
pub mirror: bool,
|
||||
pub mirror_vertical: bool,
|
||||
}
|
||||
pub type CameraMirrors = BTreeMap<String, CameraOrientation>;
|
||||
impl CameraOrientation {
|
||||
pub fn packet(&self, camera_id: u32) -> protocol::CameraMirror {
|
||||
protocol::CameraMirror {
|
||||
camera_id,
|
||||
revision: self.revision,
|
||||
origin: self.origin,
|
||||
mirror: self.mirror,
|
||||
mirror_vertical: self.mirror_vertical,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn merge(entries: &mut CameraMirrors, packet: protocol::CameraMirror) -> bool {
|
||||
if packet.encode().is_none()
|
||||
|| entries
|
||||
.get(&packet.camera_id.to_string())
|
||||
.is_some_and(|old| (old.revision, old.origin) >= (packet.revision, packet.origin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
entries.insert(
|
||||
packet.camera_id.to_string(),
|
||||
CameraOrientation {
|
||||
revision: packet.revision,
|
||||
origin: packet.origin,
|
||||
mirror: packet.mirror,
|
||||
mirror_vertical: packet.mirror_vertical,
|
||||
},
|
||||
);
|
||||
true
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn concurrent_writes_converge_without_echo_or_cross_camera_changes() {
|
||||
let a = protocol::CameraMirror {
|
||||
camera_id: 7,
|
||||
revision: 2,
|
||||
origin: 8,
|
||||
mirror: true,
|
||||
mirror_vertical: false,
|
||||
};
|
||||
let b = protocol::CameraMirror {
|
||||
origin: 9,
|
||||
mirror: false,
|
||||
mirror_vertical: true,
|
||||
..a
|
||||
};
|
||||
let mut left = CameraMirrors::new();
|
||||
let mut right = CameraMirrors::new();
|
||||
merge(&mut left, a);
|
||||
merge(&mut left, b);
|
||||
merge(&mut right, b);
|
||||
assert!(!merge(&mut right, a));
|
||||
assert_eq!(left, right);
|
||||
assert!(!merge(&mut left, b));
|
||||
merge(&mut left, protocol::CameraMirror { camera_id: 9, ..a });
|
||||
assert_eq!(left.len(), 2);
|
||||
let mut config = crate::Config::default();
|
||||
config.camera_mirrors = left;
|
||||
assert_eq!(
|
||||
crate::Config::parse(&toml::to_string(&config).unwrap())
|
||||
.unwrap()
|
||||
.camera_mirrors,
|
||||
config.camera_mirrors
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -440,6 +440,7 @@ pub struct Config {
|
||||
pub mirror: bool,
|
||||
/// 上下镜像,与左右镜像独立;旧配置默认关闭。
|
||||
pub mirror_vertical: bool,
|
||||
pub camera_mirrors: crate::camera_mirror::CameraMirrors,
|
||||
/// 密码的 Argon2id PHC 字符串。`None` = 还没设过。
|
||||
///
|
||||
/// 只对用户端有意义([`Role::needs_password`])。
|
||||
@@ -466,6 +467,7 @@ impl Default for Config {
|
||||
armor_id: None,
|
||||
mirror: true,
|
||||
mirror_vertical: false,
|
||||
camera_mirrors: Default::default(),
|
||||
password: None,
|
||||
hud: HudConfig::default(),
|
||||
referee: RefereeConfig::default(),
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
pub mod armor;
|
||||
pub mod armor_reset;
|
||||
pub mod config;
|
||||
pub mod camera_mirror;
|
||||
pub mod mirror_transport;
|
||||
pub mod match_clock;
|
||||
pub mod operator;
|
||||
pub mod password;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//! 镜像使用独立的组播监听。同机多实例均可收到消息,不争用装甲板单播回执端口。
|
||||
use std::net::{Ipv4Addr, SocketAddrV4, UdpSocket};
|
||||
use std::time::Duration;
|
||||
pub const GROUP: Ipv4Addr = Ipv4Addr::new(239, 255, 56, 2);
|
||||
pub const PORT: u16 = 5602;
|
||||
pub fn bind() -> std::io::Result<UdpSocket> {
|
||||
let socket = socket2::Socket::new(
|
||||
socket2::Domain::IPV4,
|
||||
socket2::Type::DGRAM,
|
||||
Some(socket2::Protocol::UDP),
|
||||
)?;
|
||||
socket.set_reuse_address(true)?;
|
||||
socket.bind(&SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, PORT).into())?;
|
||||
let socket: UdpSocket = socket.into();
|
||||
socket.join_multicast_v4(&GROUP, &Ipv4Addr::UNSPECIFIED)?;
|
||||
socket.set_multicast_loop_v4(true)?;
|
||||
socket.set_multicast_ttl_v4(1)?;
|
||||
socket.set_read_timeout(Some(Duration::from_millis(200)))?;
|
||||
socket.set_write_timeout(Some(Duration::from_millis(10)))?;
|
||||
Ok(socket)
|
||||
}
|
||||
pub fn spawn(
|
||||
socket: UdpSocket,
|
||||
sink: impl Fn(protocol::CameraMirror) + Send + 'static,
|
||||
) -> std::io::Result<()> {
|
||||
std::thread::Builder::new()
|
||||
.name("mirror-reader".into())
|
||||
.spawn(move || {
|
||||
let mut bytes = [0u8; 128];
|
||||
loop {
|
||||
match socket.recv_from(&mut bytes) {
|
||||
Ok((len, _)) => {
|
||||
if let Some(packet) = protocol::CameraMirror::decode(&bytes[..len]) {
|
||||
sink(packet);
|
||||
}
|
||||
}
|
||||
Err(e)
|
||||
if matches!(
|
||||
e.kind(),
|
||||
std::io::ErrorKind::TimedOut | std::io::ErrorKind::WouldBlock
|
||||
) => {}
|
||||
Err(_) => std::thread::sleep(Duration::from_millis(200)),
|
||||
}
|
||||
}
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -385,6 +385,7 @@ pub struct SlotsDto {
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Snapshot {
|
||||
pub camera_mirrors: crate::camera_mirror::CameraMirrors,
|
||||
pub operator_control: crate::operator::OperatorView,
|
||||
pub match_clock: crate::match_clock::MatchView,
|
||||
pub role: Role,
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
use cam_core::{armor::ArmorHealthStore, camera_mirror::{merge, CameraMirrors}};
|
||||
use std::{net::UdpSocket, sync::{Arc,Mutex}, time::Duration};
|
||||
#[test]
|
||||
fn bidirectional_udp_mirrors_remain_camera_scoped_and_ignore_stale_echoes() {
|
||||
let left=ArmorHealthStore::new();let right=ArmorHealthStore::new();
|
||||
let a=Arc::new(Mutex::new(CameraMirrors::new()));let b=Arc::new(Mutex::new(CameraMirrors::new()));
|
||||
let copy=a.clone();left.set_mirror_sink(Arc::new(move|p|{merge(&mut copy.lock().unwrap(),p);}));
|
||||
let copy=b.clone();right.set_mirror_sink(Arc::new(move|p|{merge(&mut copy.lock().unwrap(),p);}));
|
||||
let tx=UdpSocket::bind("127.0.0.1:0").unwrap();let rx=UdpSocket::bind("127.0.0.1:0").unwrap();
|
||||
rx.set_read_timeout(Some(Duration::from_secs(1))).unwrap();
|
||||
let transfer=|packet:protocol::CameraMirror,store:&ArmorHealthStore|{
|
||||
tx.send_to(&packet.encode().unwrap(),rx.local_addr().unwrap()).unwrap();let mut buf=[0;128];let(n,from)=rx.recv_from(&mut buf).unwrap();store.datagram(&buf[..n],from);
|
||||
};
|
||||
let first=protocol::CameraMirror{camera_id:17,revision:1,origin:3,mirror:true,mirror_vertical:true};
|
||||
transfer(first,&right);
|
||||
let second=protocol::CameraMirror{revision:2,origin:4,mirror:false,..first};
|
||||
transfer(second,&left);transfer(second,&right);transfer(first,&left);
|
||||
assert_eq!(*a.lock().unwrap(),*b.lock().unwrap());assert!(!a.lock().unwrap()["17"].mirror);
|
||||
transfer(protocol::CameraMirror{camera_id:18,..first},&right);
|
||||
assert_eq!(a.lock().unwrap().len(),1);assert_eq!(b.lock().unwrap().len(),2);
|
||||
assert!(left.boards().is_empty());assert!(right.boards().is_empty());
|
||||
}
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "rmic-2026",
|
||||
"private": true,
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.1",
|
||||
"type": "module",
|
||||
"description": "RMIC::2026 —— ESP32 图传与装甲板系统的桌面端:用户端(装甲条 + 瞄准器)与裁判端(双路 + 装甲板 + 录制)",
|
||||
"scripts": {
|
||||
@@ -17,6 +17,7 @@
|
||||
"test:stream": "node --test scripts/test-stream.mjs",
|
||||
"test:latency": "node --test scripts/test-latency-marker.mjs",
|
||||
"test:match": "node --test scripts/test-match-clock.mjs",
|
||||
"test:mirror-instances": "node scripts/test-mirror-instances.mjs",
|
||||
"test:input": "node --test scripts/test-operator-input.mjs",
|
||||
"test:video": "node --test scripts/test-video-transform.mjs scripts/test-operator-hud.mjs",
|
||||
"test:maintenance": "node --test scripts/test-maintenance.mjs"
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import {spawn} from 'node:child_process';
|
||||
import assert from 'node:assert/strict';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import net from 'node:net';
|
||||
const repo=fileURLToPath(new URL('../../',import.meta.url));
|
||||
const folder=path.join(repo,'target',`mirror-instances-${Date.now()}-${process.pid}`);
|
||||
const exe=process.argv[2] ? path.resolve(process.argv[2]) : path.join(repo,'client/src-tauri/target/x86_64-pc-windows-msvc/debug/cam-desktop.exe');
|
||||
await fs.access(exe);await fs.mkdir(folder,{recursive:true});
|
||||
await fs.writeFile(path.join(folder,'team.toml'),'role = "team"\nroleChosen = false\ncameraId = "0x0DE00001"\nmirror = true\nmirrorVertical = false\n');
|
||||
await fs.writeFile(path.join(folder,'referee.toml'),'role = "referee"\nroleChosen = false\nmirror = true\nmirrorVertical = false\n[referee]\nmanualSlots = true\nslotA = "0x0DE00001"\nslotB = "0x0DE00002"\n');
|
||||
const freePort=()=>new Promise((resolve,reject)=>{const s=net.createServer();s.on('error',reject);s.listen(0,'127.0.0.1',()=>{const port=s.address().port;s.close(()=>resolve(port));});});
|
||||
const ports={team:await freePort(),referee:await freePort()};
|
||||
const pids={};
|
||||
const clients={};const results=[];const pause=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
async function connect(name){
|
||||
const port=ports[name];
|
||||
for(let attempt=0;attempt<80;attempt++)try{
|
||||
const tabs=await(await fetch(`http://127.0.0.1:${port}/json`)).json();
|
||||
const tab=tabs.find(t=>t.type==='page'&&!t.url.startsWith('devtools:'));
|
||||
if(!tab)throw Error('page loading');
|
||||
const ws=new WebSocket(tab.webSocketDebuggerUrl);await new Promise(r=>ws.addEventListener('open',r,{once:true}));
|
||||
let seq=0;const pending=new Map();ws.onmessage=e=>{const m=JSON.parse(e.data);if(m.id){pending.get(m.id)?.(m);pending.delete(m.id);}};
|
||||
const run=expression=>new Promise((resolve,reject)=>{const id=++seq;pending.set(id,m=>{if(m.error||m.result?.exceptionDetails)reject(Error(JSON.stringify(m)));else resolve(m.result.result.value);});ws.send(JSON.stringify({id,method:'Runtime.evaluate',params:{expression,awaitPromise:true,returnByValue:true}}));});
|
||||
clients[name]={ws,run,invoke:(command,args={})=>run(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(command)},${JSON.stringify(args)})`)};
|
||||
await clients[name].invoke('get_snapshot');return;
|
||||
}catch(e){if(attempt===79)throw e;await pause(250);}
|
||||
}
|
||||
const snap=name=>clients[name].invoke('get_snapshot');
|
||||
const set=(name,camera,mirror,mirrorVertical)=>clients[name].invoke('set_camera_mirror',{camera,mirror,mirrorVertical});
|
||||
const A=0x0de00001,B=0x0de00002;
|
||||
async function waitFor(check,label){for(let n=0;n<60;n++){if(await check()){results.push(label);return;}await pause(100);}throw Error(`Timeout: ${label}`);}
|
||||
async function agree(camera,mirror,vertical){const[a,b]=await Promise.all([snap('team'),snap('referee')]);const x=a.cameraMirrors[camera],y=b.cameraMirrors[camera];return !!x&&!!y&&x.revision===y.revision&&x.origin===y.origin&&x.mirror===y.mirror&&x.mirrorVertical===y.mirrorVertical&&(mirror===undefined||x.mirror===mirror)&&(vertical===undefined||x.mirrorVertical===vertical);}
|
||||
async function stop(name){clients[name]?.ws.close();try{process.kill(pids[name]);}catch{}await pause(800);}
|
||||
async function restart(name){
|
||||
const env={...process.env,WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS:`--remote-debugging-port=${ports[name]}`,WEBVIEW2_USER_DATA_FOLDER:path.join(folder,name+'-webview')};
|
||||
const child=spawn(exe,['--config',path.join(folder,name+'.toml')],{env,windowsHide:true,stdio:'ignore'});pids[name]=child.pid;
|
||||
await fs.writeFile(path.join(folder,'pids.json'),JSON.stringify(pids));await connect(name);
|
||||
}
|
||||
try{
|
||||
await Promise.all([restart('team'),restart('referee')]);
|
||||
for(const name of ['team','referee'])assert.equal((await snap(name)).config.roleChosen,false,'isolated fixtures must never broadcast official match states');
|
||||
assert.equal((await snap('referee')).slots.cameraA,A);assert.equal((await snap('referee')).slots.cameraB,B);
|
||||
await set('team',A,false,true);await waitFor(()=>agree(A,false,true),'player A → referee A');
|
||||
await set('referee',B,false,false);await pause(500);
|
||||
assert.equal((await snap('team')).cameraMirrors[B],undefined);assert.equal((await snap('referee')).cameraMirrors[A].mirrorVertical,true);results.push('B independent of A, player ignores unbound B');
|
||||
await set('referee',A,true,false);await waitFor(()=>agree(A,true,false),'referee A → player A');
|
||||
for(let n=0;n<12;n++){
|
||||
await Promise.all([set('team',A,false,!!(n%2)),set('referee',A,true,!(n%2))]);
|
||||
await waitFor(()=>agree(A),`concurrent edit ${n+1} converges`);
|
||||
}
|
||||
await stop('team');await set('referee',A,false,true);await restart('team');
|
||||
await waitFor(()=>agree(A,false,true),'player restart catches newer referee revision');
|
||||
await stop('referee');await set('team',A,true,false);await restart('referee');
|
||||
await waitFor(()=>agree(A,true,false),'referee restart catches newer player revision');
|
||||
assert.equal((await snap('referee')).cameraMirrors[B].mirror,false);results.push('B persists through referee restart');
|
||||
await stop('team');let config=await fs.readFile(path.join(folder,'team.toml'),'utf8');config=config.replace('cameraId = "0x0DE00001"','cameraId = "0x0DE00002"');await fs.writeFile(path.join(folder,'team.toml'),config);await restart('team');
|
||||
assert.equal((await snap('team')).config.cameraId,B);
|
||||
await set('team',B,true,true);await waitFor(()=>agree(B,true,true),'player rebound to B → referee B');
|
||||
assert.equal((await snap('referee')).cameraMirrors[A].mirror,true);assert.equal((await snap('referee')).cameraMirrors[A].mirrorVertical,false);
|
||||
await set('referee',B,false,true);await waitFor(()=>agree(B,false,true),'referee B → rebound player B');
|
||||
await stop('team');await stop('referee');await Promise.all([restart('team'),restart('referee')]);
|
||||
await waitFor(()=>agree(B,false,true),'both processes restart with consistent persisted state');
|
||||
const final={team:await snap('team'),referee:await snap('referee')};
|
||||
await fs.writeFile(path.join(folder,'report.json'),JSON.stringify({actualNativeProcesses:true,syntheticCameraIds:true,officialClockDisabled:true,results,finalMirrors:{team:final.team.cameraMirrors,referee:final.referee.cameraMirrors}},null,2));
|
||||
console.log(JSON.stringify({passed:results.length,report:path.join(folder,'report.json'),results},null,2));
|
||||
}finally{for(const name of ['team','referee'])await stop(name);}
|
||||
@@ -234,9 +234,7 @@ pub fn set_role(
|
||||
/// 左右镜像。摄像头装反了才需要,不是判罚相关的东西,所以不设密码。
|
||||
#[tauri::command]
|
||||
pub fn set_mirror(mirror: bool, state: Shared<'_>) -> Result<ConfigView, String> {
|
||||
state
|
||||
.update_config(move |config| config.mirror = mirror)
|
||||
.map_err(|err| format!("{err}"))?;
|
||||
state.set_camera_mirror(None, Some(mirror), None)?;
|
||||
|
||||
Ok(ConfigView::from(&state.config()))
|
||||
}
|
||||
@@ -244,13 +242,21 @@ pub fn set_mirror(mirror: bool, state: Shared<'_>) -> Result<ConfigView, String>
|
||||
/// 上下镜像,独立保存,不改动左右镜像。
|
||||
#[tauri::command]
|
||||
pub fn set_mirror_vertical(mirror_vertical: bool, state: Shared<'_>) -> Result<ConfigView, String> {
|
||||
state
|
||||
.update_config(move |config| config.mirror_vertical = mirror_vertical)
|
||||
.map_err(|err| format!("{err}"))?;
|
||||
state.set_camera_mirror(None, None, Some(mirror_vertical))?;
|
||||
|
||||
Ok(ConfigView::from(&state.config()))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_camera_mirror(
|
||||
camera: u32,
|
||||
mirror: bool,
|
||||
mirror_vertical: bool,
|
||||
state: Shared<'_>,
|
||||
) -> Result<(), String> {
|
||||
state.set_camera_mirror(Some(camera), Some(mirror), Some(mirror_vertical))
|
||||
}
|
||||
|
||||
/// 保存 HUD 设置(血条、瞄准器、网格、命中反馈)。
|
||||
#[tauri::command]
|
||||
pub fn save_hud(hud: HudConfig, state: Shared<'_>) -> Result<ConfigView, String> {
|
||||
|
||||
@@ -344,6 +344,7 @@ fn run() -> Result<(), Box<dyn Error>> {
|
||||
commands::set_team,
|
||||
commands::set_role,
|
||||
commands::set_mirror,
|
||||
commands::set_camera_mirror,
|
||||
commands::set_mirror_vertical,
|
||||
commands::save_hud,
|
||||
commands::set_team_name,
|
||||
|
||||
@@ -60,6 +60,9 @@ pub struct AppState {
|
||||
match_socket: Option<std::net::UdpSocket>,
|
||||
match_error: Mutex<Option<String>>,
|
||||
match_changed: tokio::sync::Notify,
|
||||
mirror_inbox: Mutex<cam_core::camera_mirror::CameraMirrors>,
|
||||
mirror_origin: u64,
|
||||
mirror_socket: Option<std::net::UdpSocket>,
|
||||
operator: Mutex<OperatorState>,
|
||||
operator_socket: Option<std::net::UdpSocket>,
|
||||
operator_focused: AtomicBool,
|
||||
@@ -90,6 +93,140 @@ pub struct AppState {
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
fn mirror_targets(&self) -> Vec<u32> {
|
||||
let config = self.config();
|
||||
if config.role == Role::Team {
|
||||
config.camera_id.into_iter().collect()
|
||||
} else {
|
||||
self.slots
|
||||
.lock()
|
||||
.expect("slots poisoned")
|
||||
.slots()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_camera_mirror(
|
||||
&self,
|
||||
camera: Option<u32>,
|
||||
horizontal: Option<bool>,
|
||||
vertical: Option<bool>,
|
||||
) -> Result<(), String> {
|
||||
let targets = self.mirror_targets();
|
||||
let ids = match camera {
|
||||
Some(id) if targets.contains(&id) => vec![id],
|
||||
Some(_) => return Err("只能修改已绑定或当前槽位的图传板".into()),
|
||||
None => targets,
|
||||
};
|
||||
// 先观察已收到但尚未应用的远端修订,避免紧接收到包后的本地点击被旧包覆盖。
|
||||
self.tick_mirrors();
|
||||
let mut config = self.config.lock().expect("config poisoned");
|
||||
let revision = config
|
||||
.camera_mirrors
|
||||
.values()
|
||||
.map(|v| v.revision)
|
||||
.max()
|
||||
.unwrap_or(0)
|
||||
.checked_add(1)
|
||||
.ok_or("镜像修订号已用尽")?;
|
||||
for id in ids {
|
||||
let old = config.camera_mirrors.get(&id.to_string());
|
||||
let packet = protocol::CameraMirror {
|
||||
camera_id: id,
|
||||
revision,
|
||||
origin: self.mirror_origin,
|
||||
mirror: horizontal.unwrap_or(old.map_or(config.mirror, |v| v.mirror)),
|
||||
mirror_vertical: vertical
|
||||
.unwrap_or(old.map_or(config.mirror_vertical, |v| v.mirror_vertical)),
|
||||
};
|
||||
cam_core::camera_mirror::merge(&mut config.camera_mirrors, packet);
|
||||
}
|
||||
if camera.is_none() || config.role == Role::Team {
|
||||
if let Some(v) = horizontal {
|
||||
config.mirror = v;
|
||||
}
|
||||
if let Some(v) = vertical {
|
||||
config.mirror_vertical = v;
|
||||
}
|
||||
}
|
||||
config
|
||||
.save(&self.config_path)
|
||||
.map_err(|e| format!("镜像已在本次运行生效,但保存失败:{e}"))?;
|
||||
drop(config);
|
||||
self.tick_mirrors();
|
||||
self.push_snapshot();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn tick_mirrors(&self) {
|
||||
let targets = self.mirror_targets();
|
||||
let inbox = std::mem::take(&mut *self.mirror_inbox.lock().expect("mirror inbox poisoned"));
|
||||
let mut config = self.config.lock().expect("config poisoned");
|
||||
let mut changed = false;
|
||||
for (id, value) in inbox {
|
||||
if let Ok(id) = id.parse::<u32>() {
|
||||
if targets.contains(&id) {
|
||||
changed |= cam_core::camera_mirror::merge(
|
||||
&mut config.camera_mirrors,
|
||||
value.packet(id),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if config.role == Role::Team {
|
||||
if let Some(value) = config
|
||||
.camera_id
|
||||
.and_then(|id| config.camera_mirrors.get(&id.to_string()))
|
||||
.cloned()
|
||||
{
|
||||
config.mirror = value.mirror;
|
||||
config.mirror_vertical = value.mirror_vertical;
|
||||
}
|
||||
}
|
||||
if changed {
|
||||
if let Err(error) = config.save(&self.config_path) {
|
||||
log::warn!("镜像同步保存失败:{error}");
|
||||
}
|
||||
}
|
||||
let packets: Vec<_> = targets
|
||||
.into_iter()
|
||||
.filter_map(|id| {
|
||||
config
|
||||
.camera_mirrors
|
||||
.get(&id.to_string())
|
||||
.map(|v| v.packet(id))
|
||||
})
|
||||
.collect();
|
||||
drop(config);
|
||||
if !self.demo {
|
||||
if let Some(socket) = &self.mirror_socket {
|
||||
for packet in &packets {
|
||||
if let Some(bytes) = packet.encode() {
|
||||
let _ = socket.send_to(
|
||||
&bytes,
|
||||
(
|
||||
cam_core::mirror_transport::GROUP,
|
||||
cam_core::mirror_transport::PORT,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(socket) = &self.match_socket {
|
||||
for packet in packets {
|
||||
if let Some(bytes) = packet.encode() {
|
||||
let _ = socket.send_to(
|
||||
&bytes,
|
||||
(std::net::Ipv4Addr::BROADCAST, protocol::ARMOR_PORT),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn operator_context(&self) -> OperatorContext {
|
||||
let config = self.config();
|
||||
let clock = self.match_view();
|
||||
@@ -432,6 +569,15 @@ impl AppState {
|
||||
match_socket,
|
||||
match_error: Mutex::new(match_error),
|
||||
match_changed: tokio::sync::Notify::new(),
|
||||
mirror_inbox: Mutex::new(Default::default()),
|
||||
mirror_origin: session.max(1),
|
||||
mirror_socket: match cam_core::mirror_transport::bind() {
|
||||
Ok(socket) => Some(socket),
|
||||
Err(error) => {
|
||||
log::warn!("镜像组播不可用,保留 UDP 5601 广播同步:{error}");
|
||||
None
|
||||
}
|
||||
},
|
||||
operator: Mutex::new(OperatorState::new(session)),
|
||||
operator_socket,
|
||||
operator_focused: AtomicBool::new(true),
|
||||
@@ -462,6 +608,34 @@ impl AppState {
|
||||
///
|
||||
/// 必须在 `Arc<AppState>` 建好之后调用(sink 里要持有 state 的通道)。
|
||||
pub fn install_sinks(self: &Arc<Self>) {
|
||||
if !self.demo {
|
||||
if let Some(socket) = self.mirror_socket.as_ref().and_then(|s| s.try_clone().ok()) {
|
||||
let weak = Arc::downgrade(self);
|
||||
if let Err(error) = cam_core::mirror_transport::spawn(socket, move |packet| {
|
||||
if let Some(state) = weak.upgrade() {
|
||||
if state.mirror_targets().contains(&packet.camera_id) {
|
||||
cam_core::camera_mirror::merge(
|
||||
&mut state.mirror_inbox.lock().expect("mirror inbox poisoned"),
|
||||
packet,
|
||||
);
|
||||
}
|
||||
}
|
||||
}) {
|
||||
log::warn!("无法启动镜像组播接收:{error}");
|
||||
}
|
||||
}
|
||||
}
|
||||
let weak = Arc::downgrade(self);
|
||||
self.armor.set_mirror_sink(Arc::new(move |packet| {
|
||||
if let Some(state) = weak.upgrade() {
|
||||
if !state.demo && state.mirror_targets().contains(&packet.camera_id) {
|
||||
cam_core::camera_mirror::merge(
|
||||
&mut state.mirror_inbox.lock().expect("mirror inbox poisoned"),
|
||||
packet,
|
||||
);
|
||||
}
|
||||
}
|
||||
}));
|
||||
let weak = Arc::downgrade(self);
|
||||
self.armor.set_match_sink(Arc::new(move |packet, ip| {
|
||||
if let Some(state) = weak.upgrade() {
|
||||
@@ -848,6 +1022,7 @@ impl AppState {
|
||||
}
|
||||
|
||||
pub fn tick(&self) {
|
||||
self.tick_mirrors();
|
||||
self.tick_match();
|
||||
let online: Vec<u32> = self
|
||||
.discovery
|
||||
@@ -958,12 +1133,19 @@ impl AppState {
|
||||
.apply_outcomes(&mut health);
|
||||
|
||||
Snapshot {
|
||||
camera_mirrors: config.camera_mirrors.clone(),
|
||||
operator_control: self.operator.lock().expect("operator poisoned").view(),
|
||||
match_clock: self.match_view(),
|
||||
role: config.role,
|
||||
team: config.team,
|
||||
mirrored: config.mirror,
|
||||
mirrored_vertical: config.mirror_vertical,
|
||||
mirrored: config
|
||||
.camera_id
|
||||
.and_then(|id| config.camera_mirrors.get(&id.to_string()))
|
||||
.map_or(config.mirror, |v| v.mirror),
|
||||
mirrored_vertical: config
|
||||
.camera_id
|
||||
.and_then(|id| config.camera_mirrors.get(&id.to_string()))
|
||||
.map_or(config.mirror_vertical, |v| v.mirror_vertical),
|
||||
demo: self.demo,
|
||||
diagnostics,
|
||||
unlocked: self.is_unlocked(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "RMIC-2026",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.1",
|
||||
"identifier": "com.simbarobotics.rmic2026",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
+2
-2
@@ -124,7 +124,7 @@ export default function App() {
|
||||
}, []);
|
||||
|
||||
const milestones = [
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS · JETBRAINS", done: fontsReady },
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS / JETBRAINS", done: fontsReady },
|
||||
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: url !== null },
|
||||
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: snapshot !== null },
|
||||
];
|
||||
@@ -375,7 +375,7 @@ export default function App() {
|
||||
if (!snapshot) {
|
||||
return (
|
||||
<div className="splash">
|
||||
<span className="splash__mark label">RMIC · 2026</span>
|
||||
<span className="splash__mark label">RMIC / 2026</span>
|
||||
<h1 className="splash__title">正在读取运行状态</h1>
|
||||
<p className="splash__text">
|
||||
{connected ? "已连接,等待状态数据…" : "正在连接本机服务…"}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Source: https://github.com/google/material-design-icons/tree/master/symbols/web
|
||||
// License and attribution ship in client/public/licenses/material-symbols/.
|
||||
export const materialPaths = {
|
||||
mirrorHorizontal: ["M450-840h60v720h-60v-720ZM100-240v-480l280 240L100-240Zm80-170 77-70-77-70v140Zm680 170L580-480l280-240v480Zm-80-170v-140l-77 70 77 70Z"],
|
||||
mirrorVertical: ["M120-510h720v60H120v-60Zm120-350 240 280 240-280H240Zm170 80h140l-70 77-70-77ZM240-100l240-280 240 280H240Zm170-80h140l-70-77-70 77Z"],
|
||||
close: ["M480-424 284-228q-11 11-28 11t-28-11q-11-11-11-28t11-28l196-196-196-196q-11-11-11-28t11-28q11-11 28-11t28 11l196 196 196-196q11-11 28-11t28 11q11 11 11 28t-11 28L536-480l196 196q11 11 11 28t-11 28q-11 11-28 11t-28-11L480-424Z"],
|
||||
back: ["m313-440 196 196q12 12 11.5 28T508-188q-12 11-28 11.5T452-188L188-452q-6-6-8.5-13t-2.5-15q0-8 2.5-15t8.5-13l264-264q11-11 27.5-11t28.5 11q12 12 12 28.5T508-715L313-520h447q17 0 28.5 11.5T800-480q0 17-11.5 28.5T760-440H313Z"],
|
||||
next: ["M647-440H200q-17 0-28.5-11.5T160-480q0-17 11.5-28.5T200-520h447L451-716q-12-12-11.5-28t12.5-28q12-11 28-11.5t28 11.5l264 264q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L508-188q-11 11-27.5 11T452-188q-12-12-12-28.5t12-28.5l195-195Z"],
|
||||
|
||||
@@ -83,9 +83,9 @@ export function ArmorTable({ boards, slots, names, focusTeam = null }: Props) {
|
||||
{shown.map((board) => {
|
||||
const assigned =
|
||||
slots.armorA === board.id
|
||||
? `左 · ${teamName(0, names)}`
|
||||
? `左 / ${teamName(0, names)}`
|
||||
: slots.armorB === board.id
|
||||
? `右 · ${teamName(1, names)}`
|
||||
? `右 / ${teamName(1, names)}`
|
||||
: "未分配";
|
||||
const tone = silenceTone(board.online, board.silenceMs);
|
||||
|
||||
@@ -184,7 +184,7 @@ export function StatsLine({
|
||||
<span className={`dot ${stats.online ? "dot--live" : "dot--dead"}`} />
|
||||
<span className="statsline__status">{stats.status}</span>
|
||||
<span className="statsline__sep" aria-hidden="true" />
|
||||
<span className="statsline__nums num">{parts.join(" · ")}</span>
|
||||
<span className="statsline__nums num">{parts.join(" / ")}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export function Boot({ milestones, progress, fatal, leaving = false, onRetry, on
|
||||
|
||||
<div className="boot__frame">
|
||||
<div className="boot__eyebrow label">
|
||||
<span>{preview ? "合成预览 · 启动动画" : "SIMBA ROBOTICS"}</span>
|
||||
<span>{preview ? "合成预览 / 启动动画" : "SIMBA ROBOTICS"}</span>
|
||||
<span className="num">{VERSION_LABEL}</span>
|
||||
{onCancel && <button type="button" className="boot__close" onClick={onCancel} title="退出启动" aria-label="退出启动"><Icon name="close" /></button>}
|
||||
</div>
|
||||
@@ -80,7 +80,7 @@ export function Boot({ milestones, progress, fatal, leaving = false, onRetry, on
|
||||
</div>
|
||||
<div className="boot__meta">
|
||||
<span className="label">
|
||||
{progress >= 1 ? "加载完成 · 正在进入" : "正在加载"}
|
||||
{progress >= 1 ? "加载完成 / 正在进入" : "正在加载"}
|
||||
</span>
|
||||
<span className="num boot__pct">
|
||||
{Math.round(Math.max(0, Math.min(1, progress)) * 100)}
|
||||
|
||||
@@ -12,7 +12,7 @@ export function BootPreview({ failed }: { failed: boolean }) {
|
||||
return <Boot
|
||||
preview
|
||||
milestones={[
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS · JETBRAINS", done: completed >= 1 },
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS / JETBRAINS", done: completed >= 1 },
|
||||
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: completed >= 2 },
|
||||
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: completed >= 3 },
|
||||
]}
|
||||
|
||||
@@ -50,6 +50,6 @@ export function DeviceDiagram({ kind, identified, portAvailable, active, failed,
|
||||
<g className="device-diagram__computer"><rect x="28" y="142" width="82" height="58" rx="4" /><path d="M69 201v14m-24 0h48m-44-45 10 8-10 8m18 0h19" /><circle className="device-diagram__led" cx="98" cy="153" r="3" /></g>
|
||||
<path className={`device-diagram__cable${portAvailable ? " is-present" : ""}`} d={`M112 171h38q20 0 20 20v97q0 20 20 20h${usbX - 208}q18 0 18-18v-4`} />
|
||||
{kind === "armor" ? <ArmorBoard /> : kind === "camera" ? <CameraBoard /> : <g className="device-diagram__board"><rect className="device-diagram__pcb" x="290" y="112" width="130" height="166" rx="8" /><text x="355" y="186" textAnchor="middle">USB</text><text className="device-diagram__sublabel" x="355" y="207" textAnchor="middle">选择维护对象</text><rect className="device-diagram__usb is-connected" x="339" y="267" width="32" height="20" rx="4" /></g>}
|
||||
<text className="device-diagram__caption" x="69" y="245" textAnchor="middle">CLIENT / USB</text><text className="device-diagram__caption" x="355" y="340" textAnchor="middle">{kind === "armor" ? "装甲板 · ESP32-C3" : kind === "camera" ? "图传板 · 右侧 USB 接入" : chip || "选择维护对象"}</text>
|
||||
<text className="device-diagram__caption" x="69" y="245" textAnchor="middle">CLIENT / USB</text><text className="device-diagram__caption" x="355" y="340" textAnchor="middle">{kind === "armor" ? "装甲板 / ESP32-C3" : kind === "camera" ? "图传板 / 右侧 USB 接入" : chip || "选择维护对象"}</text>
|
||||
</svg>;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export function RolePicker({ onOpenMaintenance }: { onOpenMaintenance?: () => vo
|
||||
<span className="gate__brand">
|
||||
RMIC<span className="gate__slash">::</span>2026
|
||||
</span>
|
||||
<span className="gate__phase label">FIRST RUN · 选择运行模式</span>
|
||||
<span className="gate__phase label">FIRST RUN / 选择运行模式</span>
|
||||
</header>
|
||||
|
||||
<div className="gate__lede">
|
||||
@@ -174,7 +174,7 @@ export function SetupPassword({ onOpenMaintenance }: { onOpenMaintenance?: () =>
|
||||
<span className="gate__brand">
|
||||
RMIC<span className="gate__slash">::</span>2026
|
||||
</span>
|
||||
<span className="gate__phase label">OPERATOR · 现场密码</span>
|
||||
<span className="gate__phase label">OPERATOR / 现场密码</span>
|
||||
</header>
|
||||
|
||||
<div className="gate__lede">
|
||||
|
||||
@@ -39,9 +39,9 @@ const WORD: Record<MatchOutcome, string> = {
|
||||
};
|
||||
|
||||
const CODE: Record<MatchOutcome, string> = {
|
||||
victory: "MATCH · WIN",
|
||||
defeat: "MATCH · LOSS",
|
||||
draw: "MATCH · DRAW",
|
||||
victory: "MATCH / WIN",
|
||||
defeat: "MATCH / LOSS",
|
||||
draw: "MATCH / DRAW",
|
||||
};
|
||||
|
||||
export function MatchBanner({ outcome, mine, theirs, detail }: Props) {
|
||||
|
||||
@@ -17,11 +17,11 @@ function useClock(view: MatchClockView) {
|
||||
function Readout({ clock, names }: { clock: MatchClockView; names: string[] }) {
|
||||
const paused = clock.phase === "paused";
|
||||
const expired = paused && clock.pauseKind === "player" && clock.pauseRemainingMs === 0;
|
||||
const label = !paused ? MATCH_PHASE[clock.phase] : clock.pauseKind === "player" ? `选手技术暂停 · ${names[clock.applicant ?? 0]}` : "官方技术暂停";
|
||||
const label = !paused ? MATCH_PHASE[clock.phase] : clock.pauseKind === "player" ? `选手技术暂停 / ${names[clock.applicant ?? 0]}` : "官方技术暂停";
|
||||
return <div className={`match-readout${paused ? " is-paused" : ""}${!clock.connected ? " is-stale" : ""}`}>
|
||||
<div className="match-readout__phase"><i />{label}</div>
|
||||
<div className="match-readout__digits num">{paused ? matchTime(clock.pauseRemainingMs ?? clock.pauseElapsedMs, clock.pauseKind === "official") : clock.phase === "idle" ? "—:—" : matchTime(clock.remainingMs)}</div>
|
||||
<div className="match-readout__detail">{!clock.connected ? clock.source ? "计时同步中断 · 已冻结" : "等待裁判计时同步" : expired ? "暂停时间已到 · 等待裁判恢复" : paused ? `${clock.pauseKind === "official" ? "暂停已用时" : "暂停剩余"} · 暂停前剩余 ${matchTime(clock.remainingMs)}` : clock.phase === "running" || clock.phase === "finished" ? `对局已用时 ${matchTime(clock.elapsedMs, true)}` : clock.phase === "ready" ? "等待裁判确认开赛" : clock.phase === "countdown" ? "倒计时结束后开始对局" : "准备 3 分钟 / 对局 3 分钟"}</div>
|
||||
<div className="match-readout__detail">{!clock.connected ? clock.source ? "计时同步中断 / 已冻结" : "等待裁判计时同步" : expired ? "暂停时间已到 / 等待裁判恢复" : paused ? `${clock.pauseKind === "official" ? "暂停已用时" : "暂停剩余"} / 暂停前剩余 ${matchTime(clock.remainingMs)}` : clock.phase === "running" || clock.phase === "finished" ? `对局已用时 ${matchTime(clock.elapsedMs, true)}` : clock.phase === "ready" ? "等待裁判确认开赛" : clock.phase === "countdown" ? "倒计时结束后开始对局" : "准备 3 分钟 / 对局 3 分钟"}</div>
|
||||
{paused && <p className="match-readout__reason" title={clock.reason}>{clock.reason}</p>}
|
||||
</div>;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export function RefereeMatchControl({ snapshot, onError }: { snapshot: Snapshot;
|
||||
const openPause = (kind: "player" | "official") => { setReason(""); setApproved(false); setDialog(kind); };
|
||||
const reasonValid = reason.trim().length > 0 && new TextEncoder().encode(reason.trim()).length <= 192 && !/[\u0000-\u001f\u007f]/.test(reason);
|
||||
return <section className="match-control" aria-label="裁判比赛计时控制">
|
||||
<div className="match-control__identity"><span className="label">MATCH CONTROL</span><span>{snapshot.demo ? "本机演示 · 合成计时" : "裁判计时 / 局域网同步"}</span>{!snapshot.demo && <small className={snapshot.matchClock.syncError ? "is-error" : ""}>{snapshot.matchClock.syncError ?? "仅对局进行中扣血;准备与暂停时只闪灯"}</small>}</div>
|
||||
<div className="match-control__identity"><span className="label">MATCH CONTROL</span><span>{snapshot.demo ? "本机演示 / 合成计时" : "裁判计时 / 局域网同步"}</span>{!snapshot.demo && <small className={snapshot.matchClock.syncError ? "is-error" : ""}>{snapshot.matchClock.syncError ?? "仅对局进行中扣血;准备与暂停时只闪灯"}</small>}</div>
|
||||
<Readout clock={clock} names={snapshot.config.teamNames} />
|
||||
<div className="match-control__actions">
|
||||
{canReset ? <>
|
||||
|
||||
@@ -1,29 +1,40 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { Snapshot } from "../lib/types";
|
||||
import { operatorGate, type useOperatorControl } from "../lib/use-operator-control";
|
||||
import { Icon } from "./Icon";
|
||||
import { Slider } from "./controls";
|
||||
import { OperatorMapping } from "./OperatorMapping";
|
||||
|
||||
export function OperatorControls({ control, snapshot, connected, blocked }: {
|
||||
control: ReturnType<typeof useOperatorControl>;
|
||||
snapshot: Snapshot;
|
||||
connected: boolean;
|
||||
blocked: boolean;
|
||||
control: ReturnType<typeof useOperatorControl>; snapshot: Snapshot; connected: boolean; blocked: boolean;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const root = useRef<HTMLElement>(null);
|
||||
const matchReason = operatorGate(snapshot, connected, "match");
|
||||
const debugReason = operatorGate(snapshot, connected, "debug");
|
||||
return <section className={`operator-controls${control.activeMode ? " is-active" : ""}${control.activeMode === "debug" ? " is-debug" : ""}`} aria-label="机器人操作" onPointerDown={event => event.stopPropagation()} onWheel={event => event.stopPropagation()} onDoubleClick={event => event.stopPropagation()}>
|
||||
{control.activeMode ? <>
|
||||
<strong>{control.activeMode === "debug" ? "赛前调试发送中" : "操作输入发送中"}{snapshot.demo ? " · 合成输入" : ""}</strong>
|
||||
<span>WASD 移动 · 鼠标控制云台 · 左键发射 · ESC 退出</span>
|
||||
<small>{snapshot.demo ? "仅合成预览,无真实发送" : "仅表示客户端发送状态;装甲板及下位机无应答"}</small>
|
||||
</> : <>
|
||||
<div className="operator-controls__actions">
|
||||
<button className="btn btn--primary" disabled={blocked || control.pending || !!matchReason} title={matchReason ?? "锁定鼠标并开始接收键鼠输入"} onClick={() => control.start("match")}>{control.pending ? "正在处理…" : "开启比赛操作"}</button>
|
||||
<button className="btn" disabled={blocked || control.pending || !!debugReason} title={debugReason ?? "未开赛时显式开启调试,开始倒数后自动停止"} onClick={() => control.start("debug")}>开启赛前调试</button>
|
||||
</div>
|
||||
<label className="operator-controls__sensitivity">鼠标灵敏度 <input aria-label="本次鼠标灵敏度" type="range" min="0.25" max="4" step="0.25" value={control.sensitivity} onChange={event => control.setSensitivity(Number(event.target.value))} /><span>×{control.sensitivity.toFixed(2)} · 本次</span></label>
|
||||
<p>{snapshot.demo ? "预览使用合成数据,不向装甲板发送真实操作。" : "WASD 移动 · 鼠标控制云台速度 · 左键发射;ESC 或失焦立即停止。"}</p>
|
||||
{!snapshot.demo && <p>仅确认客户端发送,装甲板及下位机未提供应答。装甲板重启或连接超时后,请退出再开启。</p>}
|
||||
{matchReason && debugReason && <p>{matchReason};{debugReason}</p>}
|
||||
{control.error && <p className="operator-controls__error" role="alert">{control.error}</p>}
|
||||
</>}
|
||||
</section>;
|
||||
useEffect(() => { if (blocked || control.activeMode) setOpen(false); }, [blocked, control.activeMode]);
|
||||
useEffect(() => {
|
||||
const dismiss = (event: PointerEvent) => { if (!root.current?.contains(event.target as Node)) setOpen(false); };
|
||||
document.addEventListener("pointerdown", dismiss);
|
||||
return () => document.removeEventListener("pointerdown", dismiss);
|
||||
}, []);
|
||||
return <>
|
||||
<section ref={root} className="operator-controls" aria-label="机器人操作" onPointerDown={event => event.stopPropagation()} onWheel={event => event.stopPropagation()} onDoubleClick={event => event.stopPropagation()} onKeyDown={event => { if (open && event.key === "Escape") {event.stopPropagation();setOpen(false);} }}>
|
||||
<button className="btn operator-controls__toggle" role="switch" aria-checked={control.activeMode !== null} aria-expanded={open} aria-controls="operator-submenu" disabled={blocked || control.pending} onClick={() => control.activeMode ? control.stop() : setOpen(!open)}>
|
||||
<Icon name="gamepad" />{control.activeMode === "debug" ? "调试发送" : control.activeMode ? "操控发送" : "操控"}{control.activeMode ? <kbd>ESC</kbd> : <Icon name="chevron" className={open ? "is-open" : ""} />}
|
||||
</button>
|
||||
{open && <div className="operator-controls__menu" id="operator-submenu">
|
||||
<div className="operator-controls__actions">
|
||||
<button className="btn" disabled={!!matchReason} title={matchReason ?? "WASD / 鼠标 / 左键"} onClick={() => {setOpen(false);control.start("match");}}><Icon name="play" />比赛操作</button>
|
||||
<button className="btn" disabled={!!debugReason} title={debugReason ?? "未开赛时发送调试输入"} onClick={() => {setOpen(false);control.start("debug");}}><Icon name="build" />赛前调试</button>
|
||||
</div>
|
||||
<label className="operator-controls__sensitivity"><span>鼠标灵敏度(本次)</span><Slider min={0.25} max={4} step={0.25} value={control.sensitivity} onChange={control.setSensitivity} format={value => `×${value.toFixed(2)}`} /></label>
|
||||
{matchReason && debugReason && <small>{debugReason}</small>}
|
||||
{snapshot.demo && <small>合成预览</small>}
|
||||
{control.error && <small role="alert">{control.error}</small>}
|
||||
</div>}
|
||||
{!open && control.error && <span className="operator-controls__fault" role="alert" title={control.error}>操作已停止</span>}
|
||||
</section>
|
||||
{control.activeMode === "debug" && <OperatorMapping source={control.mapping} synthetic={snapshot.demo} />}
|
||||
</>;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { useEffect, useState, type RefObject, type CSSProperties } from "react";
|
||||
import { neutralAxes, type OperatorAxes } from "../lib/operator-input";
|
||||
|
||||
/** 显示已提交的客户端通道值;不把它描述为串口回执或真实机构速度。 */
|
||||
export function OperatorMapping({ source, synthetic }: { source: RefObject<OperatorAxes>; synthetic: boolean }) {
|
||||
const [axes, setAxes] = useState(neutralAxes);
|
||||
useEffect(() => {
|
||||
const timer = window.setInterval(() => setAxes({ ...source.current }), 40);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [source]);
|
||||
const channels = [["CH0", "W / S", "前后", axes.forward], ["CH1", "A / D", "左右", axes.strafe], ["CH2", "MOUSE X", "水平", axes.yaw], ["CH3", "MOUSE Y", "俯仰", axes.pitch]] as const;
|
||||
return <div className="operator-mapping" aria-label="调试协议映射">
|
||||
<header><span>CONTROL / MAPPING</span><b>{synthetic ? "合成输入" : "客户端输入"}</b></header>
|
||||
<div className="operator-mapping__flow"><span>键鼠</span><i>→</i><span>UDP</span><i>→</i><span>C3 / UART</span></div>
|
||||
<div className="operator-mapping__channels">{channels.map(([id, input, label, value]) => <div className="operator-mapping__channel" key={id}>
|
||||
<span>{input}</span><span>{id} / {label}</span><strong className="num">{value > 0 ? "+" : ""}{value}</strong>
|
||||
<div className="operator-mapping__track"><i style={{left: `${50 + Math.min(0, value / 20)}%`, width: `${Math.abs(value) / 20}%`} as CSSProperties} /><b /></div>
|
||||
</div>)}</div>
|
||||
<footer><span className={axes.fire ? "is-firing" : ""}>LMB → FIRE <b>{Number(axes.fire)}</b></span><span>±1000 速度比例</span><span>ESC 退出</span></footer>
|
||||
</div>;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export function OperatorMenu({ snapshot, fullscreen, onClose, onSettings, onMain
|
||||
<div className="operator-menu__identity"><span className="label">RMIC :: 2026 / OPERATOR</span><h1>操作菜单<span>MENU</span></h1><p>打开菜单后,图传和受击上报仍会继续。</p>{snapshot.demo && <span className="tag tag--warn">预览 / 合成数据</span>}</div>
|
||||
<nav className="operator-menu__actions" aria-label="操作菜单">
|
||||
<button data-initial-focus onClick={close}><span><Icon name="play" />继续操作</span><kbd>ESC</kbd></button>
|
||||
<button onClick={onSettings}><span><Icon name="settings" />画面与设备设置</span><small>准星 · 图传绑定 · 装甲板</small></button>
|
||||
<button onClick={onSettings}><span><Icon name="settings" />画面与设备设置</span><small>准星 / 图传绑定 / 装甲板</small></button>
|
||||
<button onClick={onMaintenance}><span><Icon name="firmware" />固件维护</span><small>编译与 USB 烧录</small></button>
|
||||
<button onClick={() => { setError(""); setReconnect(true); }}><span><Icon name="reconnect" />重新接收裁判计时</span><small>{snapshot.matchClock.source ?? "等待裁判广播"}</small></button>
|
||||
<button onClick={onFullscreen}><span><Icon name={fullscreen ? "fullscreenExit" : "fullscreen"} />{fullscreen ? "退出全屏" : "全屏显示"}</span><kbd>F11</kbd></button>
|
||||
|
||||
@@ -101,11 +101,11 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
|
||||
const cameraOptions = useMemo(() => snapshot.cameras.map(camera => ({
|
||||
value: camera.id, label: camera.idText,
|
||||
hint: `${camera.addr} · ${camera.online ? "在线" : "离线"} · 固件 ${firmwareLabel(camera)}${camera.compatible ? "" : ` · 协议 ${camera.protocol} 不匹配`}`,
|
||||
hint: `${camera.addr} / ${camera.online ? "在线" : "离线"} / 固件 ${firmwareLabel(camera)}${camera.compatible ? "" : ` / 协议 ${camera.protocol} 不匹配`}`,
|
||||
})), [snapshot.cameras]);
|
||||
const armorOptions = useMemo(() => snapshot.armorBoards.map(board => ({
|
||||
value: board.id, label: board.idText,
|
||||
hint: `${board.addr} · ${teamName(board.team, config.teamNames)} · ${board.hp} 血 · ${board.online ? "在线" : "离线"}`,
|
||||
hint: `${board.addr} / ${teamName(board.team, config.teamNames)} / ${board.hp} 血 / ${board.online ? "在线" : "离线"}`,
|
||||
})), [snapshot.armorBoards, config.teamNames]);
|
||||
|
||||
const categories = useMemo<Category[]>(() => [
|
||||
@@ -154,7 +154,7 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
const camera = snapshot.cameras.find(item => item.id === config.cameraId);
|
||||
const cameraStats = snapshot.stats.find(item => item.camera === config.cameraId);
|
||||
const board = snapshot.armorBoards.find(item => item.id === config.armorId);
|
||||
const cameraState = !connected ? "本地通道断开" : config.cameraId === null ? "未绑定" : !camera?.online ? "离线" : !camera.compatible ? "协议不匹配" : cameraStats?.online && cameraStats.hasFrames ? "正在接收" : "已发现 · 等待画面";
|
||||
const cameraState = !connected ? "本地通道断开" : config.cameraId === null ? "未绑定" : !camera?.online ? "离线" : !camera.compatible ? "协议不匹配" : cameraStats?.online && cameraStats.hasFrames ? "正在接收" : "已发现 / 等待画面";
|
||||
const armorState = !connected ? "本地通道断开" : config.armorId === null ? "未绑定" : !board?.online ? "离线" : board.team === 255 ? "等待队伍设置" : board.team !== config.team ? "队伍不匹配" : "在线";
|
||||
const mirrorControls = <>
|
||||
<Switch checked={config.mirror} label="左右镜像画面" onChange={mirror => void run(() => api.setMirror(mirror))} />
|
||||
@@ -234,10 +234,10 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
case "slots": return <>
|
||||
{mirrorControls}
|
||||
<div className="settings__span"><Switch checked={snapshot.slots.manual} label="手动指定槽位" onChange={manual => void run(() => api.setRefereeSlots({ ...snapshot.slots, manual }))} /></div>
|
||||
<Field label={`左格 · ${teamName(0, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraA} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraA => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraA, manual: true }))} /></Field>
|
||||
<Field label={`右格 · ${teamName(1, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraB} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraB => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraB, manual: true }))} /></Field>
|
||||
<Field label={`左格 · ${teamName(0, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorA} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorA => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorA, manual: true }))} /></Field>
|
||||
<Field label={`右格 · ${teamName(1, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorB} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorB => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorB, manual: true }))} /></Field>
|
||||
<Field label={`左格 / ${teamName(0, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraA} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraA => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraA, manual: true }))} /></Field>
|
||||
<Field label={`右格 / ${teamName(1, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraB} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraB => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraB, manual: true }))} /></Field>
|
||||
<Field label={`左格 / ${teamName(0, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorA} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorA => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorA, manual: true }))} /></Field>
|
||||
<Field label={`右格 / ${teamName(1, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorB} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorB => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorB, manual: true }))} /></Field>
|
||||
</>;
|
||||
case "media": return <>
|
||||
<div className="settings__span"><Field label="输出目录"><input className="input" type="text" defaultValue={config.recordingDir} onBlur={event => {
|
||||
@@ -298,7 +298,7 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer className="settings__foot"><span>{pending ? "等待保存…" : "修改自动保存"}<span className="settings__save-note"> · 停止拖动滑杆 350 ms 后自动保存</span></span><span className="num">{VERSION_LABEL} · 线路协议 {BUILD.protocol}</span></footer>
|
||||
<footer className="settings__foot"><span>{pending ? "等待保存…" : "修改自动保存"}<span className="settings__save-note"> / 停止拖动滑杆 350 ms 后自动保存</span></span><span className="num">{VERSION_LABEL} / 线路协议 {BUILD.protocol}</span></footer>
|
||||
</aside>;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ function Preview({ hud, team, mirrored, mirroredVertical }: { hud: HudView; team
|
||||
<div className="preview">
|
||||
<div className="preview__head">
|
||||
<span className="label">HUD PREVIEW</span>
|
||||
<span className="preview__note">合成画面 · 非设备图传</span>
|
||||
<span className="preview__note">合成画面 / 非设备图传</span>
|
||||
</div>
|
||||
|
||||
<div className="preview__frame corners">
|
||||
|
||||
@@ -49,7 +49,7 @@ export function TopBar({
|
||||
<div className="topbar__cluster">
|
||||
{/* 队标只以"字标"的形态出现在顶栏:它的笔画在 17px 上只剩 1px,缩到这么小
|
||||
会糊成一团反而更难看。完整的队标留给启动页(在那里它有 30px)。 */}
|
||||
<span className="topbar__brand" title="RMIC::2026 · Simba Robotics">
|
||||
<span className="topbar__brand" title="RMIC::2026 / Simba Robotics">
|
||||
<span className="topbar__wordmark">
|
||||
RMIC<span className="topbar__slash">::</span>2026
|
||||
</span>
|
||||
@@ -71,7 +71,7 @@ export function TopBar({
|
||||
)
|
||||
}
|
||||
>
|
||||
<Icon name="info" />演示 · 合成数据
|
||||
<Icon name="info" />演示 / 合成数据
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -80,7 +80,7 @@ export function TopBar({
|
||||
{!connected && (
|
||||
<span className="tag tag--warn">
|
||||
<span className="dot dot--warn" />
|
||||
通道断开 · 重连中
|
||||
通道断开 / 重连中
|
||||
</span>
|
||||
)}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ interface Props {
|
||||
children?: ReactNode;
|
||||
/** Only used by the opt-in screen/camera calibration page. */
|
||||
onFramePainted?: (canvas: HTMLCanvasElement, frame: FrameInfo, drawMs: number) => void;
|
||||
/** 左上角的代号(`CAM · A`、队名)。缺省时不画。 */
|
||||
/** 左上角的代号(`CAM / A`、队名)。缺省时不画。 */
|
||||
label?: string;
|
||||
/** 这一路被"选中"了(裁判端的 scope)。视觉上给一圈亮框。 */
|
||||
focused?: boolean;
|
||||
@@ -351,7 +351,7 @@ export function VideoSurface({
|
||||
{calibrating && (
|
||||
<div className="vsurface__calibrating">
|
||||
<span className="dot dot--live" />
|
||||
校准中 · 拖动画面调整瞄准点
|
||||
校准中 / 拖动画面调整瞄准点
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const previewMirrors: Record<string, { mirror: boolean; mirrorVertical: boolean }> = {};
|
||||
/**
|
||||
* 仅开发用的浏览器预览。
|
||||
*
|
||||
@@ -169,7 +170,7 @@ export async function previewInvoke<T>(command: string, args?: Record<string, un
|
||||
let previewCapture = 0;
|
||||
let previewCaptureAt = 0;
|
||||
let previewInputSequence = 0;
|
||||
let previewOperator: OperatorControlView = { active: false, captureId: null, mode: null, reason: "预览 · 未发送真实操作" };
|
||||
let previewOperator: OperatorControlView = { active: false, captureId: null, mode: null, reason: "预览 / 未发送真实操作" };
|
||||
|
||||
function handle(command: string, args: Record<string, unknown>): unknown {
|
||||
switch (command) {
|
||||
@@ -178,7 +179,7 @@ function handle(command: string, args: Record<string, unknown>): unknown {
|
||||
const mode = args.mode === "debug" ? "debug" : "match";
|
||||
previewInputSequence = 0;
|
||||
previewCaptureAt = performance.now();
|
||||
previewOperator = { active: true, captureId: ++previewCapture, mode, reason: "预览 · 合成输入,不发送到装甲板" };
|
||||
previewOperator = { active: true, captureId: ++previewCapture, mode, reason: "预览 / 合成输入,不发送到装甲板" };
|
||||
return previewCapture;
|
||||
}
|
||||
case "operator_input": {
|
||||
@@ -243,6 +244,9 @@ function handle(command: string, args: Record<string, unknown>): unknown {
|
||||
case "set_role":
|
||||
state.role = args.role as "team" | "referee";
|
||||
return configView();
|
||||
case "set_camera_mirror":
|
||||
previewMirrors[String(args.camera)] = { mirror: Boolean(args.mirror), mirrorVertical: Boolean(args.mirrorVertical) };
|
||||
return;
|
||||
case "set_mirror":
|
||||
state.mirror = Boolean(args.mirror);
|
||||
return configView();
|
||||
@@ -432,6 +436,7 @@ function snapshot(): Snapshot {
|
||||
team: state.team,
|
||||
mirrored: state.mirror,
|
||||
mirroredVertical: state.mirrorVertical,
|
||||
cameraMirrors: previewMirrors,
|
||||
matchClock: previewMatch(),
|
||||
operatorControl: { ...previewOperator },
|
||||
demo: true,
|
||||
@@ -629,7 +634,7 @@ function draw(canvas: HTMLCanvasElement, team: number, frameId: number) {
|
||||
|
||||
ctx.font = "600 20px ui-monospace, monospace";
|
||||
ctx.fillStyle = "#e8e8ec";
|
||||
ctx.fillText(team === 0 ? "PREVIEW · TEAM 1" : "PREVIEW · TEAM 2", 14, height - 40);
|
||||
ctx.fillText(team === 0 ? "PREVIEW / TEAM 1" : "PREVIEW / TEAM 2", 14, height - 40);
|
||||
ctx.font = "500 16px ui-monospace, monospace";
|
||||
ctx.fillStyle = "#8a8a95";
|
||||
ctx.fillText(`frame ${frameId}`, 14, height - 16);
|
||||
|
||||
@@ -75,7 +75,7 @@ export function teamColor(team: number): string {
|
||||
return team === 0 ? "var(--team-0)" : "var(--team-1)";
|
||||
}
|
||||
/**
|
||||
* 固件版本的一行标签:`v0.2.0 · 34`。
|
||||
* 固件版本的一行标签:`v0.2.0 / 34`。
|
||||
*
|
||||
* 板子太老、没带版本字段时返回"版本未知"——不要拼出一个 `v0.0.0`,那是假信息。
|
||||
*/
|
||||
@@ -87,6 +87,6 @@ export function firmwareLabel(camera: {
|
||||
return camera.firmwareBuild > 0 ? `构建 ${camera.firmwareBuild}` : "版本未知";
|
||||
}
|
||||
return camera.firmwareBuild > 0
|
||||
? `v${camera.firmwareVersion} · ${camera.firmwareBuild}`
|
||||
? `v${camera.firmwareVersion} / ${camera.firmwareBuild}`
|
||||
: `v${camera.firmwareVersion}`;
|
||||
}
|
||||
@@ -73,6 +73,7 @@ export const api = {
|
||||
call<ConfigView>("set_team", { team, password: password ?? null }),
|
||||
setRole: (role: Role, password?: string) =>
|
||||
call<ConfigView>("set_role", { role, password: password ?? null }),
|
||||
setCameraMirror: (camera: number, mirror: boolean, mirrorVertical: boolean) => call<void>("set_camera_mirror", { camera, mirror, mirrorVertical }),
|
||||
setMirror: (mirror: boolean) => call<ConfigView>("set_mirror", { mirror }),
|
||||
setMirrorVertical: (mirrorVertical: boolean) => call<ConfigView>("set_mirror_vertical", { mirrorVertical }),
|
||||
saveHud: (hud: HudView) => call<ConfigView>("save_hud", { hud }),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { MatchClockView, MatchPhase } from "./types";
|
||||
|
||||
export const MATCH_PHASE: Record<MatchPhase, string> = {
|
||||
idle: "等待准备", preparation: "赛前准备", ready: "准备结束 · 等待裁判", countdown: "开赛倒计时",
|
||||
idle: "等待准备", preparation: "赛前准备", ready: "准备结束 / 等待裁判", countdown: "开赛倒计时",
|
||||
running: "对局进行中", paused: "技术暂停", finished: "本局计时结束",
|
||||
};
|
||||
export function matchTime(ms: number, countingUp = false): string {
|
||||
|
||||
@@ -227,6 +227,7 @@ export interface MediaFileDto {
|
||||
|
||||
/** `cam_core::snapshot::Snapshot` */
|
||||
export interface Snapshot {
|
||||
cameraMirrors: Record<string, { mirror: boolean; mirrorVertical: boolean }>;
|
||||
operatorControl: OperatorControlView;
|
||||
matchClock: MatchClockView;
|
||||
role: Role;
|
||||
|
||||
@@ -26,6 +26,7 @@ export function operatorGate(snapshot: Snapshot, connected: boolean, mode: Opera
|
||||
}
|
||||
|
||||
export function useOperatorControl(options: Options) {
|
||||
const mapping = useRef(neutralAxes());
|
||||
const target = useRef<HTMLDivElement>(null);
|
||||
const current = useRef(options);
|
||||
current.current = options;
|
||||
@@ -43,6 +44,7 @@ export function useOperatorControl(options: Options) {
|
||||
const [error, setError] = useState("");
|
||||
|
||||
const stop = useCallback((reason = "") => {
|
||||
mapping.current = neutralAxes();
|
||||
generation.current++;
|
||||
attempt.current = null;
|
||||
sampler.current.reset(performance.now());
|
||||
@@ -177,6 +179,7 @@ export function useOperatorControl(options: Options) {
|
||||
}
|
||||
const sampled = sampler.current.sample(performance.now(), sensitivityRef.current);
|
||||
if (sampled.stalled) { stop("界面输入已超时,操作已停止,请重新开启"); return; }
|
||||
mapping.current = sampled.axes;
|
||||
session.sender.offer({ input: { captureId: session.id, sequence: ++session.sequence, active: true, ...sampled.axes }, at: performance.now() });
|
||||
}, INPUT_INTERVAL_MS);
|
||||
return () => {
|
||||
@@ -199,5 +202,5 @@ export function useOperatorControl(options: Options) {
|
||||
sensitivityRef.current = value;
|
||||
setSensitivityState(value);
|
||||
};
|
||||
return { target, start, stop, activeMode, pending, error, sensitivity, setSensitivity };
|
||||
return { mapping, target, start, stop, activeMode, pending, error, sensitivity, setSensitivity };
|
||||
}
|
||||
@@ -6,16 +6,16 @@
|
||||
*/
|
||||
|
||||
export const BUILD = {
|
||||
version: "0.5.0",
|
||||
version: "0.6.1",
|
||||
major: 0,
|
||||
minor: 5,
|
||||
patch: 0,
|
||||
minor: 6,
|
||||
patch: 1,
|
||||
/** git 提交数,单调递增。 */
|
||||
build: 46,
|
||||
build: 48,
|
||||
/** 线路协议版本。与固件自报的那个数直接比对。 */
|
||||
protocol: 1,
|
||||
/** 生成时的提交日期(`YYYY-MM-DD`)。 */
|
||||
date: "2026-10-31",
|
||||
date: "2026-11-01",
|
||||
} as const;
|
||||
|
||||
/** `"0.2.0+57"` —— 界面上放得下的那一行。 */
|
||||
|
||||
@@ -94,8 +94,8 @@ export function LatencyPage() {
|
||||
<div style={{position:'relative',minHeight:0}}><VideoSurface camera={camera} emptyText="等待真实摄像头" mirrored={false}
|
||||
crosshair={null} grid={null} view={IDENTITY_VIEW} onView={()=>{}} hitFeedback={feedback} showZoom={false} onFramePainted={painted}/></div>
|
||||
</div>
|
||||
<p>{connected?'已连接':'连接中'} · {status}</p>
|
||||
<p style={{fontSize:22}}>样本 {summary.samples} · P50 {summary.p50.toFixed(1)} ms · P95 {summary.p95.toFixed(1)} ms</p>
|
||||
<p>{connected?'已连接':'连接中'} / {status}</p>
|
||||
<p style={{fontSize:22}}>样本 {summary.samples} / P50 {summary.p50.toFixed(1)} ms / P95 {summary.p95.toFixed(1)} ms</p>
|
||||
<p>每 50 ms 更新标记,记录首次可解码回显,包含相机取样等待、曝光、采集、传输和绘制;混合曝光帧不计入。相邻 rAF 夹定绘制时间,刷新间隔约 {summary.refresh.toFixed(1)} ms;面板像素响应需高速相机复核。</p>
|
||||
</main>;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
setDevice(snapshot);
|
||||
setViewStep("bundle");
|
||||
appendLog(
|
||||
`设备:${snapshot.chip} ${snapshot.mac ?? "MAC 未知"} · ${snapshot.flashSizeText} · ` +
|
||||
`设备:${snapshot.chip} ${snapshot.mac ?? "MAC 未知"} / ${snapshot.flashSizeText} / ` +
|
||||
`${snapshot.app ? `App ${snapshot.app.version}` : "未识别 App"}`,
|
||||
);
|
||||
} catch (err) {
|
||||
@@ -357,7 +357,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
<header className="mnt-head">
|
||||
<div><span className="label mnt-kicker">RMIC / DEVICE SERVICE</span><h1>固件维护</h1></div>
|
||||
<div className="mnt-head__actions">
|
||||
{preview && <span className="tag tag--warn">预览 · 合成数据 / 无 USB 操作</span>}
|
||||
{preview && <span className="tag tag--warn">预览 / 合成数据 / 无 USB 操作</span>}
|
||||
<Button icon={fullscreen ? "fullscreenExit" : "fullscreen"} variant="ghost" onClick={onToggleFullscreen}>{fullscreen ? "退出全屏" : "全屏"}</Button>
|
||||
<Button icon="back" variant="ghost" disabled={anyBusy} onClick={onClose}>返回 <kbd>ESC</kbd></Button>
|
||||
</div>
|
||||
@@ -365,12 +365,12 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
|
||||
<div className="mnt-workspace">
|
||||
<section className="mnt-visual" aria-label="设备与任务状态">
|
||||
<div className="mnt-visual__head"><span className="label">USB / {firmwareKind === "armor" ? "ARMOR" : firmwareKind === "camera" ? "VIDEO" : "DEVICE"}</span><span className={`mnt-link${device ? " is-live" : ""}`}><i />{device ? "已读取" : portAvailable ? "端口可用 · 待读取" : "未发现目标串口"}</span></div>
|
||||
<div className="mnt-visual__head"><span className="label">USB / {firmwareKind === "armor" ? "ARMOR" : firmwareKind === "camera" ? "VIDEO" : "DEVICE"}</span><span className={`mnt-link${device ? " is-live" : ""}`}><i />{device ? "已读取" : portAvailable ? "端口可用 / 待读取" : "未发现目标串口"}</span></div>
|
||||
<DeviceDiagram kind={firmwareKind} identified={!!device} portAvailable={portAvailable} active={anyBusy} failed={!!error || !!report && !report.ok} complete={!!report?.ok} ratio={ratio} chip={device?.chip ?? (firmwareKind === "armor" ? "ESP32-C3" : firmwareKind === "camera" ? "ESP32-S3" : "MCU")} />
|
||||
<div key={visualState} className="mnt-visual__status" role="status">
|
||||
<span className="label">{report ? "RESULT" : busy ? "CURRENT PHASE" : "DEVICE STATUS"}</span>
|
||||
<h2>{busy ? BUSY_TEXT[busy] : report ? report.ok ? "写入与回读完成" : "烧录未完成" : device ? "设备已识别" : "等待读取设备"}{busy && ratio !== null && <span className="num"> {Math.round(ratio * 100)}%</span>}</h2>
|
||||
<p>{anyBusy ? progress?.message ?? (busy === "build" ? "构建日志可在诊断中查看" : "请保持 USB 连接") : report ? "上次操作结果 · 仍需检查板上运行情况" : device ? `${device.chip.toUpperCase()} · ${device.flashSizeText}` : portAvailable ? `${port} · 点击读取设备` : "连接 USB 后刷新串口"}</p>
|
||||
<p>{anyBusy ? progress?.message ?? (busy === "build" ? "构建日志可在诊断中查看" : "请保持 USB 连接") : report ? "上次操作结果 / 仍需检查板上运行情况" : device ? `${device.chip.toUpperCase()} / ${device.flashSizeText}` : portAvailable ? `${port} / 点击读取设备` : "连接 USB 后刷新串口"}</p>
|
||||
</div>
|
||||
<dl className="mnt-identity"><div><dt>串口</dt><dd>{port || "—"}</dd></div><div><dt>MAC</dt><dd>{device?.mac ?? report?.mac ?? "—"}</dd></div><div><dt>队伍设置</dt><dd>{firmwareKind === "armor" ? bundle?.armorTeam != null ? `旧版 / ${expectedTeam === "" ? "待核对" : expectedTeam === "0" ? "红" : "蓝"}` : "客户端选择" : "—"}</dd></div></dl>
|
||||
</section>
|
||||
@@ -389,7 +389,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
</div>
|
||||
<div className={`mnt-connection-fields${firmwareKind === "armor" && bundle?.armorTeam != null ? " has-team" : ""}`}>
|
||||
{firmwareKind === "armor" && bundle?.armorTeam != null && <label className="mnt-field"><span>旧版固件目标队伍</span><select className="select" value={expectedTeam} disabled={anyBusy} onChange={event => { setExpectedTeam(event.target.value); setPlan(null); }}><option value="">选择这块板的队伍</option><option value="0">队伍一(红,0)</option><option value="1">队伍二(蓝,1)</option></select></label>}
|
||||
<label className="mnt-field"><span>USB 串口</span><div className="mnt-row"><select className="select" value={port} disabled={anyBusy} onChange={event => { setPort(event.target.value); setDevice(null); setPlan(null); setReport(null); setProgress(null); }}>{ports.length === 0 && <option value="">未发现串口</option>}{ports.map(entry => <option key={entry.portName} value={entry.portName}>{entry.portName} · {entry.label}</option>)}</select><Button icon="refresh" disabled={anyBusy} onClick={() => void refreshPorts(false)}>刷新</Button></div></label>
|
||||
<label className="mnt-field"><span>USB 串口</span><div className="mnt-row"><select className="select" value={port} disabled={anyBusy} onChange={event => { setPort(event.target.value); setDevice(null); setPlan(null); setReport(null); setProgress(null); }}>{ports.length === 0 && <option value="">未发现串口</option>}{ports.map(entry => <option key={entry.portName} value={entry.portName}>{entry.portName} / {entry.label}</option>)}</select><Button icon="refresh" disabled={anyBusy} onClick={() => void refreshPorts(false)}>刷新</Button></div></label>
|
||||
</div>
|
||||
<p className="mnt-hint">请只连接要维护的主板。{firmwareKind === "camera" && "图传板接入右侧 USB 口。"}读取设备信息时,主板会复位。</p>
|
||||
<div className="mnt-task__actions"><Button icon="usb" variant="primary" disabled={anyBusy || !port || !firmwareKind} onClick={() => void probePort(port)}>读取设备并继续</Button><Button icon="firmware" variant="ghost" disabled={anyBusy || !firmwareKind} onClick={() => setViewStep("bundle")}>准备固件包</Button></div>
|
||||
@@ -398,7 +398,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
|
||||
{viewStep === "bundle" && <>
|
||||
<div className="mnt-task__title"><span className="label">02 / FIRMWARE</span><h2>选择对应固件</h2></div>
|
||||
<div className="mnt-package"><span className="mnt-package__symbol"><Icon name="firmware" /></span><strong>{bundle ? `${bundle.name} ${bundle.version}` : "选择固件 ZIP"}</strong><span>{bundle ? `${bundle.chip.toUpperCase()} · ${formatBytes(bundle.appSize)}` : firmwareKind === "armor" ? "ESP32-C3 / 装甲板固件" : "ESP32-S3 / 图传固件"}</span>{bundle?.firmwareKind === "armor" && <b>{bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {bundle.armorThreshold}</b>}<Button icon="file" disabled={anyBusy} onClick={() => void chooseBundle("zip")}>{bundle ? "更换 ZIP" : "选择 ZIP"}</Button></div>
|
||||
<div className="mnt-package"><span className="mnt-package__symbol"><Icon name="firmware" /></span><strong>{bundle ? `${bundle.name} ${bundle.version}` : "选择固件 ZIP"}</strong><span>{bundle ? `${bundle.chip.toUpperCase()} / ${formatBytes(bundle.appSize)}` : firmwareKind === "armor" ? "ESP32-C3 / 装甲板固件" : "ESP32-S3 / 图传固件"}</span>{bundle?.firmwareKind === "armor" && <b>{bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} / 阈值 {bundle.armorThreshold}</b>}<Button icon="file" disabled={anyBusy} onClick={() => void chooseBundle("zip")}>{bundle ? "更换 ZIP" : "选择 ZIP"}</Button></div>
|
||||
{bundle?.firmwareKind === "armor" && bundle.armorTeam != null && <label className="mnt-field"><span>旧版包:核对实物队伍</span><select className="select" value={expectedTeam} disabled={anyBusy} onChange={event => { setExpectedTeam(event.target.value); setPlan(null); }}><option value="">请选择</option><option value="0">队伍一(红)</option><option value="1">队伍二(蓝)</option></select></label>}
|
||||
<div className="mnt-row mnt-secondary">{firmwareKind === "armor" && <Button icon="build" variant="ghost" disabled={anyBusy} onClick={() => setModal("build")}>从源码编译</Button>}<Button icon="folder" variant="ghost" disabled={anyBusy} onClick={() => void chooseBundle("dir")}>选择目录包</Button></div>
|
||||
{mismatch && <p className="mnt-note warn" role="alert">{mismatch}</p>}
|
||||
@@ -412,7 +412,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac}</span><span>{plan.bundle.name} {plan.bundle.version}</span></div>
|
||||
<div className="mnt-running"><span className="label">CURRENT PHASE</span><h3>{progress?.phase ?? "准备设备"}</h3><p>{progress?.message ?? "正在核对设备与准备备份"}</p><span className="mnt-hint">左侧显示当前进度,操作结束后会显示结果。</span></div>
|
||||
</> : plan ? <>
|
||||
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac ?? "未知"}</span><span>{plan.bundle.name} {plan.bundle.version}</span>{plan.mode === "armor-install" && <b>{plan.bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${plan.bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {plan.bundle.armorThreshold}</b>}</div>
|
||||
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac ?? "未知"}</span><span>{plan.bundle.name} {plan.bundle.version}</span>{plan.mode === "armor-install" && <b>{plan.bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${plan.bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} / 阈值 {plan.bundle.armorThreshold}</b>}</div>
|
||||
<ul className="mnt-warnings">
|
||||
{plan.mode !== "armor-install" && <>
|
||||
<li>App 写入 {formatOffset(plan.targetOffset)}({formatBytes(plan.appSize)}),整段回读通过后才切换分区表。旧 App 保留在 {formatOffset(plan.currentFactoryOffset)}。</li>
|
||||
@@ -439,11 +439,11 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer className="mnt-foot"><span>{busy ? `正在${BUSY_TEXT[busy]} · 请勿拔线` : "USB 固件维护 / ESP32-S3 · ESP32-C3"}</span><div>{(busy === "flash" || busy === "build") && <Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>请求取消</Button>}<Button icon="log" variant="ghost" onClick={() => setModal("details")}>诊断 / 日志 {logs.length > 0 ? `(${logs.length})` : ""}</Button></div></footer>
|
||||
<footer className="mnt-foot"><span>{busy ? `正在${BUSY_TEXT[busy]} / 请勿拔线` : "USB 固件维护 / ESP32-S3 / ESP32-C3"}</span><div>{(busy === "flash" || busy === "build") && <Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>请求取消</Button>}<Button icon="log" variant="ghost" onClick={() => setModal("details")}>诊断 / 日志 {logs.length > 0 ? `(${logs.length})` : ""}</Button></div></footer>
|
||||
|
||||
{modal === "restore" && restoreRequest && <Dialog title={restoreRequest.kind === "armor" ? "恢复完整备份" : "恢复旧分区表"} className="mnt-restore-dialog" onClose={() => { setModal(null); setRestoreRequest(null); }} closeDisabled={anyBusy}>
|
||||
{close => <div className="mnt-restore">
|
||||
<div className="mnt-confirmation"><strong>{restoreRequest.port} · {restoreRequest.kind === "armor" ? "ESP32-C3 装甲板" : "ESP32-S3 图传板"}</strong><span className="num">{restoreRequest.backupDir}</span></div>
|
||||
<div className="mnt-confirmation"><strong>{restoreRequest.port} / {restoreRequest.kind === "armor" ? "ESP32-C3 装甲板" : "ESP32-S3 图传板"}</strong><span className="num">{restoreRequest.backupDir}</span></div>
|
||||
<p>{restoreRequest.kind === "armor" ? "将恢复完整 4 MB Flash,覆盖当前固件和设置。恢复期间不支持取消。" : "将把旧分区表写回 0x8000,设备会复位到旧 App。"}执行前会核对备份与设备身份,请保持供电和 USB 连接。</p>
|
||||
<div className="mnt-task__actions"><Button icon="back" variant="ghost" onClick={close}>返回检查</Button><Button icon="reset" variant="danger" disabled={anyBusy} onClick={() => void restoreTable()}>确认恢复</Button></div>
|
||||
</div>}
|
||||
|
||||
@@ -240,7 +240,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
<div className={`ref__feed${dimmed ? " is-dimmed" : ""}`}>
|
||||
<VideoSurface
|
||||
camera={pane.camera}
|
||||
label={`${pane.key.toUpperCase()} · ${label}`}
|
||||
label={`${pane.key.toUpperCase()} / ${label}`}
|
||||
emptyText={
|
||||
pane.stats?.hasFrames
|
||||
? ""
|
||||
@@ -248,8 +248,8 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
? "已连接,等待画面…"
|
||||
: `等待${label}的图传`
|
||||
}
|
||||
mirrored={snapshot.mirrored}
|
||||
mirroredVertical={snapshot.mirroredVertical}
|
||||
mirrored={snapshot.cameraMirrors[String(pane.camera)]?.mirror ?? snapshot.mirrored}
|
||||
mirroredVertical={snapshot.cameraMirrors[String(pane.camera)]?.mirrorVertical ?? snapshot.mirroredVertical}
|
||||
// 裁判端不给瞄准器:这里没有人在瞄。网格留着,用来比对两路的取景。
|
||||
crosshair={null}
|
||||
grid={hud.grid}
|
||||
@@ -291,6 +291,13 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
name={pane.health?.name ?? label}
|
||||
onSave={(value) => saveName(pane.team, value)}
|
||||
/>
|
||||
{pane.camera !== null && <div className="ref__mirror-controls" onPointerDown={event => event.stopPropagation()}>
|
||||
{[false, true].map(vertical => {
|
||||
const value = snapshot.cameraMirrors[String(pane.camera)] ?? { mirror: snapshot.mirrored, mirrorVertical: snapshot.mirroredVertical };
|
||||
const checked = vertical ? value.mirrorVertical : value.mirror;
|
||||
return <button className="btn btn--sm" key={String(vertical)} aria-pressed={checked} title="同步到绑定此图传板的选手端" onClick={() => void api.setCameraMirror(pane.camera!, vertical ? value.mirror : !checked, vertical ? !checked : value.mirrorVertical).catch(onError)}><Icon name={vertical ? "mirrorVertical" : "mirrorHorizontal"} />{vertical ? "上下镜像" : "左右镜像"}<span className="ref__mirror-state">{checked ? "开" : "关"}</span></button>;
|
||||
})}
|
||||
</div>}
|
||||
<StatsLine stats={pane.stats} diagnostics={snapshot.diagnostics} />
|
||||
{pane.cameraInfo && (
|
||||
<span
|
||||
@@ -446,7 +453,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
left={
|
||||
<span className="statusbar__state">
|
||||
<span className={`dot ${snapshot.clients > 0 ? "dot--live" : "dot--warn"}`} />
|
||||
同时查看两路画面 · 滚轮缩放鼠标所在的画面
|
||||
同时查看两路画面 / 滚轮缩放鼠标所在的画面
|
||||
</span>
|
||||
}
|
||||
center={
|
||||
@@ -479,7 +486,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
}
|
||||
right={
|
||||
<span className="statusbar__hint">
|
||||
{scope === "all" ? "按 1 / 2 查看单路" : `正在看 ${scope === "a" ? "左路" : "右路"} · 按 0 显示全部`}
|
||||
{scope === "all" ? "按 1 / 2 查看单路" : `正在看 ${scope === "a" ? "左路" : "右路"} / 按 0 显示全部`}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -41,10 +41,10 @@ export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibr
|
||||
// 两侧各自使用独立列;放大血条也不能跨过中线压住对方。
|
||||
const healthConfig = { ...hud.health, width: Math.min(1, hud.health.width * 2) };
|
||||
const hasVideo = cameraLive && !!stats?.hasFrames;
|
||||
const emptyText = camera === null ? "未绑定图传板 · 按 ESC 配置"
|
||||
const emptyText = camera === null ? "未绑定图传板 / 按 ESC 配置"
|
||||
: !connected ? "本机服务断开,正在重连"
|
||||
: !boundCamera ? "尚未发现绑定的图传板 · 按 ESC 检查设备"
|
||||
: !boundCamera.compatible ? "图传协议不匹配 · 按 ESC 检查固件"
|
||||
: !boundCamera ? "尚未发现绑定的图传板 / 按 ESC 检查设备"
|
||||
: !boundCamera.compatible ? "图传协议不匹配 / 按 ESC 检查固件"
|
||||
: !cameraLive ? "图传板离线,等待重新连接"
|
||||
: !stats?.hasFrames ? "已连接,等待画面" : "";
|
||||
|
||||
@@ -60,7 +60,7 @@ export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibr
|
||||
{hud.health.visible && theirs && <div className="cockpit__health-side cockpit__health-side--right"><HealthBar health={theirs} config={healthConfig} align="right" tag={healthTag(theirs, snapshot.team)} /></div>}
|
||||
</div>
|
||||
<div className="cockpit__header">
|
||||
<div className="cockpit__identity"><span className="label">RMIC / OPERATOR</span><span title={myName}>{myName}</span>{snapshot.demo && <b>演示 · 合成数据</b>}</div>
|
||||
<div className="cockpit__identity"><span className="label">RMIC / OPERATOR</span><span title={myName}>{myName}</span>{snapshot.demo && <b>演示 / 合成数据</b>}</div>
|
||||
<div className="cockpit__links" aria-label="连接状态">
|
||||
<span className={cameraLive ? "is-live" : "is-offline"}><i />图传 <b>{cameraState}</b></span>
|
||||
<span className={armorLive ? "is-live" : "is-offline"}><i />装甲板 <b>{armorState}</b></span>
|
||||
@@ -71,13 +71,12 @@ export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibr
|
||||
<div className="cockpit__feed"><span className="label">VIDEO SOURCE</span><strong className="num">{camera === null ? "NO BINDING" : boundCamera?.idText ?? idText(camera)}</strong><span>{cameraLive && stats?.hasFrames ? `${stats.width} × ${stats.height}${snapshot.mirrored ? " / 左右镜像" : ""}${snapshot.mirroredVertical ? " / 上下镜像" : ""}` : "等待图传连接"}</span></div>
|
||||
<div className="cockpit__fps"><span className="label">RECEIVE / FPS</span><strong className="num">{cameraLive && stats?.hasFrames ? stats.fps.toFixed(1) : "—"}</strong>{hud.showStats && snapshot.diagnostics && <span>丢包 {cameraLive && stats?.hasFrames ? `${stats.lossPercent.toFixed(1)}%` : "—"}</span>}</div>
|
||||
</div>
|
||||
<div className="cockpit__footer"><span><kbd>ESC</kbd> 菜单 / 设置</span><span className="num">{calibrating ? "瞄准校准中" : hud.showZoom ? `OPTICAL ×${view.zoom.toFixed(1)}` : ""}</span><span>{snapshot.config.armorId === null ? "ARMOR / —" : `ARMOR / ${board?.idText ?? idText(snapshot.config.armorId)}`}</span></div>
|
||||
<div className="cockpit__footer"><div className="cockpit__actions"><OperatorControls control={control} snapshot={snapshot} connected={connected} blocked={controlsBlocked || calibrating} /><span><kbd>ESC</kbd> 菜单 / 设置</span></div><span className="num">{calibrating ? "瞄准校准中" : hud.showZoom ? `OPTICAL ×${view.zoom.toFixed(1)}` : ""}</span><span>{snapshot.config.armorId === null ? "ARMOR / —" : `ARMOR / ${board?.idText ?? idText(snapshot.config.armorId)}`}</span></div>
|
||||
</div>
|
||||
<MatchBanner outcome={mine?.outcome ?? null} mine={myName} theirs={theirName} detail={mine?.outcome === "defeat" && theirs?.hp != null ? `对手剩余 ${theirs.hp}` : mine?.outcome === "victory" && mine?.hp != null ? `剩余 ${mine.hp}` : undefined} />
|
||||
<HitFlash hit={lastHit} config={hud.hitFeedback} relevant={hitIsMine} />
|
||||
<TeamMatchCountdown snapshot={snapshot} />
|
||||
<OperatorControls control={control} snapshot={snapshot} connected={connected} blocked={controlsBlocked || calibrating} />
|
||||
{boundCamera && !boundCamera.compatible && <div className="fwfault" role="alert"><span className="fwfault__tag label">协议不匹配</span><span className="fwfault__text">图传固件 {firmwareLabel(boundCamera)} · 协议 {boundCamera.protocol} / 客户端 {BUILD.protocol}。按 ESC 进入固件维护。</span></div>}
|
||||
{boundCamera && !boundCamera.compatible && <div className="fwfault" role="alert"><span className="fwfault__tag label">协议不匹配</span><span className="fwfault__text">图传固件 {firmwareLabel(boundCamera)} / 协议 {boundCamera.protocol} / 客户端 {BUILD.protocol}。按 ESC 进入固件维护。</span></div>}
|
||||
</VideoSurface>
|
||||
</div>
|
||||
</div>;
|
||||
|
||||
@@ -107,16 +107,42 @@
|
||||
.cockpit .fwfault { top: calc(50% + 64px); bottom: auto; width: max-content; max-width: min(620px, 78%); z-index: 15; }
|
||||
.app--team .calibrate-bar { top: 140px; max-width: calc(100% - 120px); }
|
||||
|
||||
.operator-controls { position: absolute; z-index: 16; left: 50%; bottom: clamp(70px, 12vh, 120px); transform: translateX(-50%); width: min(580px, calc(100% - 48px)); padding: 14px 18px; color: var(--ink); background: #07100de8; border: 1px solid #74af8b55; font: 12px/1.5 var(--font-ui); text-align: center; }
|
||||
.operator-controls__actions { display: flex; justify-content: center; gap: 12px; }
|
||||
.operator-controls__sensitivity { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; }
|
||||
.operator-controls__sensitivity input { width: 120px; }
|
||||
.operator-controls__sensitivity span { min-width: 88px; color: var(--ink-2); }
|
||||
.operator-controls p { margin: 8px 0 0; color: var(--ink-2); }
|
||||
.operator-controls .operator-controls__error { color: var(--warn); }
|
||||
.operator-controls.is-active { width: auto; max-width: calc(100% - 48px); padding: 8px 14px; bottom: 58px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; pointer-events: none; }
|
||||
.operator-controls.is-active strong { color: var(--hud); white-space: nowrap; }
|
||||
.operator-controls.is-active small { flex-basis: 100%; color: var(--ink-2); font-size: 10px; }
|
||||
.operator-controls.is-debug { border-color: var(--warn-line); }
|
||||
.operator-controls.is-debug strong { color: var(--warn); }
|
||||
@media (max-height: 650px) { .operator-controls { bottom: 68px; padding: 10px 14px; } .operator-controls.is-active { bottom: 42px; } }
|
||||
/* 操控入口只占左下角一行,参数在二级菜单中展开。 */
|
||||
.operator-controls { position: relative; z-index: 16; color: var(--ink); pointer-events: auto; flex: none; }
|
||||
.cockpit__actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-width: 0; }
|
||||
.cockpit__actions > span { white-space: nowrap; }
|
||||
.operator-controls__toggle { gap: 10px; min-width: 116px; background: var(--panel); }
|
||||
.operator-controls__toggle > i { width: 6px; height: 6px; background: var(--ink-3); }
|
||||
.operator-controls__toggle > i.is-on { background: var(--hud); }
|
||||
.operator-controls__toggle > span { margin-left: auto; color: var(--ink-3); font: 10px var(--font-mono); }
|
||||
.operator-controls__menu { position: absolute; bottom: calc(100% + 8px); left: 0; width: min(300px, calc(100vw - 56px)); padding: 16px; display: grid; gap: 16px; border: 1px solid var(--line-3); background: var(--panel); animation: dialog-in var(--dur-short4) var(--m3-emphasized-decelerate) both; }
|
||||
.operator-controls__actions { display: flex; gap: 8px; }
|
||||
.operator-controls__actions > button { flex: 1; }
|
||||
.operator-controls__sensitivity { display: grid; gap: 4px; font-size: 11px; color: var(--ink-2); }
|
||||
.operator-controls__menu small { font-size: 10px; color: var(--ink-3); }
|
||||
.operator-controls__fault { margin-left: 10px; font-size: 10px; color: var(--warn); }
|
||||
.operator-mapping { position: absolute; z-index: 12; pointer-events: none; top: 50%; left: 50%; width: min(460px, calc(100% - 56px)); transform: translate(-50%, -50%); color: var(--hud); padding: 18px 22px; background: rgb(5 16 12 / .28); border: 1px solid #74af8b55; font: 10px/1.5 var(--font-mono); animation: hud-reveal var(--dur-medium2) var(--m3-emphasized-decelerate) both; }
|
||||
.operator-mapping header, .operator-mapping footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
.operator-mapping header { letter-spacing: .12em; }
|
||||
.operator-mapping header b { font-weight: 400; color: var(--hud-dim); }
|
||||
.operator-mapping__flow { display: flex; justify-content: center; align-items: center; gap: 20px; padding: 12px 0; color: var(--hud-dim); }
|
||||
.operator-mapping__flow i { font-style: normal; }
|
||||
.operator-mapping__channels { display: grid; gap: 10px; }
|
||||
.operator-mapping__channel { display: grid; grid-template-columns: 80px 1fr 55px; gap: 0 12px; align-items: baseline; }
|
||||
.operator-mapping__channel > strong { text-align: right; font-size: 16px; font-weight: 400; }
|
||||
.operator-mapping__channel > span:first-child { color: var(--hud-dim); }
|
||||
.operator-mapping__track { grid-column: 1 / -1; height: 3px; background: #74af8b22; position: relative; }
|
||||
.operator-mapping__track > i { position: absolute; height: 100%; background: var(--hud); transition: left var(--dur-short1) var(--m3-standard), width var(--dur-short1) var(--m3-standard); }
|
||||
.operator-mapping__track > b { position: absolute; left: 50%; top: -2px; height: 7px; width: 1px; background: #74af8b66; }
|
||||
.operator-mapping footer { border-top: 1px solid #74af8b33; margin-top: 16px; padding-top: 10px; color: var(--hud-dim); }
|
||||
.operator-mapping .is-firing { color: var(--hud); }
|
||||
.ref__mirror-controls { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
|
||||
.ref__mirror-controls .icon { width: 17px; height: 17px; }
|
||||
.ref__mirror-state { color: var(--ink-3); margin-left: 3px; }
|
||||
.operator-controls__toggle > .icon:last-child { width: 16px; height: 16px; margin-left: auto; transform: rotate(-90deg); transition: transform var(--dur-short3) var(--m3-standard); }
|
||||
.operator-controls__toggle > .icon.is-open { transform: rotate(90deg); }
|
||||
.ref__mirror-controls .btn { background: var(--panel); font-size: 10px; }
|
||||
@media (max-height: 650px) { .operator-mapping { padding: 10px 18px; } }
|
||||
@media (prefers-reduced-motion: reduce) { .operator-controls__menu, .operator-mapping { animation: none; } .operator-mapping__track > i { transition: none; } }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) { .operator-controls__toggle > .icon:last-child { transition: none; } }
|
||||
@@ -1064,3 +1064,6 @@
|
||||
animation-delay: 0ms;
|
||||
}
|
||||
}
|
||||
|
||||
/* 每路镜像工具占用页脚布局空间,不覆盖图传。窄窗允许整组换行。 */
|
||||
.ref__foot { height: auto; min-height: 44px; flex-wrap: wrap; row-gap: 8px; padding-block: 6px; }
|
||||
@@ -58,10 +58,14 @@ client/
|
||||
|
||||
### 选手键鼠操作
|
||||
|
||||
绑定在线 C3 后,可在画面下方开启操作:WASD 平移、鼠标滑动控制云台速度、左键按住发送发射状态。鼠标锁定后不受窗口边缘限制;按 ESC 退出,再按 ESC 打开菜单。比赛模式仅在比赛进行中有效;“赛前调试”单独开启,准备、待开赛或尚未连接裁判时可使用,开始倒计时会退出。失焦、断连、结束或输入超时均回零,恢复后需重新点击。
|
||||
绑定在线 C3 后,可在画面左下角“操控”开关的二级菜单开启操作:WASD 平移、鼠标滑动控制云台速度、左键按住发送发射状态。鼠标锁定后不受窗口边缘限制;按 ESC 退出,再按 ESC 打开菜单。比赛模式仅在比赛进行中有效;“赛前调试”单独开启,准备、待开赛或尚未连接裁判时可使用,开始倒计时会退出。失焦、断连、结束或输入超时均回零,恢复后需重新点击。
|
||||
|
||||
默认 1000 像素/秒映射到通道满幅 ±1000,支持本次会话的灵敏度调节。装甲板 TXD/GPIO21 以 115200 8N1 输出项目协议,软件日志改走 USB。客户端与 C3 均需更新,并在下位机接入解析器;当前没有串口操控应答,界面不表示电机已经响应。完整映射、串口帧与 C99 接收示例见[键鼠操作与用户 UART](../protocol/operator-control.md)。
|
||||
|
||||
操控入口默认只保留左下角开关,比赛/赛前调试与灵敏度滑条在二级菜单中。赛前调试发送时,画面中央以半透明 HUD 显示 CH0–CH3 的输入、速度值和发射位;它显示客户端输入,不是下位机实测速度或串口应答。动画使用现有 M3 缓动令牌并支持减少动态效果。
|
||||
|
||||
画面镜像按图传板 ID 双向同步:选手修改本车后裁判对应一路更新,裁判每路的左右/上下镜像按钮也会回传;旧配置保留原默认方向。两端需更新客户端,固件无需更新,详情见[镜像同步协议](../protocol/udp.md#画面镜像同步类型-12)。
|
||||
|
||||
`pnpm test:input` 检查速度换算、停止与最新输入队列;浏览器预览只模拟本地输入,页面标记“合成输入”,不会发送现场控制。
|
||||
|
||||
### 配色:墨黑蓝打底,只有一支红
|
||||
@@ -607,3 +611,6 @@ RUST_LOG=debug ./target/aarch64-apple-darwin/debug/cam-desktop | grep 'stream:'
|
||||
| 两路画面与队伍对应不符 | 在设置中核对图传板槽位,必要时手动指定;通用装甲板固件在客户端选择队伍,旧版固定队伍固件才使用编译时的 `ARMOR_TEAM` |
|
||||
| macOS 上 WebKit 报 `could not create directory .../WebKit/...` | 运行环境禁止写 `~/Library/WebKit`(沙箱)。WebView 会退回无缓存的临时目录,功能不受影响 |
|
||||
| `libc` 找不到 `MAP_FAILED` | `client/.cargo/config.toml` 的 target 没改成宿主三元组 |
|
||||
|
||||
|
||||
镜像按钮位于裁判每路画面下方的信息栏,不再覆盖视频。选手端操控开关与 ESC 提示共用底部工具行,由 HUD 网格为其保留空间;图传读数位于上一行,避免按钮遮挡。镜像、操控、比赛和调试入口使用本地图标,界面分隔不再使用中点符号。
|
||||
@@ -77,6 +77,7 @@ cargo +stable test --locked --target x86_64-pc-windows-msvc --config 'unstable.b
|
||||
| 8 `ArmorDamageControl` | 裁判端 → 当前比赛装甲板 | 定向发送扣血许可,每 200 ms 续约 |
|
||||
| 9 `ArmorReset` | 裁判端 ↔ 当前比赛装甲板 | 定向复位请求与回执 |
|
||||
| 10 `MatchResult` | 裁判端 → 选手端 | 锁定的终局结论与结束计时,广播至 UDP 5601 |
|
||||
| 12 `CameraMirror` | 选手端 ↔ 裁判端 | 每路图传镜像寄存器,广播 UDP 5601 |
|
||||
| 11 `OperatorControl` | 选手端 → 绑定的装甲板 | 四轴速度和发射状态,定向发送到主板上报端口 |
|
||||
|
||||
类型 11 保持线路版本 1,不改变旧消息布局;旧 C3 会忽略该类型,使用操控功能需更新 C3。载荷、租约及下游 UART 帧见[键鼠操作与用户 UART](operator-control.md)。
|
||||
@@ -289,3 +290,16 @@ UDP 不保证数据报的顺序和到达。接收端等待下一张完整帧,
|
||||
客户端先进入结束阶段并发送禁止扣血许可,再向固定的本局槽位主板发送同序号复位请求;每 200 ms 随新许可更新请求序号,最多等待 3 秒。板端只接受目标 id 匹配、同一来源 IP/端口与会话、序号等于最新有效禁止扣血许可的请求。首次执行恢复满血并清受击计数、冷却;同复位 id 的重试只回复回执并重发血量,不重复复位。旧复位 id、旧许可序号、过期许可及运行许可下的请求均拒绝。
|
||||
|
||||
回执定向发回裁判端,并沿用请求字段;板端同时通过原血量通道广播四路真实血量。客户端逐板核对来源地址、会话、复位 id 和已发送序号,收到回执及其后的四路 100 血上报才完成重置,不根据回执伪造血量。部分成功或超时均保留结束阶段。来源与会话约束防止意外混用,不提供身份认证。旧装甲板忽略 type=9,必须更新固件才能远程复位;图传板无需更新。独立字节核对见 `python armor/scripts/test-probe.py`,探测器不发送复位。
|
||||
|
||||
### 画面镜像同步(类型 12)
|
||||
|
||||
客户端按图传板 ID 保存水平、垂直镜像,双方均可修改;裁判两路独立。沿用线路版本 1、27 字节头,头部业务字段均为零。固定 21 字节负载依次为 camera_id:u32、revision:u64、origin:u64、flags:u8,均小端;flags bit0 水平、bit1 垂直,其余位必须为零。三个整数必须非零,整包严格 48 字节。
|
||||
|
||||
revision 为逻辑时钟,本地修改取已知最大修订号加一,origin 为进程实例标识。接收仅应用 `(revision, origin)` 更大的值,重复、乱序和回声不会反复覆盖;并发同修订号按 origin 排序收敛,不依赖两台电脑墙钟。只接收已绑定图传板或裁判当前槽位的设置,每 200 ms 重发这些相机已有的修订记录以补偿 UDP 丢包和晚加入。镜像同时使用独立的 IPv4 组播 `239.255.56.2:5602`(TTL=1、开启本机回环),支持同机多实例各自订阅;原 UDP 5601 广播作为跨版本兼容路径保留。装甲板及计时的 5601 端口不改为共享绑定,避免 Windows 单播回执被随机分发到某个实例。接收回调只更新最多两路的内存收件箱,配置写盘在后台执行。
|
||||
|
||||
配置中 `cameraMirrors` 保存每路记录,旧配置缺失时回落到原有镜像默认值。尚未改动过的默认值不广播,避免新加入的客户端覆盖已配置记录。全局设置对当前槽位批量应用,裁判画面下方按钮只修改所在一路。演示预览不收发真实同步消息。需要双方更新客户端,固件无需更新;广播仍受网卡、防火墙和局域网可达性影响,该消息不提供身份认证。
|
||||
|
||||
|
||||
同机验证入口:先从 `client/` 运行 `pnpm build` 并编译桌面端,再运行 `node client/scripts/test-mirror-instances.mjs <客户端可执行文件>`(仓库根目录)。未给路径时使用已编译的 debug 客户端,需先启动 `pnpm dev`。脚本启动两个真正的原生客户端进程,通过各自独立 WebView2 调试端口调用生产 IPC、读取生产快照;使用独立临时配置和合成图传 ID,保持角色选择未完成,禁止测试实例广播正式比赛状态,也不启动操作输入。完成后只关闭它启动的实例。
|
||||
|
||||
脚本覆盖两路独立、双向设置、12 轮并发写入、任一实例退出期间另一端修改、重启后的追赶、改绑到另一图传板及双方再次重启后的持久化一致性。这里的断连为关闭实例后重新加入,不代表已测试真实网卡拔插、跨网段或无线 AP 的组播转发。完整的同机测试结果写入 `target/mirror-instances-*/report.json`。
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.1",
|
||||
"major": 0,
|
||||
"minor": 5,
|
||||
"patch": 0,
|
||||
"build": 46,
|
||||
"minor": 6,
|
||||
"patch": 1,
|
||||
"build": 48,
|
||||
"protocol": 1,
|
||||
"date": "2026-10-31",
|
||||
"baseline": "v0.5.0",
|
||||
"date": "2026-11-01",
|
||||
"baseline": "v0.6.1",
|
||||
"commits": 0,
|
||||
"groups": {}
|
||||
}
|
||||
@@ -4,6 +4,22 @@
|
||||
> 提交采用 Conventional Commits,规则见[版本维护](../development/versioning.md)。
|
||||
> 自动版本机制建立前的说明见[早期人工记录](changelog-legacy.md)。
|
||||
|
||||
## v0.6.1 — 2026-11-01
|
||||
|
||||
1 个提交
|
||||
|
||||
### 修复
|
||||
|
||||
- **client** · 修复双实例镜像同步并调整底部工具布局
|
||||
|
||||
## v0.6.0 — 2026-11-01
|
||||
|
||||
1 个提交
|
||||
|
||||
### 新增
|
||||
|
||||
- **client** · 同步每路镜像并精简操控入口与 HUD 映射
|
||||
|
||||
## v0.5.0 — 2026-10-31
|
||||
|
||||
1 个提交
|
||||
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.1",
|
||||
"major": 0,
|
||||
"minor": 5,
|
||||
"patch": 0,
|
||||
"build": 46,
|
||||
"minor": 6,
|
||||
"patch": 1,
|
||||
"build": 48,
|
||||
"protocol": 1,
|
||||
"date": "2026-10-31",
|
||||
"baseline": "v0.5.0",
|
||||
"date": "2026-11-01",
|
||||
"baseline": "v0.6.1",
|
||||
"note": "由 scripts/version.mjs 从 git 历史算出,请勿手改。"
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
use crate::{decode_header, encode_header_into, Header, MsgType, HEADER_LEN};
|
||||
|
||||
/// 每路画面的镜像寄存器。revision 是逻辑时钟,origin 用于并发写入的确定排序。
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct CameraMirror {
|
||||
pub camera_id: u32,
|
||||
pub revision: u64,
|
||||
pub origin: u64,
|
||||
pub mirror: bool,
|
||||
pub mirror_vertical: bool,
|
||||
}
|
||||
impl CameraMirror {
|
||||
pub fn encode(self) -> Option<Vec<u8>> {
|
||||
if self.camera_id == 0 || self.revision == 0 || self.origin == 0 {
|
||||
return None;
|
||||
}
|
||||
let mut bytes = Vec::new();
|
||||
encode_header_into(
|
||||
&Header {
|
||||
msg_type: MsgType::CameraMirror,
|
||||
..Default::default()
|
||||
},
|
||||
&mut bytes,
|
||||
);
|
||||
bytes.extend(self.camera_id.to_le_bytes());
|
||||
bytes.extend(self.revision.to_le_bytes());
|
||||
bytes.extend(self.origin.to_le_bytes());
|
||||
bytes.push(u8::from(self.mirror) | (u8::from(self.mirror_vertical) << 1));
|
||||
Some(bytes)
|
||||
}
|
||||
pub fn decode(bytes: &[u8]) -> Option<Self> {
|
||||
let h = decode_header(bytes)?;
|
||||
if h.msg_type != MsgType::CameraMirror
|
||||
|| bytes.len() != HEADER_LEN + 21
|
||||
|| bytes[7..HEADER_LEN].iter().any(|v| *v != 0)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let p = &bytes[HEADER_LEN..];
|
||||
if p[20] > 3 {
|
||||
return None;
|
||||
}
|
||||
let value = Self {
|
||||
camera_id: u32::from_le_bytes(p[..4].try_into().ok()?),
|
||||
revision: u64::from_le_bytes(p[4..12].try_into().ok()?),
|
||||
origin: u64::from_le_bytes(p[12..20].try_into().ok()?),
|
||||
mirror: p[20] & 1 != 0,
|
||||
mirror_vertical: p[20] & 2 != 0,
|
||||
};
|
||||
value.encode()?;
|
||||
Some(value)
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn exact_validated_mirror_roundtrip() {
|
||||
let p = CameraMirror {
|
||||
camera_id: 7,
|
||||
revision: 4,
|
||||
origin: 2,
|
||||
mirror: true,
|
||||
mirror_vertical: false,
|
||||
};
|
||||
let bytes = p.encode().unwrap();
|
||||
assert_eq!(CameraMirror::decode(&bytes), Some(p));
|
||||
for n in 0..bytes.len() {
|
||||
assert!(CameraMirror::decode(&bytes[..n]).is_none());
|
||||
}
|
||||
for at in [5, 7, HEADER_LEN + 20] {
|
||||
let mut bad = bytes.clone();
|
||||
bad[at] = 255;
|
||||
assert!(CameraMirror::decode(&bad).is_none());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,8 @@
|
||||
//! ```
|
||||
|
||||
use std::net::{Ipv4Addr, SocketAddrV4};
|
||||
mod camera_mirror;
|
||||
pub use camera_mirror::CameraMirror;
|
||||
|
||||
mod match_state;
|
||||
pub use match_state::MatchState;
|
||||
@@ -136,6 +138,7 @@ pub enum MsgType {
|
||||
MatchResult = 10,
|
||||
/// 选手端定向发送给已绑定装甲板的四轴速度与发射状态。
|
||||
OperatorControl = 11,
|
||||
CameraMirror = 12,
|
||||
}
|
||||
|
||||
impl MsgType {
|
||||
@@ -153,6 +156,7 @@ impl MsgType {
|
||||
9 => MsgType::ArmorReset,
|
||||
10 => MsgType::MatchResult,
|
||||
11 => MsgType::OperatorControl,
|
||||
12 => MsgType::CameraMirror,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ MSG_ARMOR_DAMAGE_CONTROL = 8
|
||||
MSG_ARMOR_RESET = 9
|
||||
MSG_MATCH_RESULT = 10
|
||||
MSG_OPERATOR_CONTROL = 11
|
||||
MSG_CAMERA_MIRROR = 12
|
||||
|
||||
TYPE_NAMES = {
|
||||
MSG_VIDEO: "video",
|
||||
@@ -53,6 +54,7 @@ TYPE_NAMES = {
|
||||
MSG_ARMOR_RESET: "armor-reset",
|
||||
MSG_MATCH_RESULT: "match-result",
|
||||
MSG_OPERATOR_CONTROL: "operator-control",
|
||||
MSG_CAMERA_MIRROR: "camera-mirror",
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user