Lego icon indicating copy to clipboard operation
Lego copied to clipboard

SetCombinedInputMode does not work

Open a333klm opened this issue 4 years ago • 2 comments

awesome work 👍

primaryBoom.SetSingleInputMode(Motor.INPUT_MODE__SPEED); works. primaryBoom.Speed is updated. However, speed and position are not updated when SetCombinedInputMode(0) is called.

I think there is an issue. The Lego BLE docs say, that the message for setting the device to combined input mode is 5 or 7 byte long. However, when I print the message, it is 9 bytes long. Maybe that helps. link to ble docs

This is the message Body of the set combined input message: 0x00 Port ID 0x01 Subcommand SetModeDataSet 0x00 CombinationIndex 0x10 ? 0x20 ? 0x30 ?

a333klm avatar Dec 21 '20 07:12 a333klm

@Vouzamo Found the problem. As explained here: bricknil and here lego ble docs it is necessary to send an unlock message, too.

Maybe, it is enough to insert SendMessage(new PortInputFormatSetupCombinedMessage(Port, PortInputFormatSetupSubCommands.Unlock_And_Start_With_Multi_Update_Enabled)); after this line https://github.com/Vouzamo/Lego/blob/44695a10824e51c0ecf42b6dcf1aff6eb300445e/src/Lego/Lego.Core/Models/Device.cs#L172

a333klm avatar Dec 22 '20 14:12 a333klm

Well I reopen that, so if someone wants to fix it. Can't do it, as I don't want to setup the project.

Probably those two things might enable combinedMode updates:

  1. move this message to this location
  2. Adapt this here. It is the following order: ... Port ID, 2 byte for the modes, 1 byte for speed, 4 byte for the position, 2 byte for the absolutePosition

a333klm avatar Dec 23 '20 17:12 a333klm