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

Fix live view for Nikon DSLRs; Add option for inter-shot delay #98

Merged
merged 7 commits into from
Aug 5, 2024
Merged

Conversation

nicegamer7
Copy link
Contributor

@nicegamer7 nicegamer7 commented Aug 1, 2024

This PR fixes the issue noted in this discussion (the live view getting increasingly delayed).

This PR also adds an option to add a delay in between shots for DSLRs. The rationale behind this option is that I often have my exposures set to 30 seconds, which means that if there is no delay in between shots, I have no time to move my camera if I want to (since it'll just be a blurry mess if I do). I wasn't sure if this option would be useful for other types of cameras, nor would I be able to test it for other types of cameras, so I just left it for DSLRs.

Finally there were two tab characters I got rid of.

Thank you for this software!

@nicegamer7
Copy link
Contributor Author

nicegamer7 commented Aug 1, 2024

I added some logging and I figured out the root cause of this issue.

The background to the issue is that the GP_EVENT_FILE_ADDED and GP_EVENT_CAPTURE_COMPLETE events both cause wait_event to return, but only GP_EVENT_FILE_ADDED returns with a new file, whereas GP_EVENT_CAPTURE_COMPLETE returns with no new files.

The issue is that in both cases, a new exposure is started inside the capture loop. This causes a pile up of exposures, since for every exposure taken, two new exposures are started. I fixed this in 3f74ab4.

@nicegamer7 nicegamer7 changed the title Fix some DSLR issues Fix DSLR live view delay; Add option for inter-shot delay Aug 1, 2024
@nicegamer7
Copy link
Contributor Author

This is ready for review now!

@artyom-beilis
Copy link
Owner

Wait a second. Nikon sends CAPTURE_COMPLETE and than FILE_ADDED?
Because canon does it the other way around I think... @flyingbarron Can you please check the order of the triggers on Canon?
(I don't have Canon with me any more. @flyingbarron has)

Now during normal scan I don't actually wait for capture complete (only at first run)

Lets make sense. Maybe capture_complete need to be ignored all together... What happens with following simple logic:

wait_multiple is false ignore capture complete. it is true only at 1st capture when I identify the streaming format.

I think there may be much simpler solution - just ignore capture_complete since we don't really need it (I use it only at 1st capture)

@nicegamer7
Copy link
Contributor Author

The order is FILE_ADDED then CAPTURE_COMPLETE, same as Canon.

@nicegamer7
Copy link
Contributor Author

I've enabled changes from maintainers, so you can make changes and I can test them. I think that would be easier.

@artyom-beilis
Copy link
Owner

I mean - why this only: 3f74ab4 does not fix the issue?

@artyom-beilis
Copy link
Owner

2nd question - why capture delay is needed. Are both cameras canon and nikon work when delay is 0?

@nicegamer7
Copy link
Contributor Author

nicegamer7 commented Aug 1, 2024

The fix is 3f74ab4, as you mentioned. The capture delay is just a useful feature. When the exposure setting is 30 seconds, it's nice to have a delay to allow moving the camera in between shots. The live view still works with 0 delay.

I can remove it if you want.

@artyom-beilis
Copy link
Owner

@flyingbarron what do you think? Is delay useful?

@nicegamer7
Copy link
Contributor Author

It seems like this is what was described in #64, albeit without specifying the number of photos to be taken.

@artyom-beilis
Copy link
Owner

I see indeed :-)

One small thing before I merge the request: if the delay is 0 don't start the thread.

@nicegamer7
Copy link
Contributor Author

nicegamer7 commented Aug 3, 2024

Don't start the thread and instead trigger the capture normally? Or just don't start the thread, and don't start the capture?

@artyom-beilis
Copy link
Owner

artyom-beilis commented Aug 3, 2024

I think don't start, here is how:

if delay > 0
  waiting_mode=true;
if waitinng
   take time measurements (start point 0)
else
  trigger

download files

if waiting
  measure time (check how much passed) wait with delays of 0.5 seconds till the time passes
  trigger start

This way no need to start new thread and I think somewhat more predictable than trigger starting outside.

@nicegamer7
Copy link
Contributor Author

Okay, I've made those changes. Take a look and let me know what you think!

@artyom-beilis
Copy link
Owner

Last question before I merge it.

Did you test it with both Nikon and Canon? (I don't have DSLR with me any more)

@nicegamer7
Copy link
Contributor Author

I only tested with Nikon, as that's what I have at home. But my friends mostly have Canon, so I will test it with Canon and get back to you. Good call to test both.

@nicegamer7 nicegamer7 changed the title Fix DSLR live view delay; Add option for inter-shot delay Fix live view for Nikon DSLRs; Add option for inter-shot delay Aug 5, 2024
@nicegamer7
Copy link
Contributor Author

I just gave it a go with a Canon T5i. It looks like this issue was only affecting non-Canon cameras, or maybe only Nikon. Anyway I tested before and after this PR with the Canon and the behaviour is unchanged. The inter-shot delay is working as well.

I also tested with my Nikon and the live view now works the same as the Canon.

@artyom-beilis artyom-beilis merged commit ed7bed2 into artyom-beilis:main Aug 5, 2024
@artyom-beilis
Copy link
Owner

Excellent. I merged it.

@artyom-beilis
Copy link
Owner

Hi, can you please check this fix - apparently your patch wasn't building with android's clang++. So I did a fix but since I don't have DSLR any more please check it and tell me:

c2116bd

It is very important since I want to release a version to Android

@nicegamer7
Copy link
Contributor Author

I believe it should be working. Can you give me an APK to test?

@artyom-beilis
Copy link
Owner

I can. Don't you have build environment?

@artyom-beilis
Copy link
Owner

Take it from there: https://github.com/artyom-beilis/OpenLiveStacker/releases/tag/beta32

I published it as pre-release, if it works Ok I'll push it to Google Play and make if official release

@nicegamer7
Copy link
Contributor Author

Sorry I wasn't home, so I figured it'd be easier for you to send an APK. I'll test it and let you know.

@nicegamer7
Copy link
Contributor Author

Unfortunately it's crashing when I click the GPhoto button. Is there any way I can get you a crash log? I'm not very familiar with Android development. Also, what was the error it was giving you before?

@artyom-beilis
Copy link
Owner

It was build error. Not runtime error.

Did you download version 32? What Android version do you have?

@artyom-beilis
Copy link
Owner

artyom-beilis commented Sep 10, 2024

Does it crash on sim or android/internal camera?

@nicegamer7
Copy link
Contributor Author

Yes I downloaded version 32. I'm on Android 14. It doesn't crash on sim, and it doesn't crash on internal camera either.

@artyom-beilis
Copy link
Owner

Please check "Enable Camera Debugging" and start gphoto. There should be gphoto log in debug directory.

@nicegamer7
Copy link
Contributor Author

It doesn't create a log, I guess it crashes before anything gets logged.

@artyom-beilis
Copy link
Owner

Can you please uninstall the app and do clean install of the APK.

@artyom-beilis
Copy link
Owner

Ok it looks like it isn't related to GPhoto since touptek or USB accessings apps crashing on Android 14...

Thanks. I'm glad I tested it with you before uploading to Google Play.

@nicegamer7
Copy link
Contributor Author

Clean install doesn't help, same result.

Ah, good to know that it's not related to GPhoto.

@artyom-beilis
Copy link
Owner

Can you please test new version 33: https://github.com/artyom-beilis/OpenLiveStacker/releases/tag/beta33

I got Android 14 and fixed the issues - just need to check that DSLR is working properly (since I don't have one anymore) before I upload to Google Play

@nicegamer7
Copy link
Contributor Author

Sure, I'm pretty busy today. I'll try to get to it by the end of the day. If not today, then tomorrow.

@artyom-beilis
Copy link
Owner

Sure, I'm pretty busy today. I'll try to get to it by the end of the day. If not today, then tomorrow.

A friend of mine who owns Canon had already tested it.

@nicegamer7
Copy link
Contributor Author

Ah okay that's good, is it working?

@artyom-beilis
Copy link
Owner

yes it is. Feel free to download and use.

@nicegamer7
Copy link
Contributor Author

Perfect, thank you so much.

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

Successfully merging this pull request may close these issues.

2 participants