/ SCRIPTS / FocalSteps.lua
FocalSteps.lua
 1  --[[
 2  
 3  Copyright (c) 2025, Jose R Garcia (jg-fossh@protonmail.com).
 4  All rights reserved.
 5  
 6  | Meta      | Data       
 7  | :-------- | :-----------
 8  | _Project_ |
 9  | _Version_ | 1.0
10  | _Author_  | Jose Garcia
11  | _License_ | GNU GPLv3
12  
13  @chdk_version 1.7
14  @title FocalSteps
15  @description 
16  This script gets the amount of available zoom steps for the camera and loops over 
17  each step to find the 35mm equivalent focal length. For each step the code prints to
18  screen and to a log file in /LOGS both the step and the focal length in a Markdown
19  syntax table. 
20  
21  --]]
22  
23  -- Main Section
24  
25  -- Set a low zoom speed and enable print logging to log file *_0001.log
26  set_zoom_speed(30)
27  print_screen(true)
28  print_screen(1)
29  
30  -- Get/Set initial state
31  dof = get_dofinfo()
32  vsteps = get_zoom_steps()
33  text = dof.eff_focal_length
34  z = 0
35  
36  print("Start!\n")
37  -- Print the table's header
38  print("| Step | Eqv.FL |")
39  print("| :--: | :----: |")
40  -- Loop over all the available steps
41  while z ~= vsteps do
42      -- Set zoom to current step value
43      set_zoom(z)
44      -- Fetch current equivalent focal length
45      dof = get_dofinfo()
46      -- Print table entry
47      print("| "..z.." | "..(dof.eff_focal_length).." |")
48      -- Increment step count
49      z = (z+1)
50      sleep(300)
51  end
52  
53  print("\nDone!")
54  
55  exit_alt()