In another post I suggested a tweak to the dof focus reporting and hoped some kind developer would 'magically' tweak things.
I think I was asking too much.
Although I'm not a coder, I thought I would try and make a halfway step, ie do some coding myself.
Here are my simple tweaks to lens.c, plus a global variable would need to be added as a toggle in the DoF menu, ie where you switch dof reporting on and off. I have not been able to do this as I don't know where to look.
Please don't crucify me!!!! I'm trying to learn.
{
#ifdef CONFIG_FULLFRAME
const uint64_t coc = 29; // 1/1000 mm
#else
const uint64_t coc = 19; // 1/1000 mm
#endif
const uint64_t fd = info->focus_dist * 10; // into mm
const uint64_t fl = info->focal_len; // already in mm
// If we have no aperture value then we can't compute any of this
// Not all lenses report the focus distance
if( fl == 0 || info->aperture == 0 )
{
info->dof_near = 0;
info->dof_far = 0;
info->hyperfocal = 0;
info->rel_abs = 1; //This is a global toggle set in DoF menu. 1 = relative reporting, 0 =
// Absolute. This toggle needs adding to the DoF menu as a user input
// with a default of 1
return;
}
const uint64_t fl2 = fl * fl;
// The aperture is scaled by 10 and the CoC by 1000,
// so scale the focal len, too. This results in a mm measurement
const uint64_t H = ((1000 * fl2) / (info->aperture * coc)) * 10;
info->hyperfocal = H;
// If we do not have the focus distance, then we can not compute
// near and far parameters
if( fd == 0 )
{
info->dof_near = 0;
info->dof_far = 0;
return;
}
// fd is in mm, H is in mm, but the product of H * fd can
// exceed 2^32, so we scale it back down before processing
info->dof_near = (H * fd) / ( H + fd ); // in mm
if( fd >= H )
info->dof_far = 1000 * 1000; // infinity
else
{
info->dof_far = (H * fd) / ( H - fd ); // in mm
}
//Check if absolute reporting requested and adjust dofs
If(rel_abs=0)
{
Info->dof_near = fd-dof_near
Info->dof_far = fd+dof_far
}
// Note a refinement would be to add some text or colour to indicate rel vs abs reporting
// But this is a refinement that isn’t needed
}
Bottom line: once again I hope someone with the ability to compile nightlies will add this simple tweak.