Skip to content
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

If deej starts too fast on windows startup it sometimes fails to detect sliders #23

Open
prueker opened this issue Nov 26, 2020 · 13 comments

Comments

@prueker
Copy link

prueker commented Nov 26, 2020

My PC boots quick and about half of the time, the application starts before it can detect the sliders and I have to manually close/restart deej so it detects them.

Maybe a check to see if sliders were detected could be added and if they were not, put in a retry-loop to try for 5 times every x seconds to prevent this?
image

@omriharel
Copy link
Owner

Hi @prueker, thanks for writing.

I'd like to understand this problem a bit more in-depth in order to help you. The logs you attached are suggesting that deej connects successfully, and that it'll handle the next line read from serial as the baseline for the number of sliders (what you're calling "detecting sliders").

So to clarify - which of these most accurately describes what you're running into?

  1. deej appears to connect but doesn't actually read lines (and thus doesn't respond to slider movements) - but stays running (this shouldn't happen)
  2. deej starts, fails to connect, notifies you, and stays running (also shouldn't happen)
  3. deej fails to connect (e.g. because serial isn't available yet), notifies you and quits (should happen)

On a related note, I do plan to add more robust connection handling (including reconnection attempts where appropriate), but there isn't a specific time frame for this yet. As a workaround until then, adding a 20 to 30 second sleep in your startup script launching deej might be an acceptable solution.

@prueker
Copy link
Author

prueker commented Nov 26, 2020

It's the number 1 case. deej starts, it says the "connected" line (which is the last line in the log until I close deej and restart it, as shown in the screenshot above), but not the "Detected sliders" line until I close deej and restart it, upon which it works immediately.

So I have the feeling that deej connects to the COM port, but the arduino might not have booted fully yet and isn't sending lines and so it somehow blocks it?

@omriharel
Copy link
Owner

Definitely sounds like something of that sort - I concur that some sort of retrying logic is the right call here. I'll likely do this in a small hotfix (and not as part of a more holistic improvement around connection stability), to solve this specific instance of it. If it's alright with you, I'll keep you updated here when it's ready. Thanks again for the report!

@prueker
Copy link
Author

prueker commented Nov 26, 2020

Sounds good, I'll be happy to test it.

@Nickxsch
Copy link

Hijacking this a bit (similar, but not the same issue): when the pc goes in hibernation and then comes out of it, the connection with the arduino is gone. A restart of deej solves this. I guess this would be fixed when you implement that more robust connection handling?

@omriharel
Copy link
Owner

Hey @Nickxsch, sorry about the delay in responding. Yes, this would be fixed together with those changes. I still don't have an ETA for this, unfortunately. I hope that in the meantime continuing to restart deej isn't a huge hassle, and I will update here when a fix is implemented. Thanks!

@Nickxsch
Copy link

@omriharel not a problem at all. I know this isn't a commercial product with a full time dev team behind it 🙂
Just wanted to join in this discussion to maybe add some useful info. It'll be fixed when it's fixed. If I could, I would put in some effort myself, but I lack the skill of coding properly 😁

@JackPikatea
Copy link

JackPikatea commented Feb 25, 2021

I hacky workaround that I've been using involves AutoHotKey. A "script" that launches at start up will first wait 20 seconds, then open deej.exe (if it isn't already open).

Here is the script I'm using

Sleep 20000 ; Sleep for 20 seconds
Process, Exist, deej.exe ; Check if the process exists
If (ErrorLevel = 0) ; If it is not running
	{
	Run, C:\Users\jackr\Downloads\deej.exe ; open the process
	
	}
Else ; If it is running, ErrorLevel equals the process id for the target program (Printkey). Then close it.
	{
	; do nothing
	}

Modify the path and sleep time to fit your needs. The Config.yaml will need to be in the same location as the script.

Compile the script by right clicking on it and selecting compile script. This will produce an .exe file that can be placed in the startup folder. (make sure the config.yaml is also with this new "launch script" and NOT with deej.exe. )

@marcuswu
Copy link

I just tossed the above PR up to solve the serial connections. It basically just closes the channels, drops out of the go routine, and restarts the serial if it loses connection. If it fails to connect, it will try again and then exponentially back off until it reaches a 100 second wait period at which point it just continues one try per 100 seconds.

@Nickxsch
Copy link

Marcus, you brilliant man, thanks!

@omriharel
Copy link
Owner

Updating here for posterity - the changes in #32 do the job but I currently have separate plans to fix this as part of a connection stability pass planned for the near future. I invite you to read my comment on the PR here for additional context.

I'll be sure to update this issue when this is released. Thank you!

@orbitinstasis
Copy link

Was this ever solved? it's been a few years and i think i'm having the same issue

@BeepBoopindie
Copy link

Also getting this issue having recently built a device. Deej detects with no com port error but i have to restart deej and re insert the arduino then it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants