static void autoexpo_task() { autoexpo_running = 1; if(!lens_info.raw_shutter) goto cleanup; //open menus int bv = RAW2TV(lens_info.raw_shutter) + RAW2AV(lens_info.raw_aperture) - RAW2SV(lens_info.iso_equiv_raw) + RAW2EC(get_ae_value()); if(bv < -200){ //AE_VALUE overflows, set some low values lens_set_rawshutter(60 + 56); lens_set_rawaperture(1); lens_set_rawiso(1); NotifyBox(1000, "AE_VALUE overflows"); goto cleanup; } last_bv = bv; exposure expo = get_exposure(bv, 0); lens_set_rawaperture(AV2RAW(expo.av)); lens_set_rawiso(SV2RAW(expo.sv)); lens_set_rawshutter(TV2RAW(expo.tv)); cleanup: autoexpo_running = 0; }
static PyObject * flea_get_auto_setting(PyObject *self, PyObject *args) { int handle = -1; fleaCamera* cam = NULL; const char* prop_name; fleaProperty prop; if (!PyArg_ParseTuple(args, "is", &handle, &prop_name)) return NULL; if (handle >= 0 && handle < NUM_CAMERA_HANDLES && cameras[handle]) { cam = cameras[handle]; if (strcmp(prop_name, "exposure") == 0) { prop = get_exposure(cam); } else if (strcmp(prop_name, "shutter") == 0) { prop = get_shutter(cam); } else if (strcmp(prop_name, "gain") == 0) { prop = get_gain(cam); } else { return NULL; } } else { PyErr_SetString(FleaError, "Invalid Handle"); return NULL; } return Py_BuildValue("iif", prop.autoMode, prop.on, prop.value); }
static MENU_UPDATE_FUNC(last_bv_upd) { if(last_bv != INT_MIN) { exposure expo = get_exposure(last_bv, 1); expo.av = AV2STR(expo.av); MENU_SET_VALUE("%s%d.%d BV", FMT_FIXEDPOINT1(last_bv)); MENU_SET_HELP("%s f/%d.%d %d ISO %s%d.%d EC", lens_format_shutter(TV2RAW(expo.tv)), expo.av / 10, expo.av % 10, raw2iso(SV2RAW(expo.sv)), FMT_FIXEDPOINT1S(expo.ec) ); } MENU_CUSTOM_DRAW(browse); }
static void update_graph() { exposure last_expo; bool draw_label = 0; //bg rect bmp_fill(GRAPH_BG, 1, GRAPH_YOFF - GRAPH_MAX_PX - GRAPH_PADD, 720 - 2, GRAPH_MAX_PX + GRAPH_TEXT_PADD + GRAPH_PADD + font_med.height ); // current BV if(last_bv != INT_MIN){ int x = GRAPH_XOFF + (BV_MAX - last_bv) * GRAPH_XSIZE; draw_line(x - 1, GRAPH_YOFF - GRAPH_MAX_PX, x - 1, GRAPH_YOFF, IS_SEL(browse) ? COLOR_WHITE : COLOR_CYAN); draw_line(x + 1, GRAPH_YOFF - GRAPH_MAX_PX, x + 1, GRAPH_YOFF, IS_SEL(browse) ? COLOR_WHITE : COLOR_CYAN); } graph_draw: last_expo = (exposure){-1, -1, -1, -1}; for(int bv = BV_MAX; bv >= BV_MIN; bv -= (draw_label) ? 20 : GRAPH_STEP) { int x = GRAPH_XOFF + (BV_MAX - bv) * GRAPH_XSIZE; exposure expo = get_exposure(bv, 1); int ec_val = expo.ec; expo.ec = (GRAPH_MAX / 2) + expo.ec; if(!draw_label) { int x_last = x - GRAPH_XSIZE * GRAPH_STEP; // bg lines if(!(bv % 10))draw_line(x, GRAPH_YOFF - GRAPH_MAX_PX, x, GRAPH_YOFF, COLOR_BLACK); // sv curve GRAPH_DRAW_CURVE(sv, COLOR_LIGHT_BLUE); // av curve GRAPH_DRAW_CURVE(av, COLOR_GREEN2); // ec curve GRAPH_DRAW_CURVE(ec, (last_expo.ec - (GRAPH_MAX / 2) == 0 && ec_val == 0) ? COLOR_BLACK : COLOR_ORANGE); // tv curve GRAPH_DRAW_CURVE(tv, COLOR_RED); } else { // bv value { char bv_str[3]; snprintf(bv_str, sizeof(bv_str), "%d", ABS(bv / 10)); int center = strlen(bv_str) * font_med.width / 2; if(bv < 0) center += font_med.width; bmp_printf(GRAPH_FONT, x + 3 - center, GRAPH_YOFF + GRAPH_TEXT_PADD, "%d", bv / 10); } //do not print on the right edge of graph if(BV_MAX + bv <= 40) continue; // sv value if(expo.sv != last_expo.sv) { bmp_printf(GRAPH_FONT, x, GRAPH_Y_TEXT(expo.sv), "%d", raw2iso(SV2RAW(expo.sv))); } // av value if(expo.av != last_expo.av) { int ap = AV2STR(expo.av); bmp_printf(GRAPH_FONT, x, GRAPH_Y_TEXT(expo.av), "%d.%d", ap / 10, ap % 10); } // ec value if(expo.ec != last_expo.ec && ec_val) { bmp_printf(GRAPH_FONT, x, GRAPH_Y_TEXT(expo.ec), "%s%d.%d", FMT_FIXEDPOINT1S(ec_val)); } // tv value if(expo.tv != last_expo.tv) { bmp_printf(GRAPH_FONT, x, GRAPH_Y_TEXT(expo.tv), "%s", lens_format_shutter(TV2RAW(expo.tv))); } } last_expo = expo; } if(!draw_label) { draw_label = 1; goto graph_draw; } }