-
Notifications
You must be signed in to change notification settings - Fork 34
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
Lpf2HubEmulation - Port A not working #71
Comments
Hi @marco-bertani ! Many thanks for your interest in this lib. Unfortunately I have not so much time in the last month to spent in the hub emulation feature. It turns out, that sometimes the emulation is not really reliable and I don't figure really out why. Can you share your custom class which analyzes and print out all the message traffic? This would be very helpful. I will try to evaluate your issue further after I will come back from my vacation. I will be back next week. |
@corneliusmunz I might consider merging the message decoding and getting parsed value into a unique static class to be recycled all around the code. I'll see... A couple days a go I managed to make port A working (yay) by moving the "HUB_ATTACHED_IO" notifications from the
Of course there are other changes to make it work, like creating a I would really like to contribute to this project, as far as my little skills allow me😅. |
I think, I found the reason, why port A is not working. The io attachments to the ports seem to be too early. In the debug log I realized, that the attachment for port A is send, before the client is subscribed. So the app does not realize, that a device is attached at port A. In the main function of the HubEmulation sample, I extend the first delay to 2 seconds. Now the app has enough time to subscribe and to receive the io attachment fo port A. Of course, this is dirty. There should be a way to wait with the attachements, until a client is subscribed. We'll see. But I'm still trying to become more used with the code. |
Ok. I think I found a better solution by adding a flag to indicate, if a client is subscripted. This can be used to wait before attaching io to the ports. So no delay is needed anymore to wait for the app. See RalfUhlig@cdaa9e1 and here RalfUhlig@667177d for details. |
Hi,
I started playing around with PoweredUp just recently and I came across this awesome project. I am mostly interested un the Hub Emulation.
What I noticed is a weird behaviour with ports and the offcial PoweredUp app:
If I set Port A to TRAIN_MOTOR and Port B to TRAIN_MOTOR I get this:
If I set Port A or Port B to device type LIGHT I can't make any of them work.
What I mean with "don't work" is that I enabled debug log on my ESP32, and when I press a button on the app in "Create Mode" no message is sent by the App to the Emulated Hub. Same thing for "Play Mode" (just note that I don't have any real LEGO hardware yet to know how to properly connect ports to make the Train dashboard work correctly)
I created a custom class that analyses and prints the content of received and sent messages based on the official protocol https://lego.github.io/lego-ble-wireless-protocol-docs/, and it looks like most messages sent by the Emulated Hub are correct.
I made a couple changes:
into this
to make it compliant.
but it does not solve the problem
Sometimes the App sends a PORT_INFORMATION_REQUEST message, sometimes it doesn't, and I don't understand why.
Can you help somehow?
The text was updated successfully, but these errors were encountered: