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