Magic Lantern Firmware Wiki
Advertisement


Parent:http://magiclantern.wikia.com/wiki/2.0.4_AJ

Related Page: Event Dispatch tasks

Related Page2: Tasks

Sister page: State Objects

See also: ValSubLists http://magiclantern.wikia.com/wiki/2.0.4_ValSubLists


And there's more: 2.0.4 StateObjects LVRecState


The info below was acquired by sampling state information at 18 times a second.
(ie some of the other states could briefly have been visited ... but only brielfly)


LV state

LV_state 0->2->3->4->2->3->4 (wizzes around). 5% in state 2, 20% in state 4, 75% in state 3. Sometimes (0.1% A state is entered)

When you press magnify LV_state briefly enters -> A -> and -> B -> states

On returning from recording a movie -> C (saving movie to disc) -> D -> back to 2,3,4


LVRec_state

LVRec_state is Zero until Record is pressed: 0 -> briefly to 3 -> 2 (stays here while recording ) -> (then when you stop recording) 6 (stays here until movie saved) -> 0

If you press 'Take photo' button on camera -> 5 ->


2.0.4 StateObjects for LiveView: "LVRecState" and "LVState"[]

Pointer to 32 Byte StateObject List of pairs of Value, Subroutine Keh? ValSub Pairs Total Inputs Total States
aAJ_0x44FC_LV_0x2C_LV_StateObj aAJ_0xFFC79630_LV_VarSubList

"LVState"

Live View State (Not record)

Inputs x States

23 x 14 = 322

23 14
aAJ_0x44FC_LV_0x30_LVRec_StateObj aAJ_0xFFC7A040_LVRec_VarSubList

"LVRecState"

Live View Record State

7 x 7 = 49 7 7


----- "LVRecState" changing Current_state -----[]

+------------------------------+
|  AJ_LVREC_CallNextState()    | at 0xFF8DAF8C 
+------------------------------+ 
        
int R0 = LiveViewMgr_struct      [ptr to huge 0x29D8 LVMgr struct]
int R1 = "LVRecState" StateObj   [ie aAJ_0x44FC_LiveView_struct_0x30_LVRec_StateObj]
int R2 = input                   [0..6]

Basic logic:

Next_State = [ aAJ_0xFFC7A040_LVRec_VarSubList + 8 x (7 x input + "LVRecState"_cur_state) ]

