Skip to content

Commit

Permalink
(automatic) update dialects to rev https://github.com/mavlink/mavlink…
Browse files Browse the repository at this point in the history
  • Loading branch information
gomavlib-bot committed Sep 23, 2023
1 parent e52ca40 commit 26b77a4
Show file tree
Hide file tree
Showing 222 changed files with 6,440 additions and 4,764 deletions.
252 changes: 228 additions & 24 deletions pkg/dialects/all/enum_mav_cmd.go

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions pkg/dialects/ardupilotmega/enum_accelcal_vehicle_pos.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ardupilotmega

import (
"fmt"
"strings"
"strconv"
)

type ACCELCAL_VEHICLE_POS uint32
Expand All @@ -31,40 +31,41 @@ var labels_ACCELCAL_VEHICLE_POS = map[ACCELCAL_VEHICLE_POS]string{
ACCELCAL_VEHICLE_POS_FAILED: "ACCELCAL_VEHICLE_POS_FAILED",
}

var values_ACCELCAL_VEHICLE_POS = map[string]ACCELCAL_VEHICLE_POS{
"ACCELCAL_VEHICLE_POS_LEVEL": ACCELCAL_VEHICLE_POS_LEVEL,
"ACCELCAL_VEHICLE_POS_LEFT": ACCELCAL_VEHICLE_POS_LEFT,
"ACCELCAL_VEHICLE_POS_RIGHT": ACCELCAL_VEHICLE_POS_RIGHT,
"ACCELCAL_VEHICLE_POS_NOSEDOWN": ACCELCAL_VEHICLE_POS_NOSEDOWN,
"ACCELCAL_VEHICLE_POS_NOSEUP": ACCELCAL_VEHICLE_POS_NOSEUP,
"ACCELCAL_VEHICLE_POS_BACK": ACCELCAL_VEHICLE_POS_BACK,
"ACCELCAL_VEHICLE_POS_SUCCESS": ACCELCAL_VEHICLE_POS_SUCCESS,
"ACCELCAL_VEHICLE_POS_FAILED": ACCELCAL_VEHICLE_POS_FAILED,
}

