Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TwoPortHub (88009) #39

Closed
1 of 2 tasks
tthiery opened this issue Jul 4, 2020 · 10 comments · Fixed by #97
Closed
1 of 2 tasks

Add TwoPortHub (88009) #39

tthiery opened this issue Jul 4, 2020 · 10 comments · Fixed by #97
Assignees
Labels
area-hubs blocked-hardware-availability enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tthiery
Copy link
Member

tthiery commented Jul 4, 2020

  • Rename existing SharpBrick.PoweredUp.Hub into BaseHub
  • Add TwoPortHub (88009) like TechnicMediumHub

Note: Note to everyone: I do not have the hardware and have in the foreseeable future no interest in purchasing them. If you want support for this hardware in this library, please contribute. I will guide you through the process and assist with everything needed.

@tthiery tthiery added enhancement New feature or request good first issue Good for newcomers area-hubs labels Jul 4, 2020
@tthiery tthiery added this to the v2.0 milestone Jul 4, 2020
@tthiery tthiery changed the title Add Hub (88009) Add PoweredUpHub (88009) Jul 4, 2020
@tthiery tthiery changed the title Add PoweredUpHub (88009) Add TwoPortHub (88009) Jul 4, 2020
@tthiery tthiery modified the milestones: v2.0, v2.1 Jul 10, 2020
@tthiery tthiery modified the milestones: v2.1, v2.2 Jul 28, 2020
@tthiery
Copy link
Member Author

tthiery commented Aug 12, 2020

Two methods how to do this:

  1. Someone with the hardware is developing the missing hub and internal devices implementation.
  2. A contributor with hardware is running the poweredup device list cli call and afterwards per listed port poweredup device dump-static-port -p <portId>. The information is then provided here in this ticket. This allows someone else to do the coding. Once completed, the contributor with the hardware can then run the examples to ensure it will still work.

@corneliusmunz
Copy link
Contributor

Hi @tthiery ! Congrats... super structured library. I have two train hubs (2-port hubs), two remote hubs and a boost hub and maybe i can support you with the outputs of your CLI. If it is ok, i will open a new issue for the Boost Hub and PoweredUp Remote to not mix it up to much.

Cheers, Cornelius

Here the logs

Two Port Hub (Train Hub)

poweredup device list
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: Hub (with address 158897331926694)
1
Selected Hub with key 1
Discover Ports. Receiving Messages ...
.................................................
Discover Ports Function: 48 / 48
Hub: 0
  Port: 50
    IOTypeId: RgbLight
    HardwareRevision: 1.0.0.0
    SoftwareRevision: 1.0.0.0
    OutputCapability: True
    InputCapability: False
    LogicalCombinableCapability: False
    LogicalSynchronizableCapability: False
    ModeCombinations: []
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: COL O
      IsInput: False
      IsOutput: True
      RawMin: 0
      RawMax: 10
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 10
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: True
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: True
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: RGB O
      IsInput: False
      IsOutput: True
      RawMin: 0
      RawMax: 255
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 255
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 3
      DatasetType: SByte
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 59
    IOTypeId: Current
    HardwareRevision: 0.0.0.2
    SoftwareRevision: 0.0.0.2
    OutputCapability: False
    InputCapability: True
    LogicalCombinableCapability: False
    LogicalSynchronizableCapability: False
    ModeCombinations: []
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: CUR L
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 4095
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 2444
      Symbol: mA
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: CUR S
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 4095
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 2444
      Symbol: mA
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 60
    IOTypeId: Voltage
    HardwareRevision: 0.0.0.2
    SoftwareRevision: 0.0.0.2
    OutputCapability: False
    InputCapability: True
    LogicalCombinableCapability: False
    LogicalSynchronizableCapability: False
    ModeCombinations: []
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: VLT L
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 3893
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 9600
      Symbol: mV
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: VLT S
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 3893
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 9600
      Symbol: mV
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
poweredup device dump-static-port -p 50
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: Hub (with address 158897331926694)
1
Selected Hub with key 1
Discover Port 50. Receiving Messages ...
.................
Discover Ports Function: 16 / 16
##################################################
0B-00-43-32-01-01-02-00-00-03-00
05-00-43-32-02
12-00-44-32-00-00-43-4F-4C-20-4F-00-00-00-00-00-00-00
0E-00-44-32-00-01-00-00-00-00-00-00-20-41
0E-00-44-32-00-02-00-00-00-00-00-00-C8-42
0E-00-44-32-00-03-00-00-00-00-00-00-20-41
0B-00-44-32-00-04-00-00-00-00-00
08-00-44-32-00-05-00-44
0A-00-44-32-00-80-01-00-01-00
12-00-44-32-01-00-52-47-42-20-4F-00-00-00-00-00-00-00
0E-00-44-32-01-01-00-00-00-00-00-00-7F-43
0E-00-44-32-01-02-00-00-00-00-00-00-C8-42
0E-00-44-32-01-03-00-00-00-00-00-00-7F-43
0B-00-44-32-01-04-00-00-00-00-00
08-00-44-32-01-05-00-10
0A-00-44-32-01-80-03-00-03-00
##################################################
poweredup device dump-static-port -p 59
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: Hub (with address 158897331926694)
1
Selected Hub with key 1
Discover Port 59. Receiving Messages ...
.................
Discover Ports Function: 16 / 16
##################################################
0B-00-43-3B-01-02-02-03-00-00-00
05-00-43-3B-02
12-00-44-3B-00-00-43-55-52-20-4C-00-00-00-00-00-00-00
0E-00-44-3B-00-01-00-00-00-00-00-F0-7F-45
0E-00-44-3B-00-02-00-00-00-00-00-00-C8-42
0E-00-44-3B-00-03-00-00-00-00-00-C0-18-45
0B-00-44-3B-00-04-6D-41-00-00-00
08-00-44-3B-00-05-10-00
0A-00-44-3B-00-80-01-01-04-00
12-00-44-3B-01-00-43-55-52-20-53-00-00-00-00-00-00-00
0E-00-44-3B-01-01-00-00-00-00-00-F0-7F-45
0E-00-44-3B-01-02-00-00-00-00-00-00-C8-42
0E-00-44-3B-01-03-00-00-00-00-00-C0-18-45
0B-00-44-3B-01-04-6D-41-00-00-00
08-00-44-3B-01-05-10-00
0A-00-44-3B-01-80-01-01-04-00
##################################################
poweredup device dump-static-port -p 60
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: Hub (with address 158897331926694)
1
Selected Hub with key 1
Discover Port 60. Receiving Messages ...
.................
Discover Ports Function: 16 / 16
##################################################
0B-00-43-3C-01-02-02-03-00-00-00
05-00-43-3C-02
12-00-44-3C-00-00-56-4C-54-20-4C-00-00-00-00-00-00-00
0E-00-44-3C-00-01-00-00-00-00-00-50-73-45
0E-00-44-3C-00-02-00-00-00-00-00-00-C8-42
0E-00-44-3C-00-03-00-00-00-00-00-00-16-46
0B-00-44-3C-00-04-6D-56-00-00-00
08-00-44-3C-00-05-10-00
0A-00-44-3C-00-80-01-01-04-00
12-00-44-3C-01-00-56-4C-54-20-53-00-00-00-00-00-00-00
0E-00-44-3C-01-01-00-00-00-00-00-50-73-45
0E-00-44-3C-01-02-00-00-00-00-00-00-C8-42
0E-00-44-3C-01-03-00-00-00-00-00-00-16-46
0B-00-44-3C-01-04-6D-56-00-00-00
08-00-44-3C-01-05-10-00
0A-00-44-3C-01-80-01-01-04-00
##################################################

