sharpbrick / powered-up

.NET implementation of the LEGO PoweredUp Protocol
MIT License
100 stars 19 forks source link

Add Color&Distance Sensor (#88007) as a Device #103

Closed corneliusmunz closed 3 years ago

highstreeto commented 3 years ago

I got this part this week and started implementing this (I will open up a draft PR later). I got most of the modes to work, but some are a bit weird (especially Calibration and Debug).

For reference here is the port info:

- Port: 0x01 / 1
    - IOTypeId: VisionSensor / 0x0025 / 37
      Revision: SW: 1.0.0.0, HW: 1.0.0.0
      Capabilities: Output Input LogicalCombinable  
      ModeCombinations: [0000000001001111]
    - Mode 0: Name: COLOR, Symbol: IDX, Capability: Input
      - DataSet: 1x SByte, TotalFigures: 3, Decimals: 0
        Input Mapping: SupportsNull SupportFunctionalMapping20 Discrete
        Raw Min:       0, Max:      10
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:      10 (pass-through)
    - Mode 1: Name: PROX, Symbol: DIS, Capability: Input
      - DataSet: 1x SByte, TotalFigures: 3, Decimals: 0
        Input Mapping: SupportFunctionalMapping20 Absolute
        Raw Min:       0, Max:      10
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:      10 (pass-through)
    - Mode 2: Name: COUNT, Symbol: CNT, Capability: Input
      - DataSet: 1x Int32, TotalFigures: 4, Decimals: 0
        Input Mapping: Relative
        Raw Min:       0, Max:     100
        Pct Min:       0, Max:     100 (pass-through)
        SI  Min:       0, Max:     100 (pass-through)
    - Mode 3: Name: REFLT, Symbol: PCT, Capability: Input
      - DataSet: 1x SByte, TotalFigures: 3, Decimals: 0
        Input Mapping: Absolute
        Raw Min:       0, Max:     100
        Pct Min:       0, Max:     100 (pass-through)
        SI  Min:       0, Max:     100 (pass-through)
    - Mode 4: Name: AMBI, Symbol: PCT, Capability: Input
      - DataSet: 1x SByte, TotalFigures: 3, Decimals: 0
        Input Mapping: Absolute
        Raw Min:       0, Max:     100
        Pct Min:       0, Max:     100 (pass-through)
        SI  Min:       0, Max:     100 (pass-through)
    - Mode 5: Name: COL O, Symbol: IDX, Capability: Output
      - DataSet: 1x SByte, TotalFigures: 3, Decimals: 0
        Output Mapping: Discrete
        Raw Min:       0, Max:      10
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:      10 (pass-through)
    - Mode 6: Name: RGB I, Symbol: RAW, Capability: Input
      - DataSet: 3x Int16, TotalFigures: 5, Decimals: 0
        Input Mapping: Absolute
        Raw Min:       0, Max:    1023
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:    1023 (pass-through)
    - Mode 7: Name: IR Tx, Symbol: N/A, Capability: Output
      - DataSet: 1x Int16, TotalFigures: 5, Decimals: 0
        Output Mapping: Discrete
        Raw Min:       0, Max:   65535
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:   65535 (pass-through)
    - Mode 8: Name: SPEC 1, Symbol: N/A, Capability:
      - DataSet: 4x SByte, TotalFigures: 3, Decimals: 0
        Raw Min:       0, Max:     255
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:     255 (pass-through)
    - Mode 9: Name: DEBUG, Symbol: N/A, Capability: Input
      - DataSet: 2x Int16, TotalFigures: 5, Decimals: 0
        Input Mapping: Absolute
        Raw Min:       0, Max:    1023
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:      10 (scaling)
    - Mode 10: Name: CALIB, Symbol: N/A, Capability: Input
      - DataSet: 8x Int16, TotalFigures: 5, Decimals: 0
        Input Mapping: Absolute
        Raw Min:       0, Max:   65535
        Pct Min:       0, Max:     100 (scaling)
        SI  Min:       0, Max:   65535 (pass-through)
tthiery commented 3 years ago

@highstreeto can you also update sharpbrick/docs?

highstreeto commented 3 years ago

@highstreeto can you also update sharpbrick/docs?

Will do, not sure what all the modes do, but I will add what I know