// MarshalText implements the encoding.TextMarshaler interface.
func (e ACCELCAL_VEHICLE_POS) MarshalText() ([]byte, error) {
var names []string
for mask, label := range labels_ACCELCAL_VEHICLE_POS {
if e&mask == mask {
names = append(names, label)
}
name, ok := labels_ACCELCAL_VEHICLE_POS[e]
if !ok {
return nil, fmt.Errorf("invalid value %d", e)
}
return []byte(strings.Join(names, " | ")), nil
return []byte(name), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (e *ACCELCAL_VEHICLE_POS) UnmarshalText(text []byte) error {
labels := strings.Split(string(text), " | ")
var mask ACCELCAL_VEHICLE_POS
for _, label := range labels {
found := false
for value, l := range labels_ACCELCAL_VEHICLE_POS {
if l == label {
mask |= value
found = true
break
}
}
if !found {
return fmt.Errorf("invalid label '%s'", label)
}
value, ok := values_ACCELCAL_VEHICLE_POS[string(text)]
if !ok {
return fmt.Errorf("invalid label '%s'", text)
}
*e = mask
*e = value
return nil
}

// String implements the fmt.Stringer interface.
func (e ACCELCAL_VEHICLE_POS) String() string {
val, _ := e.MarshalText()
return string(val)
name, ok := labels_ACCELCAL_VEHICLE_POS[e]
if !ok {
return strconv.Itoa(int(e))
}
return name
}
46 changes: 22 additions & 24 deletions pkg/dialects/ardupilotmega/enum_camera_feedback_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ardupilotmega

import (
"fmt"
"strings"
"strconv"
)

type CAMERA_FEEDBACK_FLAGS uint32
Expand All @@ -30,40 +30,38 @@ var labels_CAMERA_FEEDBACK_FLAGS = map[CAMERA_FEEDBACK_FLAGS]string{
CAMERA_FEEDBACK_OPENLOOP: "CAMERA_FEEDBACK_OPENLOOP",
}

var values_CAMERA_FEEDBACK_FLAGS = map[string]CAMERA_FEEDBACK_FLAGS{
"CAMERA_FEEDBACK_PHOTO": CAMERA_FEEDBACK_PHOTO,
"CAMERA_FEEDBACK_VIDEO": CAMERA_FEEDBACK_VIDEO,
"CAMERA_FEEDBACK_BADEXPOSURE": CAMERA_FEEDBACK_BADEXPOSURE,
"CAMERA_FEEDBACK_CLOSEDLOOP": CAMERA_FEEDBACK_CLOSEDLOOP,
"CAMERA_FEEDBACK_OPENLOOP": CAMERA_FEEDBACK_OPENLOOP,
}

// MarshalText implements the encoding.TextMarshaler interface.
func (e CAMERA_FEEDBACK_FLAGS) MarshalText() ([]byte, error) {
var names []string
for mask, label := range labels_CAMERA_FEEDBACK_FLAGS {
if e&mask == mask {
names = append(names, label)
}
name, ok := labels_CAMERA_FEEDBACK_FLAGS[e]
if !ok {
return nil, fmt.Errorf("invalid value %d", e)
}
return []byte(strings.Join(names, " | ")), nil
return []byte(name), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (e *CAMERA_FEEDBACK_FLAGS) UnmarshalText(text []byte) error {
labels := strings.Split(string(text), " | ")
var mask CAMERA_FEEDBACK_FLAGS
for _, label := range labels {
found := false
for value, l := range labels_CAMERA_FEEDBACK_FLAGS {
if l == label {
mask |= value
found = true
break
}
}
if !found {
return fmt.Errorf("invalid label '%s'", label)
}
value, ok := values_CAMERA_FEEDBACK_FLAGS[string(text)]
if !ok {
return fmt.Errorf("invalid label '%s'", text)
}
*e = mask
*e = value
return nil
}

// String implements the fmt.Stringer interface.
func (e CAMERA_FEEDBACK_FLAGS) String() string {
val, _ := e.MarshalText()
return string(val)
name, ok := labels_CAMERA_FEEDBACK_FLAGS[e]
if !ok {
return strconv.Itoa(int(e))
}
return name
}
48 changes: 24 additions & 24 deletions pkg/dialects/ardupilotmega/enum_camera_status_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ardupilotmega

import (
"fmt"
"strings"
"strconv"
)

type CAMERA_STATUS_TYPES uint32
Expand Down Expand Up @@ -36,40 +36,40 @@ var labels_CAMERA_STATUS_TYPES = map[CAMERA_STATUS_TYPES]string{
CAMERA_STATUS_TYPE_LOWSTOREV: "CAMERA_STATUS_TYPE_LOWSTOREV",
}

var values_CAMERA_STATUS_TYPES = map[string]CAMERA_STATUS_TYPES{
"CAMERA_STATUS_TYPE_HEARTBEAT": CAMERA_STATUS_TYPE_HEARTBEAT,
"CAMERA_STATUS_TYPE_TRIGGER": CAMERA_STATUS_TYPE_TRIGGER,
"CAMERA_STATUS_TYPE_DISCONNECT": CAMERA_STATUS_TYPE_DISCONNECT,
"CAMERA_STATUS_TYPE_ERROR": CAMERA_STATUS_TYPE_ERROR,
"CAMERA_STATUS_TYPE_LOWBATT": CAMERA_STATUS_TYPE_LOWBATT,
"CAMERA_STATUS_TYPE_LOWSTORE": CAMERA_STATUS_TYPE_LOWSTORE,
"CAMERA_STATUS_TYPE_LOWSTOREV": CAMERA_STATUS_TYPE_LOWSTOREV,
}

// MarshalText implements the encoding.TextMarshaler interface.
func (e CAMERA_STATUS_TYPES) MarshalText() ([]byte, error) {
var names []string
for mask, label := range labels_CAMERA_STATUS_TYPES {
if e&mask == mask {
names = append(names, label)
}
name, ok := labels_CAMERA_STATUS_TYPES[e]
if !ok {
return nil, fmt.Errorf("invalid value %d", e)
}
return []byte(strings.Join(names, " | ")), nil
return []byte(name), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (e *CAMERA_STATUS_TYPES) UnmarshalText(text []byte) error {
labels := strings.Split(string(text), " | ")
var mask CAMERA_STATUS_TYPES
for _, label := range labels {
found := false
for value, l := range labels_CAMERA_STATUS_TYPES {
if l == label {
mask |= value
found = true
break
}
}
if !found {
return fmt.Errorf("invalid label '%s'", label)
}
value, ok := values_CAMERA_STATUS_TYPES[string(text)]
if !ok {
return fmt.Errorf("invalid label '%s'", text)
}
*e = mask
*e = value
return nil
}

// String implements the fmt.Stringer interface.
func (e CAMERA_STATUS_TYPES) String() string {
val, _ := e.MarshalText()
return string(val)
name, ok := labels_CAMERA_STATUS_TYPES[e]
if !ok {
return strconv.Itoa(int(e))
}
return name
}
66 changes: 42 additions & 24 deletions pkg/dialects/ardupilotmega/enum_copter_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ardupilotmega

import (
"fmt"
"strings"
"strconv"
)

// A mapping of copter flight modes for custom_mode field of heartbeat.
Expand Down Expand Up @@ -66,40 +66,58 @@ var labels_COPTER_MODE = map[COPTER_MODE]string{
COPTER_MODE_AUTO_RTL: "COPTER_MODE_AUTO_RTL",
}

var values_COPTER_MODE = map[string]COPTER_MODE{
"COPTER_MODE_STABILIZE": COPTER_MODE_STABILIZE,
"COPTER_MODE_ACRO": COPTER_MODE_ACRO,
"COPTER_MODE_ALT_HOLD": COPTER_MODE_ALT_HOLD,
"COPTER_MODE_AUTO": COPTER_MODE_AUTO,
"COPTER_MODE_GUIDED": COPTER_MODE_GUIDED,
"COPTER_MODE_LOITER": COPTER_MODE_LOITER,
"COPTER_MODE_RTL": COPTER_MODE_RTL,
"COPTER_MODE_CIRCLE": COPTER_MODE_CIRCLE,
"COPTER_MODE_LAND": COPTER_MODE_LAND,
"COPTER_MODE_DRIFT": COPTER_MODE_DRIFT,
"COPTER_MODE_SPORT": COPTER_MODE_SPORT,
"COPTER_MODE_FLIP": COPTER_MODE_FLIP,
"COPTER_MODE_AUTOTUNE": COPTER_MODE_AUTOTUNE,
"COPTER_MODE_POSHOLD": COPTER_MODE_POSHOLD,
"COPTER_MODE_BRAKE": COPTER_MODE_BRAKE,
"COPTER_MODE_THROW": COPTER_MODE_THROW,
"COPTER_MODE_AVOID_ADSB": COPTER_MODE_AVOID_ADSB,
"COPTER_MODE_GUIDED_NOGPS": COPTER_MODE_GUIDED_NOGPS,
"COPTER_MODE_SMART_RTL": COPTER_MODE_SMART_RTL,
"COPTER_MODE_FLOWHOLD": COPTER_MODE_FLOWHOLD,
"COPTER_MODE_FOLLOW": COPTER_MODE_FOLLOW,
"COPTER_MODE_ZIGZAG": COPTER_MODE_ZIGZAG,
"COPTER_MODE_SYSTEMID": COPTER_MODE_SYSTEMID,
"COPTER_MODE_AUTOROTATE": COPTER_MODE_AUTOROTATE,
"COPTER_MODE_AUTO_RTL": COPTER_MODE_AUTO_RTL,
}

// MarshalText implements the encoding.TextMarshaler interface.
func (e COPTER_MODE) MarshalText() ([]byte, error) {
var names []string
for mask, label := range labels_COPTER_MODE {
if e&mask == mask {
names = append(names, label)
}
name, ok := labels_COPTER_MODE[e]
if !ok {
return nil, fmt.Errorf("invalid value %d", e)
}
return []byte(strings.Join(names, " | ")), nil
return []byte(name), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (e *COPTER_MODE) UnmarshalText(text []byte) error {
labels := strings.Split(string(text), " | ")
var mask COPTER_MODE
for _, label := range labels {
found := false
for value, l := range labels_COPTER_MODE {
if l == label {
mask |= value
found = true
break
}
}
if !found {
return fmt.Errorf("invalid label '%s'", label)
}
value, ok := values_COPTER_MODE[string(text)]
if !ok {
return fmt.Errorf("invalid label '%s'", text)
}
*e = mask
*e = value
return nil
}

// String implements the fmt.Stringer interface.
func (e COPTER_MODE) String() string {
val, _ := e.MarshalText()
return string(val)
name, ok := labels_COPTER_MODE[e]
if !ok {
return strconv.Itoa(int(e))
}
return name
}
48 changes: 24 additions & 24 deletions pkg/dialects/ardupilotmega/enum_deepstall_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ardupilotmega

import (
"fmt"
"strings"
"strconv"
)

// Deepstall flight stage.
Expand Down Expand Up @@ -37,40 +37,40 @@ var labels_DEEPSTALL_STAGE = map[DEEPSTALL_STAGE]string{
DEEPSTALL_STAGE_LAND: "DEEPSTALL_STAGE_LAND",
}

var values_DEEPSTALL_STAGE = map[string]DEEPSTALL_STAGE{
"DEEPSTALL_STAGE_FLY_TO_LANDING": DEEPSTALL_STAGE_FLY_TO_LANDING,
"DEEPSTALL_STAGE_ESTIMATE_WIND": DEEPSTALL_STAGE_ESTIMATE_WIND,
"DEEPSTALL_STAGE_WAIT_FOR_BREAKOUT": DEEPSTALL_STAGE_WAIT_FOR_BREAKOUT,
"DEEPSTALL_STAGE_FLY_TO_ARC": DEEPSTALL_STAGE_FLY_TO_ARC,
"DEEPSTALL_STAGE_ARC": DEEPSTALL_STAGE_ARC,
"DEEPSTALL_STAGE_APPROACH": DEEPSTALL_STAGE_APPROACH,
"DEEPSTALL_STAGE_LAND": DEEPSTALL_STAGE_LAND,
}

// MarshalText implements the encoding.TextMarshaler interface.
func (e DEEPSTALL_STAGE) MarshalText() ([]byte, error) {
var names []string
for mask, label := range labels_DEEPSTALL_STAGE {
if e&mask == mask {
names = append(names, label)
}
name, ok := labels_DEEPSTALL_STAGE[e]
if !ok {
return nil, fmt.Errorf("invalid value %d", e)
}
return []byte(strings.Join(names, " | ")), nil
return []byte(name), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (e *DEEPSTALL_STAGE) UnmarshalText(text []byte) error {
labels := strings.Split(string(text), " | ")
var mask DEEPSTALL_STAGE
for _, label := range labels {
found := false
for value, l := range labels_DEEPSTALL_STAGE {
if l == label {
mask |= value
found = true
break
}
}
if !found {
return fmt.Errorf("invalid label '%s'", label)
}
value, ok := values_DEEPSTALL_STAGE[string(text)]
if !ok {
return fmt.Errorf("invalid label '%s'", text)
}
*e = mask
*e = value
return nil
}

// String implements the fmt.Stringer interface.
func (e DEEPSTALL_STAGE) String() string {
val, _ := e.MarshalText()
return string(val)
name, ok := labels_DEEPSTALL_STAGE[e]
if !ok {
return strconv.Itoa(int(e))
}
return name
}
Loading

0 comments on commit 26b77a4

Please sign in to comment.