Skip to content

Commit

Permalink
ChassisSpeedLevelType -> ChassisSpeedLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoga committed Aug 6, 2024
1 parent aa25001 commit e62425f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package robot

// ChassisSpeedLevelType represents the speed level of the chassis.
type ChassisSpeedLevelType int8
// ChassisSpeedLevel represents the speed level of the chassis.
type ChassisSpeedLevel int8

const (
// ChassisSpeedLevelFast is the fast speed level.
ChassisSpeedLevelFast ChassisSpeedLevelType = iota
ChassisSpeedLevelFast ChassisSpeedLevel = iota
// ChassisSpeedLevelMedium is the medium speed level.
ChassisSpeedLevelMedium
// ChassisSpeedLevelSlow is the slow speed level.
Expand Down
6 changes: 3 additions & 3 deletions module/robot/robot.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,17 @@ func (r *Robot) BatteryPowerPercent() uint8 {
}

// ChassisSpeedLevel returns the current chassis speed level.
func (r *Robot) ChassisSpeedLevel() (ChassisSpeedLevelType, error) {
func (r *Robot) ChassisSpeedLevel() (ChassisSpeedLevel, error) {
res, err := r.UB().GetKeyValueSync(key.KeyRobomasterSystemChassisSpeedLevel, true)
if err != nil {
return 0, err
}

return ChassisSpeedLevelType(res.Value().(*value.Uint64).Value - 1), nil
return ChassisSpeedLevel(res.Value().(*value.Uint64).Value - 1), nil
}

// SetChassisSpeedLevel sets the chassis speed level.
func (r *Robot) SetChassisSpeedLevel(speedLevel ChassisSpeedLevelType) error {
func (r *Robot) SetChassisSpeedLevel(speedLevel ChassisSpeedLevel) error {
if speedLevel >= ChassisSpeedLevelTypeCount {
return fmt.Errorf("invalid chassis speed level: %d", speedLevel)
}
Expand Down

0 comments on commit e62425f

Please sign in to comment.