Next_Sub() = [0x04 + [ aAJ_0xFFC7A040_LVRec_VarSubList + 8 x (7 x input + "LVRecState"_cur_state) ]

Set "LVRecState".CurState = Next_State

Then BR Next_sub() [There's a little table at the Bottom of the State Objects page to show how this is physically listed in memory]



"LVRecState" State Machine as its stored in Memory[]

And so if I list the "LVRecState" VarSubList as a matrix with 7 x 7 we can see how the state machine works.

Input=0

Next

State

Next

Sub()

Input=1


Guess

STOP

Next State

Next


Sub()

0 3 AJ_LDR_R0_with_LVState_StateObj() 1 0 AJ_LVREC_LV_is_already_stopped_n_MovieRecorder_StateMachine()
0 1 AJ_lvError_ILLEGAL_Event() 1 0 AJ_LVREC_LV_is_already_stopped_n_MovieRecorder_StateMachine()
0 2 AJ_lvError_ILLEGAL_Event() 1 1 AJ_LDR_R0_with_LVState_StateObj()
0 3 AJ_lvError_ILLEGAL_Event() 1 3 AJ_lvError_ILLEGAL_Event()
0 4 AJ_lvError_ILLEGAL_Event() 1 0 AJ_LVREC_LV_is_already_stopped_n_MovieRecorder_StateMachine()
0 5 AJ_lvError_ILLEGAL_Event() 1 1 AJ_LVREC_lvCompleteThumbnail()
0 6 AJ_lvError_ILLEGAL_Event() 1 1 AJ_LVREC_lvCompleteThumbnail()

.

Input

Guess

RESUME

Next

State

Next

Sub()

Input

Next State

Next


Sub()

2 0 AJ_lvError_ILLEGAL_Event() 3 0 AJ_LDR_R0_with_LVState_StateObj()
2 1 AJ_lvError_ILLEGAL_Event() 3 1 AJ_lvError_ILLEGAL_Event()
2 2 AJ_lvError_ILLEGAL_Event() 3 6 AJ_LV_create_task_class()
2 3 AJ_lvError_ILLEGAL_Event() 3 6 AJ_LV_create_task_class()
2 4 AJ_lvError_ILLEGAL_Event() 3 6 AJ_LVREC_lvIllegalStop()
2 5 AJ_calls_AJ_JudgeStartLV_n_LVREC_send_MVR_EV_RecRESUME() 3 5 AJ_lvError_ILLEGAL_Event()
2 6 AJ_lvError_ILLEGAL_Event() 3 6 AJ_lvError_ILLEGAL_Event()


.

Input=4

Guess

FACE

DETECT

Next

State

Next

Sub()

Input=5

guess

CHANGE

DISPLAY

Next State

Next


Sub()

4 0 AJ_lvError_ILLEGAL_Event() 5 0 AJ_lvError_ILLEGAL_Event()
4 0 AJ_calls_LiveView_n_FaceDetect() 5 0 AJ_lvError_ILLEGAL_Event()
4 2 AJ_lvError_ILLEGAL_Event() 5 2 AJ_lvError_ILLEGAL_Event()
4 3 AJ_lvError_ILLEGAL_Event() 5 2 AJ_calls_PROP_LIVE_VIEW_VIEWTYPE_SELECT()
4 4 AJ_lvError_ILLEGAL_Event() 5 4 AJ_lvError_ILLEGAL_Event()
4 5 AJ_lvError_ILLEGAL_Event() 5 5 AJ_lvError_ILLEGAL_Event()
4 6 AJ_lvError_ILLEGAL_Event() 5 6 AJ_lvError_ILLEGAL_Event()

.

Input=6

Guess

SUSPEND

Next

State

Next

Sub()

6 0 AJ_lvError_ILLEGAL_Event()
6 0 AJ_lvError_ILLEGAL_Event()
6 4 AJ_LVREC_Send_MVR_EV_RECSUSPEND()
6 4 AJ_LVREC_Send_MVR_EV_RECSUSPEND()
6 4 AJ_lvError_ILLEGAL_Event()
6 4 AJ_LVREC_Send_MVR_EV_RECSUSPEND()
6 6 AJ_lvError_ILLEGAL_Event()


"LVRecState" State Machine listed from the perspective of current State.
[]

.

Current_state = 0 = INITIAL = RECORD_NOT_ACTIVE

input

Next

State

Next

Sub()

0

3 = READY_TO_RECORD

AJ_LDR_R0_with_LVState_StateObj()
1 = STOP 0 AJ_LVREC_LV_is_already_stopped_n_MovieRecorder_StateMachine()
2 = RESUME 0 AJ_lvError_ILLEGAL_Event()
3= STOP_RECORDING 0

AJ_LDR_R0_with_LVState_StateObj()

4 = FACE DETECT 0 AJ_lvError_ILLEGAL_Event()
5 = START_RECORDING 0 AJ_lvError_ILLEGAL_Event()
6 = SUSPEND 0 AJ_lvError_ILLEGAL_Event()

.

Current_state = 1 = STOPPED?

input

Next

State

Next

Sub()

0 1 AJ_lvError_ILLEGAL_Event()
1 = STOP 0 = INITIAL AJ_LVREC_LV_is_already_stopped_n_MovieRecorder_StateMachine()
2 = RESUME 1 AJ_lvError_ILLEGAL_Event()
3= STOP_RECORDING 1 AJ_lvError_ILLEGAL_Event()
4 = FACE DETECT
0 = INITIAL AJ_calls_LiveView_n_FaceDetect()
5 = START_RECORDING 0 = INITIAL AJ_lvError_ILLEGAL_Event()
6 = SUSPEND 0 = INITIAL AJ_lvError_ILLEGAL_Event()

.

Current_state = 2 = RECORDING

input

Next

State

Next

Sub()

0 2 AJ_lvError_ILLEGAL_Event()
1 = STOP 1 AJ_LDR_R0_with_LVState_StateObj()
2 = RESUME 2 AJ_lvError_ILLEGAL_Event()
3= STOP_RECORDING 6 = SAVE_MOVIE_TO_CF AJ_LV_create_task_class()
4 = FACE DETECT
2 AJ_lvError_ILLEGAL_Event()
5 = START_RECORDING 2 AJ_lvError_ILLEGAL_Event()
6 = SUSPEND 4 = SUSPENDED AJ_LVREC_Send_MVR_EV_RECSUSPEND

.

Current_state = 3 = READY_TO_RECORD (Here Briefly before going to State = 2)

input

Next

State

Next

Sub()

0 3 AJ_lvError_ILLEGAL_Event()
1 = STOP 3 AJ_lvError_ILLEGAL_Event()
2 = RESUME 3 AJ_lvError_ILLEGAL_Event()
3 = STOP_RECORDING 6 = SAVE_MOVIE_TO_CF AJ_LV_create_task_class()
4 = FACE DETECT
3 = READY_TO_RECORD AJ_lvError_ILLEGAL_Event()
5 = START_RECORDING 2 = RECORDING AJ_calls_PROP_LIVE_VIEW_VIEWTYPE_SELECT()
6 = SUSPEND 4 = SUSPENDED AJ_LVREC_Send_MVR_EV_RECSUSPEND()

.

Current_state = 4 = SUSPENDED

input

Next

State

Next

Sub()

0 4 AJ_lvError_ILLEGAL_Event()
1 = STOP 0 = INITIAL AJ_LVREC_LV_is_already_stopped_n_MovieRecorder_StateMachine()
2 = RESUME 4 AJ_lvError_ILLEGAL_Event()
3 = STOP_RECORDING 6 = SAVE_MOVIE_TO_CF AJ_LVREC_lvIllegalStop()
4 = FACE DETECT
4 AJ_lvError_ILLEGAL_Event()
5 = START_RECORDING 4 AJ_lvError_ILLEGAL_Event()
6 = SUSPEND 4 AJ_lvError_ILLEGAL_Event()

.

Current_state = 5 = TAKE_PHOTO (ie in the middle of a Movie)

input

Next

State

Next

Sub()

0 5 AJ_lvError_ILLEGAL_Event()
1 = STOP 1 = STOPPED? AJ_LVREC_lvCompleteThumbnail()
2 = RESUME 3 = READY_TO_RECORD AJ_calls_AJ_JudgeStartLV_n_LVREC_send_MVR_EV_RecRESUME()
3= RECORD_BUTTON 5 AJ_lvError_ILLEGAL_Event()
4 = FACE DETECT
5 AJ_lvError_ILLEGAL_Event()
5 = START_RECORDING 5 AJ_lvError_ILLEGAL_Event()
6 = SUSPEND 4= SUSPENDED AJ_LVREC_Send_MVR_EV_RECSUSPEND()

.

Current_state = 6 = SAVE MOVIE TO CF (in this state before returning to state 0).

input

Next

State

Next

Sub()

0 6 AJ_lvError_ILLEGAL_Event()
1 = STOP 1 = STOPPED? AJ_LVREC_lvCompleteThumbnail()
2 = RESUME 6 AJ_lvError_ILLEGAL_Event()
3= STOP_RECORDING 6 AJ_lvError_ILLEGAL_Event()
4 = FACE DETECT
6 AJ_lvError_ILLEGAL_Event()
5 = START_RECORDING 6 AJ_lvError_ILLEGAL_Event()
6 = SUSPEND 6 AJ_lvError_ILLEGAL_Event()

.

Advertisement