chore: set l10 default connection info to true
This commit is contained in:
parent
1280a1a3f3
commit
312dd728b5
@ -30,13 +30,7 @@ type L10Hand struct {
|
||||
// 在 base 基础上进行 ±delta 的扰动,范围限制在 [0, 255]
|
||||
func perturb(base byte, delta int) byte {
|
||||
offset := rand.IntN(2*delta+1) - delta
|
||||
v := int(base) + offset
|
||||
if v < 0 {
|
||||
v = 0
|
||||
}
|
||||
if v > 255 {
|
||||
v = 255
|
||||
}
|
||||
v := min(max(int(base)+offset, 0), 255)
|
||||
return byte(v)
|
||||
}
|
||||
|
||||
@ -79,8 +73,9 @@ func NewL10Hand(config map[string]any) (device.Device, error) {
|
||||
components: make(map[device.ComponentType][]device.Component),
|
||||
canInterface: canInterface,
|
||||
status: device.DeviceStatus{
|
||||
IsConnected: false,
|
||||
IsActive: false,
|
||||
// TODO: 这里需要修改,根据实际连接情况设置,因为当前还没有实现连接和断开路由,先设置为 true
|
||||
IsConnected: true,
|
||||
IsActive: true,
|
||||
LastUpdate: time.Now(),
|
||||
},
|
||||
}
|
||||
|
7
main.go
7
main.go
@ -2,9 +2,11 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hands/api"
|
||||
"hands/api2"
|
||||
"hands/cli"
|
||||
"hands/config"
|
||||
"hands/device"
|
||||
"hands/device/models"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
@ -70,9 +72,6 @@ func main() {
|
||||
log.Fatal("❌ 没有设置默认 CAN 接口")
|
||||
}
|
||||
|
||||
// 记录启动时间
|
||||
api.ServerStartTime = time.Now()
|
||||
|
||||
log.Printf("🚀 启动 CAN 控制服务 (支持左右手配置)")
|
||||
|
||||
// 初始化服务
|
||||
|
Loading…
x
Reference in New Issue
Block a user