@tthiery
Copy link
Member Author

tthiery commented Oct 4, 2020

What is up today? First Mario now TwoPortHub 😁

Yes, do exactly like that. Add a new issue for the remote and the boost hub.

@corneliusmunz
Copy link
Contributor

Maybe a rainy Sunday 😉

tthiery added a commit that referenced this issue Oct 4, 2020
#39 non-breaking
@tthiery tthiery mentioned this issue Oct 4, 2020
@tthiery
Copy link
Member Author

tthiery commented Oct 4, 2020

Just finished half of Mario today. Added TwoPortHub in a new pull request (#97). The implementation should already work for port A and B .. however, with technic devices I guess ;).

Missing

  • Voltage and Current have different values then for TechnicMediumHub / MarioHub. However, it is the same device type 0x14 / Voltage with now different static port info. Need to add some design. Too late for that 😀
  • Any LEGO System device (motors etc) you can drop me the information of above (dynamic devices should work).

Let me finish the Voltage situation and then we can perform a test run if you like.

@tthiery tthiery added the help wanted Extra attention is needed label Oct 4, 2020
tthiery added a commit that referenced this issue Oct 5, 2020
@tthiery
Copy link
Member Author

tthiery commented Oct 5, 2020

Fixed the Voltage thing. The static port information messages in the code are now selected by the system type.

Test Script

  • Check Voltage and Current examples
  • Check RgbColor example
  • If you have a technic motor, modify and check a motor example

@tthiery
Copy link
Member Author

tthiery commented Oct 11, 2020

@corneliusmunz Have you had a chance to check this? Or are you similar stuck as with the MoveHub?

@corneliusmunz
Copy link
Contributor

@tthiery Unfortunately today there was no rain 😉 But i was able to modify the RgbColor example (change hub type) and it works. If i find time i will connect a technic motor and maybe a train motor (Basic Motor) But for that i have to implement a concrete basic motor class. I will give you feedback as soon as possible

@corneliusmunz
Copy link
Contributor

@tthiery I have tested it with the adapted ExampleMotorControl and a TechnicLargeLinearMotor. Additionally i have done the test with the adapted ExampleVoltage. Both examples works as expected 👍 I also tried to implement a Device Class for the MediumLinearMotor (which is called in the DeviceType enum ExternalMotorWithTacho) but this was not successfull. But This is despite the Hub Implementation. I will try to experiment a littlebit more with that additional Device and send you a PR when it will work.

Output of the ExampleVoltage

info: Example[0]
      Finding Service
info: Example[0]
      Press RETURN to cancel Scanning
info: SharpBrick.PoweredUp.PoweredUpHost[0]
      Discovered log of type TwoPortHub with name 'myTrainHub' on Bluetooth Address '158897331706239'
info: Example[0]
      Connecting to Hub
info: Example[0]
      myTrainHub
info: Example[0]
      LegoSystem_TwoPortHub
info: Example[0]
      Press RETURN to continue to the action

warn: Example[0]
      Voltage L: 7210mV (75%)

So in my point of view, you can merge this into master.

Cheers, Cornelius

@tthiery
Copy link
Member Author

tthiery commented Oct 11, 2020

Awesome. Thanks a lot for your help!!!

tthiery added a commit that referenced this issue Oct 11, 2020
tthiery added a commit that referenced this issue Oct 11, 2020
- Add TwoPortHub
- Add Static Port Information for TwoPortHub
- Add TwoPortHub to README and Thanks

#39 non-breaking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-hubs blocked-hardware-availability enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants