-
Notifications
You must be signed in to change notification settings - Fork 92
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
Make driver reentrant #153
Comments
Can you close the serialport when receiving the |
This is the problem. I'm not sure how to close the port from within the dmx variable. I know how to use the node-red close. In the latest node red, there is actually separate tabs in the function node for start, message and stop. I can see the code in the enttec-open-usb-dmx.js but I'm not sure how to get to it. The serialport variable is inside the dmx variable and not global. |
Can you share a couple of screenshots or the code that you've already written? |
I'm just reusing code from dmx-web and adding a few variables for reentrance. This is in a function node and I pass two template nodes for config and html also taken from dmx-web:
|
Hm. Edit: just read the code more thoroughly, you are not creating a control UI but a REST API. Do you need that? Otherwise, we could greatly simplify the code. |
I'm not a big fan of dashboard, but I like node red for rapid implementation of nodejs. My habit of implementing nodejs into node-red is to just add the requireds into settings.js and then start adding code just to see if it will work at all, which I've accomplished here, almost. To answer the question "what are you trying to accomplish?" is to add dmx and dmx-web into node-red with the minimum amount of recoding possible. ;) So, I just need to figure out how to release the port in between reloads and I'm done, for now. The truth is, running dmx-web from a command line nodejs and ctrl-c out is causing the same problem. |
Ah, I see. I haven't though of this but it's quite a neat trick ;-)
Do I understand correctly that if you have a node js script with the code, running it via node and exiting with Ctrl + C, you can't run it again? That is very strange, because Ctrl + C should terminate the whole node process and also free up the port again. Do you see an instance of node still in the Task Manager (or equivalent on other os'ses)? |
It may be a timing issue of how long it takes for the port to release but I noticed, running in Ubuntu, if I ctrl-c out and restart, Sometimes, I will get an error on the port. I don't think I would worry about that, unless other people are complaining. This is on an old mac-mini running Ubuntu. |
Hm, I'm sorry, but now that I've understood your setup, I unfortunately think this is outside of my scope. I don't have time to build a similar setup to try and debug this, and I don't even know if the issue lies in |
Hey no problem. I'll be playing with this more anyway and I get the code well enough now that I've been playing with it. If I come up with something I think is worthy of your attention, I'll check back! I'll leave it open for now. |
I'm trying to figure out how to move this into node-red and I need to figure out how I can close the serial port when node-red reloads. I'm down to, in the driver (this case is enttec-open-usb-dmx):
I get err, but I can't figure out how to close the serial port from the previous open.
[Error: Error Resource temporarily unavailable Cannot lock port]
The text was updated successfully, but these errors were encountered: