Skip to content

Commit

Permalink
Add TechnicLargeAngularMotor (Grey) (#108)
Browse files Browse the repository at this point in the history
- Add TechnicLargeAngularMotor
- Updated README

#75 non-breaking
  • Loading branch information
tthiery committed Oct 15, 2020
1 parent e26467c commit 9bb4714
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ DI Container Elements
- [X] Train Motor (88011)
- [X] Technic Large Motor (88013)
- [X] Technic XLarge Motor (88014)
- [ ] Technic Angular Motor (depend on availability of hardware / contributions)
- [ ] Technic Medium Angular Motor (Spike)
- [ ] Technic Medium Angular Motor (Grey)
- [ ] Technic Large Angular Motor (Spike)
- [X] Technic Large Angular Motor (Grey)
- .. other devices depend on availability of hardware / contributions
- Protocol
- [X] Message Encoding (98% [spec coverage](docs/specification/coverage.md))
Expand Down
2 changes: 2 additions & 0 deletions src/SharpBrick.PoweredUp/Devices/DeviceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public Type GetTypeFromDeviceType(DeviceType deviceType)
DeviceType.SystemTrainMotor => typeof(SystemTrainMotor),
DeviceType.TechnicLargeLinearMotor => typeof(TechnicLargeLinearMotor),
DeviceType.TechnicXLargeLinearMotor => typeof(TechnicXLargeLinearMotor),
DeviceType.TechnicLargeAngularMotorGrey => typeof(TechnicLargeAngularMotorGrey),
DeviceType.TechnicMediumHubGestureSensor => typeof(TechnicMediumHubGestureSensor),
DeviceType.TechnicMediumHubAccelerometer => typeof(TechnicMediumHubAccelerometer),
DeviceType.TechnicMediumHubGyroSensor => typeof(TechnicMediumHubGyroSensor),
Expand All @@ -54,6 +55,7 @@ public static DeviceType GetDeviceTypeFromType(Type type)
nameof(SystemTrainMotor) => DeviceType.SystemTrainMotor,
nameof(TechnicLargeLinearMotor) => DeviceType.TechnicLargeLinearMotor,
nameof(TechnicXLargeLinearMotor) => DeviceType.TechnicXLargeLinearMotor,
nameof(TechnicLargeAngularMotorGrey) => DeviceType.TechnicLargeAngularMotorGrey,
nameof(TechnicMediumHubGestureSensor) => DeviceType.TechnicMediumHubGestureSensor,
nameof(TechnicMediumHubAccelerometer) => DeviceType.TechnicMediumHubAccelerometer,
nameof(TechnicMediumHubGyroSensor) => DeviceType.TechnicMediumHubGyroSensor,
Expand Down
66 changes: 66 additions & 0 deletions src/SharpBrick.PoweredUp/Devices/TechnicLargeAngularMotorGrey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SharpBrick.PoweredUp.Protocol;
using SharpBrick.PoweredUp.Utils;

namespace SharpBrick.PoweredUp
{
public class TechnicLargeAngularMotorGrey : AbsoluteMotor, IPoweredUpDevice
{
public TechnicLargeAngularMotorGrey()
: base()
{ }
public TechnicLargeAngularMotorGrey(ILegoWirelessProtocol protocol, byte hubId, byte portId)
: base(protocol, hubId, portId)
{ }

public IEnumerable<byte[]> GetStaticPortInfoMessages(Version softwareVersion, Version hardwareVersion, SystemType systemType)
=> @"
0B-00-43-00-01-0F-06-0E-00-0F-00
07-00-43-00-02-0E-00
11-00-44-00-00-00-50-4F-57-45-52-00-00-00-00-00-00
0E-00-44-00-00-01-00-00-C8-C2-00-00-C8-42
0E-00-44-00-00-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-00-03-00-00-C8-C2-00-00-C8-42
0A-00-44-00-00-04-50-43-54-00
08-00-44-00-00-05-00-50
0A-00-44-00-00-80-01-00-04-00
11-00-44-00-01-00-53-50-45-45-44-00-00-00-00-00-00
0E-00-44-00-01-01-00-00-C8-C2-00-00-C8-42
0E-00-44-00-01-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-01-03-00-00-C8-C2-00-00-C8-42
0A-00-44-00-01-04-50-43-54-00
08-00-44-00-01-05-30-70
0A-00-44-00-01-80-01-00-04-00
11-00-44-00-02-00-50-4F-53-00-00-00-00-00-00-00-00
0E-00-44-00-02-01-00-00-B4-C3-00-00-B4-43
0E-00-44-00-02-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-02-03-00-00-B4-C3-00-00-B4-43
0A-00-44-00-02-04-44-45-47-00
08-00-44-00-02-05-28-68
0A-00-44-00-02-80-01-02-0B-00
11-00-44-00-03-00-41-50-4F-53-00-00-00-00-00-00-00
0E-00-44-00-03-01-00-00-34-C3-00-00-33-43
0E-00-44-00-03-02-00-00-48-C3-00-00-48-43
0E-00-44-00-03-03-00-00-34-C3-00-00-33-43
0A-00-44-00-03-04-44-45-47-00
08-00-44-00-03-05-32-72
0A-00-44-00-03-80-01-01-03-00
11-00-44-00-04-00-43-41-4C-49-42-00-00-00-00-00-00
0E-00-44-00-04-01-00-00-00-00-00-00-61-45
0E-00-44-00-04-02-00-00-00-00-00-00-C8-42
0E-00-44-00-04-03-00-00-00-00-00-00-61-45
0A-00-44-00-04-04-43-41-4C-00
08-00-44-00-04-05-00-00
0A-00-44-00-04-80-02-01-05-00
11-00-44-00-05-00-53-54-41-54-53-00-00-00-00-00-00
0E-00-44-00-05-01-00-00-00-00-00-FF-7F-47
0E-00-44-00-05-02-00-00-00-00-00-00-C8-42
0E-00-44-00-05-03-00-00-00-00-00-FF-7F-47
0A-00-44-00-05-04-4D-49-4E-00
08-00-44-00-05-05-00-00
0A-00-44-00-05-80-0E-01-05-00
".Trim().Split("\n").Select(s => BytesStringUtil.StringToData(s));
}
}
2 changes: 2 additions & 0 deletions src/SharpBrick.PoweredUp/Enums/DeviceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ public enum DeviceType : ushort
TechnicColorSensor = 0x003D, // UNSPECED, TECHNIC_COLOR_SENSOR (Spike Prime)
TechnicDistanceSensor = 0x003E, // UNSPECED, TECHNIC_DISTANCE_SENSOR (Spike Prime)
TechnicForceSensor = 0x003F, // UNSPECED, TECHNIC_FORCE_SENSOR (Spike Prime)
TechnicMediumAngularMotorGrey = 0x004B, // UNSPECED, TECHNIC_MEDIUM_ANGULAR_MOTOR_GREY (Control+)
TechnicLargeAngularMotorGrey = 0x004C, // UNSPECED, TECHNIC_LARGE_ANGULAR_MOTOR_GREY (Control+)
}
}

0 comments on commit 9bb4714

Please sign in to comment.