From ce63b28e244be689fe4f5c2ac6d0ca052356e649 Mon Sep 17 00:00:00 2001 From: Eli Yip Date: Tue, 27 May 2025 14:07:30 +0800 Subject: [PATCH] chore: move sensor definition to sensor.go --- hands/hands.go | 12 ------------ hands/sensor.go | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hands/hands.go b/hands/hands.go index fc1c1c3..6bccf2f 100644 --- a/hands/hands.go +++ b/hands/hands.go @@ -11,18 +11,6 @@ import ( "time" ) -// 传感器数据结构体 -type SensorData struct { - Interface string `json:"interface"` - Thumb int `json:"thumb"` - Index int `json:"index"` - Middle int `json:"middle"` - Ring int `json:"ring"` - Pinky int `json:"pinky"` - PalmPosition []byte `json:"palmPosition"` - LastUpdate time.Time `json:"lastUpdate"` -} - // 手型配置结构体 type HandConfig struct { HandType string `json:"handType"` diff --git a/hands/sensor.go b/hands/sensor.go index 515abe3..a8185d7 100644 --- a/hands/sensor.go +++ b/hands/sensor.go @@ -7,6 +7,18 @@ import ( "time" ) +// 传感器数据结构体 +type SensorData struct { + Interface string `json:"interface"` + Thumb int `json:"thumb"` + Index int `json:"index"` + Middle int `json:"middle"` + Ring int `json:"ring"` + Pinky int `json:"pinky"` + PalmPosition []byte `json:"palmPosition"` + LastUpdate time.Time `json:"lastUpdate"` +} + var ( SensorDataMap map[string]*SensorData // 每个接口的传感器数据 SensorMutex sync.RWMutex