This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 34b7187c authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Lua: experimental camera.flash (get/set)

shoot.h: added set_flash_firing

--HG--
branch : lua_fix
parent 8b6b858dd5a7
......@@ -174,6 +174,26 @@ static int luaCB_camera_index(lua_State * L)
lua_setfield(L, -2, "fields");
lua_setmetatable(L, -2);
}
/// Get/set whether the flash is enabled.
///
/// Possible values: true, false, "auto", "unknown".
///
/// Flash can only be changed from script in simple (non-automatic) modes.
///
/// Not tested with external flashes; it may work or it may not.
// @tfield ?bool|string flash
else if(!strcmp(key, "flash"))
{
if (strobo_firing == 0) {
lua_pushboolean(L, 1); /* reversed */
} else if (strobo_firing == 1) {
lua_pushboolean(L, 0);
} else if (strobo_firing == 2) {
lua_pushstring(L, "auto");
} else {
lua_pushstring(L, "unknown");
}
}
/// Gets an @{ec} object that represents flash exposure compensation.
// @tfield ec flash_ec
else if(!strcmp(key, "flash_ec"))
......@@ -274,6 +294,18 @@ static int luaCB_camera_newindex(lua_State * L)
LUA_PARAM_NUMBER(value, 3);
status = lens_set_ae(APEX1000_EC2RAW((int)roundf(value * 1000)));
}
else if(!strcmp(key, "flash"))
{
if (strobo_firing == 0 || strobo_firing == 1)
{
LUA_PARAM_BOOL(value, 3);
set_flash_firing(value ? 0 : 1);
}
else
{
return luaL_error(L, "set 'camera.flash' failed");
}
}
else if(!strcmp(key, "flash_ec"))
{
LUA_PARAM_NUMBER(value, 3);
......@@ -823,6 +855,7 @@ static const char * lua_camera_fields[] =
"aperture",
"iso",
"ec",
"flash",
"flash_ec",
"kelvin",
"mode",
......
......@@ -115,6 +115,9 @@ int set_mlu();
int get_mlu_delay(int raw);
int mlu_lock_mirror_if_needed(); /* implemented in lens.c */
/* flash */
void set_flash_firing(int mode);
/* trap focus */
int get_trap_focus();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment