-
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
HUB emulation PORT A #50
Comments
Hi @smotek ! First the emulation should work for the TechnicHUB and the TrainHUB but right now only for the train motors. I am developing a new version where more motors and also sensors are supported. Regarding your problem of port A. Maybe you have to increase some delays a littlebit. I sometimes see that the command/response messages was not exchanged correclty and the app then does not recognize the "attached" device on port A. If so, no message will be send out of the app even if you have a block which addresses port A |
Hi corneliusmunz thanks for the info. To fix PORT A, I should try to change the times in the loop |
Hi @smotek yes... you should initialize the object like the following // create a hub instance
Lpf2HubEmulation myEmulatedHub("TrainHub", HubType::CONTROL_PLUS_HUB); And for the Port A, just try to change the delays in the following section (decrease it and increase it): delay(1000);
myEmulatedHub.isPortInitialized = true;
myEmulatedHub.attachDevice((byte)PoweredUpHubPort::A, DeviceType::TRAIN_MOTOR);
delay(1000);
myEmulatedHub.attachDevice((byte)PoweredUpHubPort::LED, DeviceType::HUB_LED);
delay(1000);
myEmulatedHub.attachDevice((byte)PoweredUpHubPort::B, DeviceType::TRAIN_MOTOR);
delay(1000); |
If I use
delay for A test |
PORT A solved myEmulatedHub.isPortInitialized = true; added line delay |
If you want to use the CONTROL_PLUS_HUB you have also to use the Port definitions in the enum myEmulatedHub.attachDevice ((byte) ControlPlusHubPort :: D, DeviceType :: TRAIN_MOTOR); |
@smotek Regarding the delays: In the current version the delays are already adjusted. Which version of the library do you use? |
The |
Now I understand |
Hello! Congratulations to all persons who are working on this project. Very nice. I succefully ran Lpf2HubEmulation and now I'm trying to emulate two or more hubs in just one ESP32. On app, first appears HUB1. After some time, name changes to HUB2 but I can't have both at same time I don't know if am I doing or saying a dumb thing, but here it is: Lpf2HubEmulation myEmulatedHub("HUB1", HubType::CONTROL_PLUS_HUB); void writeValueCallback(byte port, byte value) { void setup(){ myEmulatedHub2.setWritePortCallback(&writeValueCallback2); ... void loop() { if (myEmulatedHub.isConnected && !myEmulatedHub.isPortInitialized) { if (myEmulatedHub2.isConnected && !myEmulatedHub2.isPortInitialized) { |
@Chris-Rodrigues interesting idea, but this may be not posible on one MAC address. I think the solution for having more ports (6 vs 4) is to implement support for Spike Prime Hub. What do you think @corneliusmunz ? |
@Chris-Rodrigues I have never tried this and I am not sure if the NimBle library does support multiple connections. If you use the library to connect to other hubs it ist possible to have up to 9 connections at the same time. But I have never tried it the other way round. Maybe I will find some time in the next days to try it out |
Thank you @corneliusmunz and @paki111 |
Hello @corneliusmunz |
@Chris-Rodrigues unfortunately I have not found a time slot to test it 😢 It is on my task list |
Hi,
legoino is a perfect project, thank you.
I have a problem with HUB emulation.
HW I use NodeMcu WROOM-32
I monitor the data on a serial monitor.
Everything is OK for PORT B.
For HUB LED it is OK.
But I don't get any data for PORT A.
Who could be the problem?
Will emulation also be available for TechnicHUB?
Thank you
The text was updated successfully, but these errors were encountered: