asalamon74 / pktriggercord

Remote control for Pentax DSLR cameras
http://pktriggercord.melda.info
GNU Lesser General Public License v3.0
103 stars 38 forks source link

Added set_aperture to servermode #66

Closed kozinski closed 3 years ago

kozinski commented 4 years ago

Servermode didn't previously support setting the camera's aperture; this change adds the set_aperture command to allow the aperture to be adjusted.

Tested on a Pentax K10D (connected to a Raspberry Pi 4B) and it seems to work as expected.

asalamon74 commented 3 years ago

Why was this missing from servermode? Great find.

This patch introduces a code duplication for the value->rational aperture conversion. The other code is in pktriggercord-cli.c And the two methods are not exactly the same.

Can you merge the two, similarly to fa01735459cfc3bbfd2cb6f5dcf65b1a4499c3d7 ?

kozinski commented 3 years ago

Sure, I split the aperture parsing function out into a separate function, the same way parse_shutter_speed currently works.

I think there's really no reason to handle f-numbers >= 11 specially, since the camera accepts them as rational numbers with a denom of 10, and having the nom always be the f-number 10 simplifies displaying the resultant value. I therefore removed this from your aperture parsing code, and the aperture is always stored as (f 10)/10. Let me know if there is some reason to put in the extra check for f-numbers >= 11 (although if so, it should probably be for >= 10, since 10 is a valid f-number when the camera is set to 1/3 stop adjustments).

asalamon74 commented 3 years ago

Yes, the F>=11 check looks rather unnecessary, this patch was also working for my K-x. I like the simplification.

Thanks @kozinski, committed.