Bluetooth Focus Adjustment is Imprecise

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

sinaroughani

  • Posts: 6
  • Joined: Mon Mar 16, 2020 8:13 pm
  • Real Name: Sina Roughani

Bluetooth Focus Adjustment is Imprecise

PostFri Apr 03, 2020 10:35 pm

Hello, I recently made a post about easily getting started with Bluetooth through a Linux-based system.
I shared how you can write the focus command in bluetoothctl (part of the bluez package), to for example sweep between a focus position of 0.9995 to 0.0000
Code: Select all
[bluetooth]# write "0x01 0x08 0x00 0x00 0x00 0x00 0x80 0x00 0x07 0xff 0x00 0x00"
or
[bluetooth]# write "1 8 0 0 0 0 128 0 7 255 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 7 254 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 7 253 0 0"
...
[bluetooth]# write "1 8 0 0 0 0 128 0 0 2 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 0 1 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 0 0 0 0"

But using my Olympus 25mm 1.8 M. Zuiko or my Panasonic 12mm 1.4 Summilux on the BMPCC4k, the focus intervals mapped roughly to
Code: Select all
[bluetooth]# write "1 8 0 0 0 0 128 0 0 5 0 0" ->INF
[bluetooth]# write "1 8 0 0 0 0 128 0 0 4 0 0" ->INF
[bluetooth]# write "1 8 0 0 0 0 128 0 0 3 0 0" ->600mm
[bluetooth]# write "1 8 0 0 0 0 128 0 0 2 0 0" ->300mm
[bluetooth]# write "1 8 0 0 0 0 128 0 0 1 0 0" ->250mm
[bluetooth]# write "1 8 0 0 0 0 128 0 0 0 0 0" ->200mm

So I could not properly set the focus positions.
Perhaps I have the endianness wrong on the signed 5.11 fixed number?
I know for a fact that bluetooth can precisely control the focus on the camera, as evidenced by my phone app that by the way, I was happy to pay for (even though this stuff is open source doesn't mean we should be stingy).

If any of you has implemented focus by bluetooth (at least a dozen of you, for sure), please share your thoughts!
Offline

sinaroughani

  • Posts: 6
  • Joined: Mon Mar 16, 2020 8:13 pm
  • Real Name: Sina Roughani

Re: Bluetooth Focus Adjustment is Imprecise

PostMon Apr 06, 2020 3:17 pm

Hello all, I just figured out that in fact the bytes are LSB first, but the bits are not LSB first. So, out of a range of 0x0800 to 0x07ff to 0x0001 to 0x0000, you need to actually write 0x00 0x08 to represent 0x0800, 0xff 0x07 to represent 0x07ff, etc.
So, functioning code to set the focus position will follow the format of...
Code: Select all
[bluetooth]# write "1 8 0 0 0 0 128 0 255 7 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 254 7 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 253 7 0 0"
...
[bluetooth]# write "1 8 0 0 0 0 128 0 2 0 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 1 0 0 0"
[bluetooth]# write "1 8 0 0 0 0 128 0 0 0 0 0"

Enjoy focusing precisely!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 16 guests