Determining mode at runtime? - General Discussion and Assistance - CHDK Forum  

Determining mode at runtime?

  • 2 Replies
  • 2056 Views
*

Offline @rt

  • *
  • 34
    • Art's Fantastic Website
Determining mode at runtime?
« on: 28 / June / 2009, 10:41:24 »
Advertisements
Hi Guys,
I'm finding that some routines if ran at startup behave differently if the camera was started in camera mode,
rather than playback mode.

Is there a way for the program to know what mode the camera was started in at runtime?
Cheers, Art.
If not actually, then potentially.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Determining mode at runtime?
« Reply #1 on: 28 / June / 2009, 15:55:00 »
All over CHDK we use things like
if (mode_get()&MODE_MASK) == MODE_REC) foo()
to determine the current mode. Search the code around for mode_get() and more examples of its use. AFAIK mode during startup is not stored permanently, but if you find it to be necessary, I suppose you need add this to a suitable place near CHDK startup. I don't know what the perfect place would be and how foolproof it will be (I often press the power on button and switch to rec mode pretty much simultaneously, often switching to REC mode before CHDK has fully booted; I've made it a habit to keep the rec/play lever in 'play' when the camera is not in use so that the lens wouldn't come out if the button gets pressed accidentally).

*

Offline @rt

  • *
  • 34
    • Art's Fantastic Website
Re: Determining mode at runtime?
« Reply #2 on: 28 / June / 2009, 20:08:24 »
Thanks :)
If not actually, then potentially.

 

Related Topics