-
Notifications
You must be signed in to change notification settings - Fork 38
Fix exposure mode handling bugs. #61
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
base: master
Are you sure you want to change the base?
Conversation
There are some weird things going on with `pslr_exposure_mode_t` and `pslr_gui_exposure_mode_t`. My understanding is that there was a commit `582e03f7926314ee6fbec4f1b053e222d96cb6e0` (Wed May 29 18:04:27 2013 +0000) which added separate GUI exposure mode enum `pslr_gui_exposure_mode_t`, but the conversion between enums was forgotten in `user_mode_combo_changed_cb` and/or `pslr_set_exposure_mode`. Then recently this issue was discovered and commit `f9e23edcf88bfc5ca356bbfce91ca085aef56e54` (Sun Mar 22 14:03:39 2020 +0100) tried to fix it by adding enum conversion to `pslr_set_exposure_mode`. However the conversion is done in the wrong direction. To try to summarize, currently: * `pktriggercord.c` calls `pslr_set_exposure_mode` with `pslr_gui_exposure_mode_t` argument. * `pktriggercord-cli.c` calls `pslr_set_exposure_mode` with `pslr_exposure_mode_t` argument. * `pslr.c` function `pslr_set_exposure_mode` incorrectly converts `pslr_exposure_mode_t` to `pslr_gui_exposure_mode_t`. In CLI case this is incorrect as the enum should be left to `pslr_exposure_mode_t` and in GUI case the mode is already in `pslr_gui_exposure_mode_t` type so it does the conversion twice. I think the whole mode switching code was buggy before `need_exposure_mode_conversion` flag was added for K-30 camera. This can also be seen from the issue asalamon74#52 that something is wrong. So I think that the K-30 handling was probably not needed in the first place. My experimental fix is as follows: * `pslr.c` keeps track of camera mode only using `pslr_exposure_mode_t` type. This is preferred over `pslr_gui_exposure_mode_t` as it has more entries and is more accurate. * CLI `pktriggercord-cli.c` code mostly operates with `pslr_exposure_mode_t` type except few `PSLR_GUI_EXPOSURE_MODE_B` compares which were changed. * GUI `pktriggercord.c` now converts between `pslr_gui_exposure_mode_t` and `pslr_exposure_mode_t` as needed. * `pslr.c` has new functions `pslr_convert_exposure_mode_to_gui` and `pslr_convert_exposure_mode_from_gui` instead of single `exposure_mode_conversion` function. * `need_exposure_mode_conversion` structure entry and `pslr_get_model_need_exposure_conversion` function are removed.
|
Thanks, I'll need more time to check this. This part of the code is a mess, definitely, it would be great to clean this up. |
|
I checked a few things and the history of this fields:
The values of So why was this conversion added by me when I added the support for K-x? I don't really remember, but probably I realised that when I set the camera to M mode I read the value 8 instead of the expected 6. Setting exposure values was not possible for K-x, so I couldn't check that part. Why do we need this at all? I tested the exposure mode setting using K-70. It only works if I set the camera to user mode. Let's say I want to change to Sv mode. The value is 15 in So it means that |
|
Thanks for taking a look. I'm also not quite sure what the best option is here. I don't known how to handle all the user mode value conversions, but it feels to me that having only For K-30 camera the issue #52 was somewhat promising that my patch allowed the exposure mode to be correctly recognized. I don't really remember all the details though. |
There are some weird things going on with
pslr_exposure_mode_tandpslr_gui_exposure_mode_t.My understanding is that there was a commit
582e03f7926314ee6fbec4f1b053e222d96cb6e0(Wed May 29 18:04:27 2013 +0000) which added separate GUI exposure mode enumpslr_gui_exposure_mode_t, but the conversion between enums was forgotten inuser_mode_combo_changed_cband/orpslr_set_exposure_mode. Then recently this issue was discovered and commitf9e23edcf88bfc5ca356bbfce91ca085aef56e54(Sun Mar 22 14:03:39 2020 +0100) tried to fix it by adding enum conversion topslr_set_exposure_mode. However the conversion is done in the wrong direction.To try to summarize, currently:
pktriggercord.ccallspslr_set_exposure_modewithpslr_gui_exposure_mode_targument.pktriggercord-cli.ccallspslr_set_exposure_modewithpslr_exposure_mode_targument.pslr.cfunctionpslr_set_exposure_modeincorrectly convertspslr_exposure_mode_ttopslr_gui_exposure_mode_t. In CLI case this is incorrect as the enum should be left topslr_exposure_mode_tand in GUI case the mode is already inpslr_gui_exposure_mode_ttype so it does the conversion twice.I think the whole mode switching code was buggy before
need_exposure_mode_conversionflag was added for K-30 camera. This can also be seen from the issue #52 that something is wrong. So I think that the K-30 handling was probably not needed in the first place.My experimental fix is as follows:
pslr.ckeeps track of camera mode only usingpslr_exposure_mode_ttype. This is preferred overpslr_gui_exposure_mode_tas it has more entries and is more accurate.pktriggercord-cli.ccode mostly operates withpslr_exposure_mode_ttype except fewPSLR_GUI_EXPOSURE_MODE_Bcompares which were changed.pktriggercord.cnow converts betweenpslr_gui_exposure_mode_tandpslr_exposure_mode_tas needed.pslr.chas new functionspslr_convert_exposure_mode_to_guiandpslr_convert_exposure_mode_from_guiinstead of singleexposure_mode_conversionfunction.need_exposure_mode_conversionstructure entry andpslr_get_model_need_exposure_conversionfunction are removed.I don't have Pentax cameras so someone else would need to do tesing.