diff --git a/internal/generate/compile.go b/internal/generate/compile.go index 767a3fb..2a6b5b5 100644 --- a/internal/generate/compile.go +++ b/internal/generate/compile.go @@ -98,6 +98,26 @@ func (c *compiler) collectDescriptors() { func (c *compiler) addMetadata() { for _, def := range c.defs { switch def := def.(type) { + case *dbc.SignalValueTypeDef: + signal, ok := c.db.Signal(def.MessageID.ToCAN(), string(def.SignalName)) + if !ok { + c.addWarning(&compileError{def: def, reason: "no declared signal"}) + continue + } + switch def.SignalValueType { + case dbc.SignalValueTypeInt: + signal.IsFloat = false + case dbc.SignalValueTypeFloat32: + if signal.Length == 32 { + signal.IsFloat = true + } else { + reason := fmt.Sprintf("incorrect float signal length: %d", signal.Length) + c.addWarning(&compileError{def: def, reason: reason}) + } + default: + reason := fmt.Sprintf("unsupported signal value type: %v", def.SignalValueType) + c.addWarning(&compileError{def: def, reason: reason}) + } case *dbc.CommentDef: switch def.ObjectType { case dbc.ObjectTypeMessage: diff --git a/internal/generate/compile_test.go b/internal/generate/compile_test.go index 6aa4592..249e6a2 100644 --- a/internal/generate/compile_test.go +++ b/internal/generate/compile_test.go @@ -293,6 +293,34 @@ func TestCompile_ExampleDBC(t *testing.T) { }, }, }, + { + ID: 600, + Name: "IOFloat32", + Length: 8, + SenderNode: "IO", + SendType: descriptor.SendTypeNone, + Signals: []*descriptor.Signal{ + { + Name: "Float32ValueNoRange", + Length: 32, + IsSigned: true, + IsFloat: true, + Scale: 1, + ReceiverNodes: []string{"DBG"}, + }, + { + Name: "Float32WithRange", + Start: 32, + Length: 32, + IsSigned: true, + IsFloat: true, + Scale: 1, + Min: -100, + Max: 100, + ReceiverNodes: []string{"DBG"}, + }, + }, + }, }, } input, err := os.ReadFile(exampleDBCFile) @@ -306,3 +334,45 @@ func TestCompile_ExampleDBC(t *testing.T) { } assert.DeepEqual(t, exampleDatabase, result.Database) } + +func TestCompile_Float64SignalWarningExpected(t *testing.T) { + finish := runTestInDir(t, "../..") + defer finish() + const exampleDBCFile = "testdata/dbc-invalid/example/example_float64_signal.dbc" + input, err := os.ReadFile(exampleDBCFile) + assert.NilError(t, err) + result, err := Compile(exampleDBCFile, input) + if err != nil { + t.Fatal(err) + } + // We expect one warning from unsupported float64 signal + assert.Equal(t, len(result.Warnings), 1) +} + +func TestCompile_Float32InvalidSignalNameWarningExpected(t *testing.T) { + finish := runTestInDir(t, "../..") + defer finish() + const exampleDBCFile = "testdata/dbc-invalid/example/example_float32_invalid_signal_name.dbc" + input, err := os.ReadFile(exampleDBCFile) + assert.NilError(t, err) + result, err := Compile(exampleDBCFile, input) + if err != nil { + t.Fatal(err) + } + // We expect one warning for incorrect signal name in SIGVAL_TYPE_ declaration + assert.Equal(t, len(result.Warnings), 1) +} + +func TestCompile_Float32InvalidSignalLengthWarningExpected(t *testing.T) { + finish := runTestInDir(t, "../..") + defer finish() + const exampleDBCFile = "testdata/dbc-invalid/example/example_float32_invalid_signal_length.dbc" + input, err := os.ReadFile(exampleDBCFile) + assert.NilError(t, err) + result, err := Compile(exampleDBCFile, input) + if err != nil { + t.Fatal(err) + } + // We expect one warning for incorrect signal length in declaration of float32 signal + assert.Equal(t, len(result.Warnings), 1) +} diff --git a/internal/generate/example_test.go b/internal/generate/example_test.go index b095ee0..c108416 100644 --- a/internal/generate/example_test.go +++ b/internal/generate/example_test.go @@ -60,6 +60,32 @@ func TestExampleDatabase_MarshalUnmarshal(t *testing.T) { Data: can.Data{0x00, 0xe0, 0x2e}, }, }, + + { + name: "IOFloat32_1", + m: examplecan.NewIOFloat32(). + SetFloat32ValueNoRange(3.14). + SetFloat32WithRange(42), + f: can.Frame{ + ID: 600, + Length: 8, + Data: can.Data{0xc3, 0xf5, 0x48, 0x40, 0x00, 0x00, 0x28, 0x42}, + }, + }, + + { + name: "IOFloat32_2", + m: examplecan.NewIOFloat32(). + SetFloat32ValueNoRange(42.42). + // This value is out of range, so we expect SaturatedCast for + // rightmost range border: 100 + SetFloat32WithRange(142), + f: can.Frame{ + ID: 600, + Length: 8, + Data: can.Data{0x14, 0xae, 0x29, 0x42, 0x00, 0x00, 0xc8, 0x42}, + }, + }, } { tt := tt t.Run(tt.name, func(t *testing.T) { diff --git a/internal/generate/file.go b/internal/generate/file.go index 3f9d300..3c1fb24 100644 --- a/internal/generate/file.go +++ b/internal/generate/file.go @@ -810,9 +810,12 @@ func hasPhysicalRepresentation(s *descriptor.Signal) bool { hasOffset := s.Offset != 0 hasRange := s.Min != 0 || s.Max != 0 var hasConstrainedRange bool - if s.IsSigned { + switch { + case s.IsFloat: + hasConstrainedRange = s.Min > s.MinFloat() || s.Max < s.MaxFloat() + case s.IsSigned: hasConstrainedRange = s.Min > float64(s.MinSigned()) || s.Max < float64(s.MaxSigned()) - } else { + default: hasConstrainedRange = s.Min > 0 || s.Max < float64(s.MaxUnsigned()) } return hasScale || hasOffset || hasRange && hasConstrainedRange @@ -841,6 +844,8 @@ func signalType(m *descriptor.Message, s *descriptor.Signal) string { func signalPrimitiveType(s *descriptor.Signal) types.Type { var t types.BasicKind switch { + case s.Length == 32 && s.IsFloat: + t = types.Float32 case s.Length == 1: t = types.Bool case s.Length <= 8 && s.IsSigned: @@ -866,6 +871,8 @@ func signalPrimitiveType(s *descriptor.Signal) types.Type { func signalPrimitiveSuperType(s *descriptor.Signal) types.Type { var t types.BasicKind switch { + case s.IsFloat: + t = types.Float64 case s.Length == 1: t = types.Bool case s.IsSigned: @@ -878,6 +885,8 @@ func signalPrimitiveSuperType(s *descriptor.Signal) types.Type { func signalSuperType(s *descriptor.Signal) string { switch { + case s.Length <= 32 && s.IsFloat: + return "Float" case s.Length == 1: return "Bool" case s.IsSigned: diff --git a/pkg/descriptor/signal.go b/pkg/descriptor/signal.go index fe0daf1..0473a39 100644 --- a/pkg/descriptor/signal.go +++ b/pkg/descriptor/signal.go @@ -2,6 +2,7 @@ package descriptor import ( "math" + "unsafe" "go.einride.tech/can" ) @@ -18,6 +19,8 @@ type Signal struct { IsBigEndian bool // IsSigned is true if the signal uses raw signed values. IsSigned bool + // IsFloat is true if the signal uses 32-bit floating point values + IsFloat bool // IsMultiplexer is true if the signal is the multiplexor of a multiplexed message. IsMultiplexer bool // IsMultiplexed is true if the signal is multiplexed. @@ -144,6 +147,17 @@ func (s *Signal) UnmarshalBool(d can.Data) bool { return d.Bit(s.Start) } +// UnmarshalFloat returns the float64 value of the signam in the provided CAN frame. +func (s *Signal) UnmarshalFloat(d can.Data) float64 { + var i uint64 + if s.IsBigEndian { + i = d.UnsignedBitsBigEndian(s.Start, s.Length) + } else { + i = d.UnsignedBitsLittleEndian(s.Start, s.Length) + } + return float64(*((*float32)(unsafe.Pointer(&i)))) +} + // MarshalUnsigned sets the unsigned value of the signal in the provided CAN frame. func (s *Signal) MarshalUnsigned(d *can.Data, value uint64) { if s.IsBigEndian { @@ -167,6 +181,13 @@ func (s *Signal) MarshalBool(d *can.Data, value bool) { d.SetBit(s.Start, value) } +// Marshalfloat sets the float64 value of the signal in the provided CAN frame. +func (s *Signal) MarshalFloat(d *can.Data, value float64) { + f := float32(value) + i := uint64(*((*uint32)(unsafe.Pointer(&f)))) + s.MarshalUnsigned(d, i) +} + // MaxUnsigned returns the maximum unsigned value representable by the signal. func (s *Signal) MaxUnsigned() uint64 { return (2 << (s.Length - 1)) - 1 @@ -182,6 +203,16 @@ func (s *Signal) MaxSigned() int64 { return (2 << (s.Length - 1) / 2) - 1 } +// MinSigned returns the minimum signed value representable by the signal. +func (s *Signal) MinFloat() float64 { + return -math.MaxFloat32 +} + +// MaxSigned returns the maximum signed value representable by the signal. +func (s *Signal) MaxFloat() float64 { + return math.MaxFloat32 +} + // SaturatedCastSigned performs a saturated cast of an int64 to the value domain of the signal. func (s *Signal) SaturatedCastSigned(value int64) int64 { min := s.MinSigned() @@ -204,3 +235,17 @@ func (s *Signal) SaturatedCastUnsigned(value uint64) uint64 { } return value } + +// SaturatedCastUnsigned performs a saturated cast of a uint64 to the value domain of the signal. +func (s *Signal) SaturatedCastFloat(value float64) float64 { + min := s.MinFloat() + max := s.MaxFloat() + switch { + case value < min: + return min + case value > max: + return max + default: + return value + } +} diff --git a/testdata/dbc-invalid/example/example_float32_invalid_signal_length.dbc b/testdata/dbc-invalid/example/example_float32_invalid_signal_length.dbc new file mode 100644 index 0000000..1168e70 --- /dev/null +++ b/testdata/dbc-invalid/example/example_float32_invalid_signal_length.dbc @@ -0,0 +1,12 @@ +VERSION "" + +NS_ : + +BS_: + +BU_: DBG IO + +BO_ 42 IOFloat32: 8 IO + SG_ Float32Signal : 0|16@1- (1,0) [0|0] "" DBG + +SIG_VALTYPE_ 42 Float32Signal: 1; diff --git a/testdata/dbc-invalid/example/example_float32_invalid_signal_name.dbc b/testdata/dbc-invalid/example/example_float32_invalid_signal_name.dbc new file mode 100644 index 0000000..1e7f89e --- /dev/null +++ b/testdata/dbc-invalid/example/example_float32_invalid_signal_name.dbc @@ -0,0 +1,12 @@ +VERSION "" + +NS_ : + +BS_: + +BU_: DBG IO + +BO_ 42 IOFloat32: 8 IO + SG_ Float32Signal : 0|32@1- (1,0) [0|0] "" DBG + +SIG_VALTYPE_ 42 SomeOtherSignal: 1; diff --git a/testdata/dbc-invalid/example/example_float64_signal.dbc b/testdata/dbc-invalid/example/example_float64_signal.dbc new file mode 100644 index 0000000..ba3f079 --- /dev/null +++ b/testdata/dbc-invalid/example/example_float64_signal.dbc @@ -0,0 +1,12 @@ +VERSION "" + +NS_ : + +BS_: + +BU_: DBG IO + +BO_ 42 IOFloat64: 8 IO + SG_ Float64Signal : 0|64@1- (1,0) [0|0] "" DBG + +SIG_VALTYPE_ 42 Float64Signal: 2; diff --git a/testdata/dbc/example/example.dbc b/testdata/dbc/example/example.dbc index 076c03f..6fc8e44 100644 --- a/testdata/dbc/example/example.dbc +++ b/testdata/dbc/example/example.dbc @@ -39,6 +39,10 @@ BO_ 500 IODebug: 6 IO SG_ TestBoolEnum : 32|1@1+ (1,0) [0|0] "" DBG SG_ TestScaledEnum : 40|2@1+ (2,0) [0|6] "" DBG +BO_ 600 IOFloat32: 8 IO + SG_ Float32ValueNoRange : 0|32@1- (1,0) [0|0] "" DBG + SG_ Float32WithRange : 32|32@1- (1,0) [-100|100] "" DBG + EV_ BrakeEngaged: 0 [0|1] "" 0 10 DUMMY_NODE_VECTOR0 Vector__XXX; EV_ Torque: 1 [0|30000] "mNm" 500 16 DUMMY_NODE_VECTOR0 Vector__XXX; @@ -77,3 +81,6 @@ VAL_ 100 Command 3 "Headlights On" 2 "Reboot" 1 "Sync" 0 "None" ; VAL_ 500 TestEnum 2 "Two" 1 "One" ; VAL_ 500 TestScaledEnum 3 "Six" 2 "Four" 1 "Two" 0 "Zero" ; VAL_ 500 TestBoolEnum 1 "One" 0 "Zero" ; + +SIG_VALTYPE_ 600 Float32ValueNoRange: 1; +SIG_VALTYPE_ 600 Float32WithRange: 1; diff --git a/testdata/dbc/example/example.dbc.golden b/testdata/dbc/example/example.dbc.golden index 99d5eee..f58524d 100644 --- a/testdata/dbc/example/example.dbc.golden +++ b/testdata/dbc/example/example.dbc.golden @@ -1,4 +1,4 @@ -([]dbc.Def) (len=44) { +([]dbc.Def) (len=47) { (*dbc.VersionDef)({ Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:1:1, Version: (string) "" @@ -484,8 +484,55 @@ } } }), - (*dbc.EnvironmentVariableDef)({ + (*dbc.MessageDef)({ Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:42:1, + MessageID: (dbc.MessageID) 600, + Name: (dbc.Identifier) (len=9) "IOFloat32", + Size: (uint64) 8, + Transmitter: (dbc.Identifier) (len=2) "IO", + Signals: ([]dbc.SignalDef) (len=2) { + (dbc.SignalDef) { + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:43:2, + Name: (dbc.Identifier) (len=19) "Float32ValueNoRange", + StartBit: (uint64) 0, + Size: (uint64) 32, + IsBigEndian: (bool) false, + IsSigned: (bool) true, + IsMultiplexerSwitch: (bool) false, + IsMultiplexed: (bool) false, + MultiplexerSwitch: (uint64) 0, + Offset: (float64) 0, + Factor: (float64) 1, + Minimum: (float64) 0, + Maximum: (float64) 0, + Unit: (string) "", + Receivers: ([]dbc.Identifier) (len=1) { + (dbc.Identifier) (len=3) "DBG" + } + }, + (dbc.SignalDef) { + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:44:2, + Name: (dbc.Identifier) (len=16) "Float32WithRange", + StartBit: (uint64) 32, + Size: (uint64) 32, + IsBigEndian: (bool) false, + IsSigned: (bool) true, + IsMultiplexerSwitch: (bool) false, + IsMultiplexed: (bool) false, + MultiplexerSwitch: (uint64) 0, + Offset: (float64) 0, + Factor: (float64) 1, + Minimum: (float64) -100, + Maximum: (float64) 100, + Unit: (string) "", + Receivers: ([]dbc.Identifier) (len=1) { + (dbc.Identifier) (len=3) "DBG" + } + } + } + }), + (*dbc.EnvironmentVariableDef)({ + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:46:1, Name: (dbc.Identifier) (len=12) "BrakeEngaged", Type: (dbc.EnvironmentVariableType) 0, Minimum: (float64) 0, @@ -499,7 +546,7 @@ } }), (*dbc.EnvironmentVariableDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:43:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:47:1, Name: (dbc.Identifier) (len=6) "Torque", Type: (dbc.EnvironmentVariableType) 1, Minimum: (float64) 0, @@ -513,7 +560,7 @@ } }), (*dbc.CommentDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:45:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:49:1, ObjectType: (dbc.ObjectType) (len=3) "EV_", NodeName: (dbc.Identifier) "", MessageID: (dbc.MessageID) 0, @@ -522,7 +569,7 @@ Comment: (string) (len=19) "Brake fully engaged" }), (*dbc.CommentDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:46:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:50:1, ObjectType: (dbc.ObjectType) (len=3) "BU_", NodeName: (dbc.Identifier) (len=6) "DRIVER", MessageID: (dbc.MessageID) 0, @@ -531,7 +578,7 @@ Comment: (string) (len=37) "The driver controller driving the car" }), (*dbc.CommentDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:47:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:51:1, ObjectType: (dbc.ObjectType) (len=3) "BU_", NodeName: (dbc.Identifier) (len=5) "MOTOR", MessageID: (dbc.MessageID) 0, @@ -540,7 +587,7 @@ Comment: (string) (len=31) "The motor controller of the car" }), (*dbc.CommentDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:48:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:52:1, ObjectType: (dbc.ObjectType) (len=3) "BU_", NodeName: (dbc.Identifier) (len=6) "SENSOR", MessageID: (dbc.MessageID) 0, @@ -549,7 +596,7 @@ Comment: (string) (len=32) "The sensor controller of the car" }), (*dbc.CommentDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:49:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:53:1, ObjectType: (dbc.ObjectType) (len=3) "BO_", NodeName: (dbc.Identifier) "", MessageID: (dbc.MessageID) 100, @@ -558,7 +605,7 @@ Comment: (string) (len=48) "Sync message used to synchronize the controllers" }), (*dbc.AttributeDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:51:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:55:1, ObjectType: (dbc.ObjectType) "", Name: (dbc.Identifier) (len=7) "BusType", Type: (dbc.AttributeValueType) (len=6) "STRING", @@ -569,7 +616,7 @@ EnumValues: ([]string) }), (*dbc.AttributeDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:52:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:56:1, ObjectType: (dbc.ObjectType) (len=3) "BO_", Name: (dbc.Identifier) (len=14) "GenMsgSendType", Type: (dbc.AttributeValueType) (len=4) "ENUM", @@ -584,7 +631,7 @@ } }), (*dbc.AttributeDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:53:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:57:1, ObjectType: (dbc.ObjectType) (len=3) "BO_", Name: (dbc.Identifier) (len=15) "GenMsgCycleTime", Type: (dbc.AttributeValueType) (len=3) "INT", @@ -595,7 +642,7 @@ EnumValues: ([]string) }), (*dbc.AttributeDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:54:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:58:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", Name: (dbc.Identifier) (len=9) "FieldType", Type: (dbc.AttributeValueType) (len=6) "STRING", @@ -606,7 +653,7 @@ EnumValues: ([]string) }), (*dbc.AttributeDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:55:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:59:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", Name: (dbc.Identifier) (len=16) "GenSigStartValue", Type: (dbc.AttributeValueType) (len=3) "INT", @@ -617,7 +664,7 @@ EnumValues: ([]string) }), (*dbc.AttributeDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:56:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:60:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", Name: (dbc.Identifier) (len=3) "SPN", Type: (dbc.AttributeValueType) (len=3) "INT", @@ -628,35 +675,35 @@ EnumValues: ([]string) }), (*dbc.AttributeDefaultValueDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:57:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:61:1, AttributeName: (dbc.Identifier) (len=7) "BusType", DefaultIntValue: (int64) 0, DefaultFloatValue: (float64) 0, DefaultStringValue: (string) (len=3) "CAN" }), (*dbc.AttributeDefaultValueDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:58:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:62:1, AttributeName: (dbc.Identifier) (len=9) "FieldType", DefaultIntValue: (int64) 0, DefaultFloatValue: (float64) 0, DefaultStringValue: (string) "" }), (*dbc.AttributeDefaultValueDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:59:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:63:1, AttributeName: (dbc.Identifier) (len=15) "GenMsgCycleTime", DefaultIntValue: (int64) 0, DefaultFloatValue: (float64) 0, DefaultStringValue: (string) "" }), (*dbc.AttributeDefaultValueDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:60:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:64:1, AttributeName: (dbc.Identifier) (len=16) "GenSigStartValue", DefaultIntValue: (int64) 0, DefaultFloatValue: (float64) 0, DefaultStringValue: (string) "" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:62:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:66:1, AttributeName: (dbc.Identifier) (len=14) "GenMsgSendType", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 1, @@ -668,7 +715,7 @@ StringValue: (string) (len=4) "None" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:63:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:67:1, AttributeName: (dbc.Identifier) (len=14) "GenMsgSendType", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 100, @@ -680,7 +727,7 @@ StringValue: (string) (len=6) "Cyclic" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:64:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:68:1, AttributeName: (dbc.Identifier) (len=15) "GenMsgCycleTime", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 100, @@ -692,7 +739,7 @@ StringValue: (string) "" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:65:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:69:1, AttributeName: (dbc.Identifier) (len=14) "GenMsgSendType", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 101, @@ -704,7 +751,7 @@ StringValue: (string) (len=6) "Cyclic" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:66:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:70:1, AttributeName: (dbc.Identifier) (len=15) "GenMsgCycleTime", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 101, @@ -716,7 +763,7 @@ StringValue: (string) "" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:67:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:71:1, AttributeName: (dbc.Identifier) (len=14) "GenMsgSendType", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 200, @@ -728,7 +775,7 @@ StringValue: (string) (len=6) "Cyclic" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:68:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:72:1, AttributeName: (dbc.Identifier) (len=15) "GenMsgCycleTime", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 200, @@ -740,7 +787,7 @@ StringValue: (string) "" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:69:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:73:1, AttributeName: (dbc.Identifier) (len=14) "GenMsgSendType", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 400, @@ -752,7 +799,7 @@ StringValue: (string) (len=6) "Cyclic" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:70:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:74:1, AttributeName: (dbc.Identifier) (len=15) "GenMsgCycleTime", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 400, @@ -764,7 +811,7 @@ StringValue: (string) "" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:71:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:75:1, AttributeName: (dbc.Identifier) (len=14) "GenMsgSendType", ObjectType: (dbc.ObjectType) (len=3) "BO_", MessageID: (dbc.MessageID) 500, @@ -776,7 +823,7 @@ StringValue: (string) (len=7) "OnEvent" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:72:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:76:1, AttributeName: (dbc.Identifier) (len=9) "FieldType", ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 100, @@ -788,7 +835,7 @@ StringValue: (string) (len=7) "Command" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:73:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:77:1, AttributeName: (dbc.Identifier) (len=9) "FieldType", ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 500, @@ -800,7 +847,7 @@ StringValue: (string) (len=8) "TestEnum" }), (*dbc.AttributeValueForObjectDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:74:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:78:1, AttributeName: (dbc.Identifier) (len=16) "GenSigStartValue", ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 500, @@ -812,99 +859,111 @@ StringValue: (string) "" }), (*dbc.ValueDescriptionsDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:76:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:80:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 100, SignalName: (dbc.Identifier) (len=7) "Command", EnvironmentVariableName: (dbc.Identifier) "", ValueDescriptions: ([]dbc.ValueDescriptionDef) (len=4) { (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:76:18, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:80:18, Value: (float64) 3, Description: (string) (len=13) "Headlights On" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:76:36, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:80:36, Value: (float64) 2, Description: (string) (len=6) "Reboot" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:76:47, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:80:47, Value: (float64) 1, Description: (string) (len=4) "Sync" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:76:56, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:80:56, Value: (float64) 0, Description: (string) (len=4) "None" } } }), (*dbc.ValueDescriptionsDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:77:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:81:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 500, SignalName: (dbc.Identifier) (len=8) "TestEnum", EnvironmentVariableName: (dbc.Identifier) "", ValueDescriptions: ([]dbc.ValueDescriptionDef) (len=2) { (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:77:19, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:81:19, Value: (float64) 2, Description: (string) (len=3) "Two" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:77:27, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:81:27, Value: (float64) 1, Description: (string) (len=3) "One" } } }), (*dbc.ValueDescriptionsDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:78:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:82:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 500, SignalName: (dbc.Identifier) (len=14) "TestScaledEnum", EnvironmentVariableName: (dbc.Identifier) "", ValueDescriptions: ([]dbc.ValueDescriptionDef) (len=4) { (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:78:25, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:82:25, Value: (float64) 3, Description: (string) (len=3) "Six" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:78:33, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:82:33, Value: (float64) 2, Description: (string) (len=4) "Four" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:78:42, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:82:42, Value: (float64) 1, Description: (string) (len=3) "Two" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:78:50, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:82:50, Value: (float64) 0, Description: (string) (len=4) "Zero" } } }), (*dbc.ValueDescriptionsDef)({ - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:79:1, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:83:1, ObjectType: (dbc.ObjectType) (len=3) "SG_", MessageID: (dbc.MessageID) 500, SignalName: (dbc.Identifier) (len=12) "TestBoolEnum", EnvironmentVariableName: (dbc.Identifier) "", ValueDescriptions: ([]dbc.ValueDescriptionDef) (len=2) { (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:79:23, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:83:23, Value: (float64) 1, Description: (string) (len=3) "One" }, (dbc.ValueDescriptionDef) { - Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:79:31, + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:83:31, Value: (float64) 0, Description: (string) (len=4) "Zero" } } + }), + (*dbc.SignalValueTypeDef)({ + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:85:1, + MessageID: (dbc.MessageID) 600, + SignalName: (dbc.Identifier) (len=19) "Float32ValueNoRange", + SignalValueType: (dbc.SignalValueType) 1 + }), + (*dbc.SignalValueTypeDef)({ + Pos: (scanner.Position) ../../testdata/dbc/example/example.dbc:86:1, + MessageID: (dbc.MessageID) 600, + SignalName: (dbc.Identifier) (len=16) "Float32WithRange", + SignalValueType: (dbc.SignalValueType) 1 }) } diff --git a/testdata/gen/go/example/example.dbc.go b/testdata/gen/go/example/example.dbc.go index d9e7642..787167d 100644 --- a/testdata/gen/go/example/example.dbc.go +++ b/testdata/gen/go/example/example.dbc.go @@ -982,6 +982,114 @@ func (m *IODebug) UnmarshalFrame(f can.Frame) error { return nil } +// IOFloat32Reader provides read access to a IOFloat32 message. +type IOFloat32Reader interface { + // Float32ValueNoRange returns the value of the Float32ValueNoRange signal. + Float32ValueNoRange() float32 + // Float32WithRange returns the physical value of the Float32WithRange signal. + Float32WithRange() float64 +} + +// IOFloat32Writer provides write access to a IOFloat32 message. +type IOFloat32Writer interface { + // CopyFrom copies all values from IOFloat32Reader. + CopyFrom(IOFloat32Reader) *IOFloat32 + // SetFloat32ValueNoRange sets the value of the Float32ValueNoRange signal. + SetFloat32ValueNoRange(float32) *IOFloat32 + // SetFloat32WithRange sets the physical value of the Float32WithRange signal. + SetFloat32WithRange(float64) *IOFloat32 +} + +type IOFloat32 struct { + xxx_Float32ValueNoRange float32 + xxx_Float32WithRange float32 +} + +func NewIOFloat32() *IOFloat32 { + m := &IOFloat32{} + m.Reset() + return m +} + +func (m *IOFloat32) Reset() { + m.xxx_Float32ValueNoRange = 0 + m.xxx_Float32WithRange = 0 +} + +func (m *IOFloat32) CopyFrom(o IOFloat32Reader) *IOFloat32 { + m.xxx_Float32ValueNoRange = o.Float32ValueNoRange() + m.SetFloat32WithRange(o.Float32WithRange()) + return m +} + +// Descriptor returns the IOFloat32 descriptor. +func (m *IOFloat32) Descriptor() *descriptor.Message { + return Messages().IOFloat32.Message +} + +// String returns a compact string representation of the message. +func (m *IOFloat32) String() string { + return cantext.MessageString(m) +} + +func (m *IOFloat32) Float32ValueNoRange() float32 { + return m.xxx_Float32ValueNoRange +} + +func (m *IOFloat32) SetFloat32ValueNoRange(v float32) *IOFloat32 { + m.xxx_Float32ValueNoRange = float32(Messages().IOFloat32.Float32ValueNoRange.SaturatedCastFloat(float64(v))) + return m +} + +func (m *IOFloat32) Float32WithRange() float64 { + return Messages().IOFloat32.Float32WithRange.ToPhysical(float64(m.xxx_Float32WithRange)) +} + +func (m *IOFloat32) SetFloat32WithRange(v float64) *IOFloat32 { + m.xxx_Float32WithRange = float32(Messages().IOFloat32.Float32WithRange.FromPhysical(v)) + return m +} + +// Frame returns a CAN frame representing the message. +func (m *IOFloat32) Frame() can.Frame { + md := Messages().IOFloat32 + f := can.Frame{ID: md.ID, IsExtended: md.IsExtended, Length: md.Length} + md.Float32ValueNoRange.MarshalFloat(&f.Data, float64(m.xxx_Float32ValueNoRange)) + md.Float32WithRange.MarshalFloat(&f.Data, float64(m.xxx_Float32WithRange)) + return f +} + +// MarshalFrame encodes the message as a CAN frame. +func (m *IOFloat32) MarshalFrame() (can.Frame, error) { + return m.Frame(), nil +} + +// UnmarshalFrame decodes the message from a CAN frame. +func (m *IOFloat32) UnmarshalFrame(f can.Frame) error { + md := Messages().IOFloat32 + switch { + case f.ID != md.ID: + return fmt.Errorf( + "unmarshal IOFloat32: expects ID 600 (got %s with ID %d)", f.String(), f.ID, + ) + case f.Length != md.Length: + return fmt.Errorf( + "unmarshal IOFloat32: expects length 8 (got %s with length %d)", f.String(), f.Length, + ) + case f.IsRemote: + return fmt.Errorf( + "unmarshal IOFloat32: expects non-remote frame (got remote frame %s)", f.String(), + ) + case f.IsExtended != md.IsExtended: + return fmt.Errorf( + "unmarshal IOFloat32: expects standard ID (got %s with extended ID)", f.String(), + ) + } + m.xxx_Float32ValueNoRange = float32(md.Float32ValueNoRange.UnmarshalFloat(f.Data)) + m.xxx_Float32WithRange = float32(md.Float32WithRange.UnmarshalFloat(f.Data)) + return nil +} + type DBG interface { sync.Locker Tx() DBG_Tx @@ -993,6 +1101,7 @@ type DBG_Rx interface { http.Handler // for debugging SensorSonars() DBG_Rx_SensorSonars IODebug() DBG_Rx_IODebug + IOFloat32() DBG_Rx_IOFloat32 } type DBG_Tx interface { @@ -1011,6 +1120,12 @@ type DBG_Rx_IODebug interface { SetAfterReceiveHook(h func(context.Context) error) } +type DBG_Rx_IOFloat32 interface { + IOFloat32Reader + ReceiveTime() time.Time + SetAfterReceiveHook(h func(context.Context) error) +} + type xxx_DBG struct { sync.Mutex // protects all node state network string @@ -1030,6 +1145,8 @@ func NewDBG(network, address string) DBG { n.rx.xxx_SensorSonars.Reset() n.rx.xxx_IODebug.init() n.rx.xxx_IODebug.Reset() + n.rx.xxx_IOFloat32.init() + n.rx.xxx_IOFloat32.Reset() return n } @@ -1049,6 +1166,7 @@ type xxx_DBG_Rx struct { parentMutex *sync.Mutex xxx_SensorSonars xxx_DBG_Rx_SensorSonars xxx_IODebug xxx_DBG_Rx_IODebug + xxx_IOFloat32 xxx_DBG_Rx_IOFloat32 } var _ DBG_Rx = &xxx_DBG_Rx{} @@ -1059,6 +1177,7 @@ func (rx *xxx_DBG_Rx) ServeHTTP(w http.ResponseWriter, r *http.Request) { candebug.ServeMessagesHTTP(w, r, []generated.Message{ &rx.xxx_SensorSonars, &rx.xxx_IODebug, + &rx.xxx_IOFloat32, }) } @@ -1070,6 +1189,10 @@ func (rx *xxx_DBG_Rx) IODebug() DBG_Rx_IODebug { return &rx.xxx_IODebug } +func (rx *xxx_DBG_Rx) IOFloat32() DBG_Rx_IOFloat32 { + return &rx.xxx_IOFloat32 +} + type xxx_DBG_Tx struct { parentMutex *sync.Mutex } @@ -1096,6 +1219,8 @@ func (n *xxx_DBG) ReceivedMessage(id uint32) (canrunner.ReceivedMessage, bool) { return &n.rx.xxx_SensorSonars, true case 500: return &n.rx.xxx_IODebug, true + case 600: + return &n.rx.xxx_IOFloat32, true default: return nil, false } @@ -1161,6 +1286,34 @@ func (m *xxx_DBG_Rx_IODebug) SetReceiveTime(t time.Time) { var _ canrunner.ReceivedMessage = &xxx_DBG_Rx_IODebug{} +type xxx_DBG_Rx_IOFloat32 struct { + IOFloat32 + receiveTime time.Time + afterReceiveHook func(context.Context) error +} + +func (m *xxx_DBG_Rx_IOFloat32) init() { + m.afterReceiveHook = func(context.Context) error { return nil } +} + +func (m *xxx_DBG_Rx_IOFloat32) SetAfterReceiveHook(h func(context.Context) error) { + m.afterReceiveHook = h +} + +func (m *xxx_DBG_Rx_IOFloat32) AfterReceiveHook() func(context.Context) error { + return m.afterReceiveHook +} + +func (m *xxx_DBG_Rx_IOFloat32) ReceiveTime() time.Time { + return m.receiveTime +} + +func (m *xxx_DBG_Rx_IOFloat32) SetReceiveTime(t time.Time) { + m.receiveTime = t +} + +var _ canrunner.ReceivedMessage = &xxx_DBG_Rx_IOFloat32{} + type DRIVER interface { sync.Locker Tx() DRIVER_Tx @@ -2298,6 +2451,7 @@ type MessagesDescriptor struct { SensorSonars *SensorSonarsDescriptor MotorStatus *MotorStatusDescriptor IODebug *IODebugDescriptor + IOFloat32 *IOFloat32Descriptor } // UnmarshalFrame unmarshals the provided example CAN frame. @@ -2339,6 +2493,12 @@ func (md *MessagesDescriptor) UnmarshalFrame(f can.Frame) (generated.Message, er return nil, fmt.Errorf("unmarshal example frame: %w", err) } return &msg, nil + case md.IOFloat32.ID: + var msg IOFloat32 + if err := msg.UnmarshalFrame(f); err != nil { + return nil, fmt.Errorf("unmarshal example frame: %w", err) + } + return &msg, nil default: return nil, fmt.Errorf("unmarshal example frame: ID not in database: %d", f.ID) } @@ -2389,6 +2549,12 @@ type IODebugDescriptor struct { TestScaledEnum *descriptor.Signal } +type IOFloat32Descriptor struct { + *descriptor.Message + Float32ValueNoRange *descriptor.Signal + Float32WithRange *descriptor.Signal +} + // Database returns the example database descriptor. func (md *MessagesDescriptor) Database() *descriptor.Database { return d @@ -2442,6 +2608,11 @@ var md = &MessagesDescriptor{ TestBoolEnum: d.Messages[5].Signals[4], TestScaledEnum: d.Messages[5].Signals[5], }, + IOFloat32: &IOFloat32Descriptor{ + Message: d.Messages[6], + Float32ValueNoRange: d.Messages[6].Signals[0], + Float32WithRange: d.Messages[6].Signals[1], + }, } var d = (*descriptor.Database)(&descriptor.Database{ @@ -2474,6 +2645,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(8), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2526,6 +2698,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(4), IsBigEndian: (bool)(false), IsSigned: (bool)(true), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2547,6 +2720,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(4), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2581,6 +2755,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(4), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(true), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2603,6 +2778,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2625,6 +2801,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(0), @@ -2647,6 +2824,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(1), @@ -2668,6 +2846,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(0), @@ -2690,6 +2869,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(1), @@ -2711,6 +2891,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(0), @@ -2733,6 +2914,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(1), @@ -2754,6 +2936,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(0), @@ -2776,6 +2959,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(12), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(true), MultiplexerValue: (uint)(1), @@ -2810,6 +2994,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(1), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2832,6 +3017,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(16), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2867,6 +3053,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(8), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2888,6 +3075,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(6), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2918,6 +3106,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(8), IsBigEndian: (bool)(false), IsSigned: (bool)(true), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2939,6 +3128,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(8), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2960,6 +3150,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(1), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -2990,6 +3181,7 @@ var d = (*descriptor.Database)(&descriptor.Database{ Length: (uint8)(2), IsBigEndian: (bool)(false), IsSigned: (bool)(false), + IsFloat: (bool)(false), IsMultiplexer: (bool)(false), IsMultiplexed: (bool)(false), MultiplexerValue: (uint)(0), @@ -3027,6 +3219,63 @@ var d = (*descriptor.Database)(&descriptor.Database{ CycleTime: (time.Duration)(0), DelayTime: (time.Duration)(0), }), + (*descriptor.Message)(&descriptor.Message{ + Name: (string)("IOFloat32"), + ID: (uint32)(600), + IsExtended: (bool)(false), + Length: (uint8)(8), + SendType: (descriptor.SendType)(0), + Description: (string)(""), + Signals: ([]*descriptor.Signal)([]*descriptor.Signal{ + (*descriptor.Signal)(&descriptor.Signal{ + Name: (string)("Float32ValueNoRange"), + Start: (uint8)(0), + Length: (uint8)(32), + IsBigEndian: (bool)(false), + IsSigned: (bool)(true), + IsFloat: (bool)(true), + IsMultiplexer: (bool)(false), + IsMultiplexed: (bool)(false), + MultiplexerValue: (uint)(0), + Offset: (float64)(0), + Scale: (float64)(1), + Min: (float64)(0), + Max: (float64)(0), + Unit: (string)(""), + Description: (string)(""), + ValueDescriptions: ([]*descriptor.ValueDescription)(nil), + ReceiverNodes: ([]string)([]string{ + (string)("DBG"), + }), + DefaultValue: (int)(0), + }), + (*descriptor.Signal)(&descriptor.Signal{ + Name: (string)("Float32WithRange"), + Start: (uint8)(32), + Length: (uint8)(32), + IsBigEndian: (bool)(false), + IsSigned: (bool)(true), + IsFloat: (bool)(true), + IsMultiplexer: (bool)(false), + IsMultiplexed: (bool)(false), + MultiplexerValue: (uint)(0), + Offset: (float64)(0), + Scale: (float64)(1), + Min: (float64)(-100), + Max: (float64)(100), + Unit: (string)(""), + Description: (string)(""), + ValueDescriptions: ([]*descriptor.ValueDescription)(nil), + ReceiverNodes: ([]string)([]string{ + (string)("DBG"), + }), + DefaultValue: (int)(0), + }), + }), + SenderNode: (string)("IO"), + CycleTime: (time.Duration)(0), + DelayTime: (time.Duration)(0), + }), }), Nodes: ([]*descriptor.Node)([]*descriptor.Node{ (*descriptor.Node)(&descriptor.Node{