mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
log on invert
This commit is contained in:
+8
-1
@@ -249,9 +249,16 @@ func validateServoConfig(cfg *CameraServoConfig) error {
|
||||
if cfg.CycleLen <= 0 {
|
||||
return errors.New("cycleLen must be > 0")
|
||||
}
|
||||
if cfg.MinPulseUs <= 0 || cfg.MaxPulseUs <= 0 || cfg.MinPulseUs >= cfg.MaxPulseUs {
|
||||
if cfg.MinPulseUs <= 0 || cfg.MaxPulseUs <= 0 {
|
||||
return errors.New("minPulseUs/maxPulseUs invalid")
|
||||
}
|
||||
if cfg.MinPulseUs == cfg.MaxPulseUs {
|
||||
return errors.New("minPulseUs/maxPulseUs cannot be equal")
|
||||
}
|
||||
if cfg.MinPulseUs > cfg.MaxPulseUs {
|
||||
cfg.MinPulseUs, cfg.MaxPulseUs = cfg.MaxPulseUs, cfg.MinPulseUs
|
||||
cfg.Invert = !cfg.Invert
|
||||
}
|
||||
if cfg.MinAngle >= cfg.MaxAngle {
|
||||
return errors.New("minAngle must be less than maxAngle")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user