I have a dummy.lua file that defines dummy versions of the camera-only functions
function get_tick_count()
return os.time()*1000
end
function get_day_seconds()
return os.time()
end
function get_time(s)
return 0
end
function get_usb_power(x,y)
return 0
end
function set_prop(x,y)
end
function get_prop(x,y)
return 0
end
function sleep(n)
x=n
end
function print_screen(n)
x=n
end
function press(s)
x=s
end
function shoot(s)
x=s
end
function shot_histo_enable(s)
x=s
end
function get_histo_range(n1,n2)
return 100
end
function set_tv96_direct(n)
x=n
end
function set_bv96(n)
x=n
end
function set_sv96(n)
x=n
end
function get_bv96()
return 0
end
function get_av96()
return 0
end
function press(n)
x=n
end
function release(n)
x=n
end
function shutdown()
end
Then, I divide my programs in modules: some modules can be ran on PC and camera, others can't
Of the ones that can't, I do a dummy version that runs on the PC, resulting with two fles: module.lua (real file) module_dummy.lua (dummy file for PC)
Finally, in the main program, I have something like:
-- determine if we are on the camera or if we are just debugging on the PC
if (type(shoot)=="function") then
-- shoot() is defined, we are on a camera
-- require the real modules
require("module")
else
-- shoot() is undefined, we are on a PC
-- require the basic dummy functions
require("dummy")
-- and require the dummy version of the modules
require("module_dummy")
end
-- some modules can be ran on PC and camera
require("othermodule")
this results in a program program that can be ran (mainly for syntax checking9 on PC and camera)