Commit 82e2b178 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Moved PauseLiveView/ResumeLiveView to powersave.c/h

--HG--
branch : powersave-refactor
parent 8597a6b492ae
......@@ -13,6 +13,7 @@
#include <property.h>
#include <zebra.h>
#include <lvinfo.h>
#include <powersave.h>
#include "lua_common.h"
......
......@@ -16,6 +16,7 @@
#include "zebra.h"
#include "fps.h"
#include "beep.h"
#include "powersave.h"
#ifdef FEATURE_REC_NOTIFY
......
#include "dryos.h"
#include "property.h"
#include "zebra.h"
#include "shoot.h"
#include "bmp.h"
/* Canon's powersave timer */
/* ======================= */
void powersave_prolong()
{
/* reset the powersave timer (as if you would press a button) */
......@@ -21,3 +27,63 @@ void powersave_permit()
int powersave_permit = 1; /* AUTO_POWEROFF_PERMIT */
prop_request_change(PROP_ICU_AUTO_POWEROFF, &powersave_permit, 4);
}
/* Paused LiveView */
/* =============== */
#if defined(FEATURE_POWERSAVE_LIVEVIEW)
static int lv_zoom_before_pause = 0;
#endif
void PauseLiveView() // this should not include "display off" command
{
#if defined(FEATURE_POWERSAVE_LIVEVIEW)
if (ml_shutdown_requested) return;
if (sensor_cleaning) return;
if (PLAY_MODE) return;
if (MENU_MODE) return;
if (LV_NON_PAUSED)
{
int x = 1;
BMP_LOCK(
lv_zoom_before_pause = lv_dispsize;
prop_request_change(PROP_LV_ACTION, &x, 4);
msleep(100);
clrscr();
lv_paused = 1;
)
ASSERT(LV_PAUSED);
}
#endif
}
// returns 1 if it did wakeup
int ResumeLiveView()
{
info_led_on();
int ans = 0;
#if defined(FEATURE_POWERSAVE_LIVEVIEW)
if (ml_shutdown_requested) return 0;
if (sensor_cleaning) return 0;
if (PLAY_MODE) return 0;
if (MENU_MODE) return 0;
if (LV_PAUSED)
{
int x = 0;
BMP_LOCK(
prop_request_change(PROP_LV_ACTION, &x, 4);
int iter = 10; while (!lv && iter--) msleep(100);
iter = 10; while (!DISPLAY_IS_ON && iter--) msleep(100);
)
while (sensor_cleaning) msleep(100);
if (lv) set_lv_zoom(lv_zoom_before_pause);
msleep(100);
ans = 1;
}
lv_paused = 0;
idle_wakeup_reset_counters(-1357);
info_led_off();
#endif
return ans;
}
......@@ -10,4 +10,12 @@ void powersave_prohibit();
/* re-enable powersave timer */
void powersave_permit();
/* stop LiveView activity, leave shutter open */
/* the sensor is turned off, and the LV image will freeze */
/* method similar to what Canon code does when entering PLAY mode from LV */
void PauseLiveView();
/* back to LiveView from paused state */
int ResumeLiveView();
#endif
......@@ -39,6 +39,7 @@
#include "shoot.h"
#include "focus.h"
#include "lvinfo.h"
#include "powersave.h"
#include "imgconv.h"
#include "falsecolor.h"
......@@ -4149,65 +4150,6 @@ static void idle_action_do(int* countdown, int* prev_countdown, void(*action_on)
*prev_countdown = c;
}
#if defined(CONFIG_LIVEVIEW) && defined(FEATURE_POWERSAVE_LIVEVIEW)
static int lv_zoom_before_pause = 0;
#endif
void PauseLiveView() // this should not include "display off" command
{
#if defined(CONFIG_LIVEVIEW) && defined(FEATURE_POWERSAVE_LIVEVIEW)
if (ml_shutdown_requested) return;
if (sensor_cleaning) return;
if (PLAY_MODE) return;
if (MENU_MODE) return;
if (LV_NON_PAUSED)
{
//~ ASSERT(DISPLAY_IS_ON);
int x = 1;
//~ while (get_halfshutter_pressed()) msleep(MIN_MSLEEP);
BMP_LOCK(
lv_zoom_before_pause = lv_dispsize;
prop_request_change(PROP_LV_ACTION, &x, 4);
msleep(100);
clrscr();
lv_paused = 1;
)
ASSERT(LV_PAUSED);
}
#endif
}
// returns 1 if it did wakeup
int ResumeLiveView()
{
info_led_on();
int ans = 0;
#if defined(CONFIG_LIVEVIEW) && defined(FEATURE_POWERSAVE_LIVEVIEW)
if (ml_shutdown_requested) return 0;
if (sensor_cleaning) return 0;
if (PLAY_MODE) return 0;
if (MENU_MODE) return 0;
if (LV_PAUSED)
{
int x = 0;
//~ while (get_halfshutter_pressed()) msleep(MIN_MSLEEP);
BMP_LOCK(
prop_request_change(PROP_LV_ACTION, &x, 4);
int iter = 10; while (!lv && iter--) msleep(100);
iter = 10; while (!DISPLAY_IS_ON && iter--) msleep(100);
)
while (sensor_cleaning) msleep(100);
if (lv) set_lv_zoom(lv_zoom_before_pause);
msleep(100);
ans = 1;
}
lv_paused = 0;
idle_wakeup_reset_counters(-1357);
info_led_off();
#endif
return ans;
}
#ifdef FEATURE_POWERSAVE_LIVEVIEW
static void idle_display_off_show_warning()
{
......
......@@ -59,8 +59,6 @@ void lv_vsync(int mz);
int arrow_keys_shortcuts_active();
/* todo: move to powersave.c/h */
void PauseLiveView();
int ResumeLiveView();
void idle_wakeup_reset_counters(int reason);
void idle_force_powersave_now();
void idle_force_powersave_in_1s();
......
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