camera driver 7.5 final version for w200i


setingannya

// Sony Ericsson CamDriver Version 7.5 final by BrAzUkA´s for w200
// Version 7.5 final BrAzUkA´s
// Optimized for the Sony Ericsson W200 ** Works w200 **
// Some codes and properties from Chegrong and Raiderski's Super Cam Driver
// Many of the functions and properties are limited but the enhanced codes
// very probably that the chip is the great inhibitor.
// Thanks to Alex Herdea and Daniel Vlad by providing service to the test drivers
// for being helpful and thanks for all the repeated tests and the great patients
// to always be telling us of something that happens
// in the driver, for the serve explanation of how the programs are calculated
// and tell us something in the history of photography.
// Thanks to all involved in one way or another in search of the evolution and
// in one way or another everyone who participated, colaborated also part of this project
// always looking to help people in search of development.
//=========================================================
//Revision history
//=========================================================
//
// 1.6 Set all GPIO pins as output before setting them high or low.
// 1.7 General clean up. Properties and new vf resulution added
// 2.0 First release for Wilma only, all properties added
// 2.7 Power off sequence changed according to Mika Sipola's explanation.
// 2.8 New LCM implemented for the Largan lens.
// 2.9 Framerate settings changed or implemented.
// 3.0 Corrected LCM. New CCM implemented.
// Added Autoframerate (26/13 fps)
// Added Normal and Dark Mode in PROP 7 only
// Added Sequencer snapshot scheme, removed context switch scheme.
// Added Autoframerate (14.645 / 14.645) no skip
// 3.1 #WRITE_CONTROL(CD 21A7)==> #WRITE_CONTROL(CD 2187) blank frames enabled
// 3.2 Corrections made to make blanked frames to work. Among other things
// remove all #WRITE_CONTROL(CD 21A7)and only have #WRITE_CONTROL(CD 2187)
// in Frame_Rate_Auto.
// 3.3 Add AWB in init to test if problem with whitebalance in FaceWarp was solved
// 3.4 AWB in init removed (didn't work the way it was intented). Clock in viewfinder
// changed to 13 MHz, necessary changes for this switch implemented as well.
// The delay when toggling AE shortened to 100 ms. AE-target changed from 0C35 to
// 0C4A (default). External flash support implemented and working. New gamma settings.
// 3.5 New CCM implemented (still a bit to "pale colours" but the US CCM gives yellow skin tone).
// Flash fire limit increased.
// 3.6 Window of interest for videomode 176x144 corrected to not give wrong proportions.
// 3.7 Color problem (pinkish image) in Video mode fixed by adding #WRITE_IFP(05 000C) // APERTURE_GA
// 3.8 In seq_set_prop_a_2 the ouput size and aspect ratio wrtings added to solve problem in ITP.
// This change only affects the ITP since SSW don't use seq_set_prop_a_2
// 3.9 The instruction "#WRITE_CONTROL(1E 004D) //DELTA_MATRIX_COEF_D9// Colour correction on" in the
// colour removed since it was misplaced and sometimes caused a colourflickering in the ITP
// (but not in the SSW). Registers 0x222 and 0x223 (camera control registers) changed from FF00 to
// A078 after recommendation from Micron.
// 4.0 Out-commentation of Brightness property 0 removed.
// New Versions:
// 1.1 Version by BrAzUkA´s
// 1.3 Version by BrAzUkA´s
// 1.5 Version by BrAzUkA´s
// 1.8 Version by BrAzUkA´s
// 2.1 Version by BrAzUkA´s
// 2.5 Version by BrAzUkA´s
// 2.85 Version by BrAzUkA´s
// 3.25 Version by BrAzUkA´s
// 3.5 Version by BrAzUkA´s
// 7.5 Version by BrAzUkA´s
//
// All versions from v1.1 BrAzUkA´s to v2.1 hybrid final BrAzUkA´s versions with different schedules and functions of the original driver.
// All versions since v2.85 BrAzUkA´s v3.25 BrAzUkA´s v3.5 BrAzUkA´s the properties and functions respond to hardware with its due limitation
//
// Reason for version v7.5 because the version 4.0 original of w200 added to the 3.5 versions
// based on the series w and k cibershot concluding the final version 7.5
//
// Based on version original driver cam W200 and based drivers Series W and K Cibershot
// Macro High Quality mode =Normal Mode/Nigth Mode (slightly more exposure for better low light shots)
// Auto focus
//
// Macro + Night Mode™ = Night Mode™ (longer exposure, very low noise)
// Auto focus (as described above)
//
// Normal mode = Quicker Enhanced Mode, less chance of a blur
// Fine Mode = Slower Enhanced Mode (longer exposure)
//
// New Exposure/Exhibition= Restart the cam for the new environment and the new exhibition
//
// ******************************************************************************
// Thanks to Chegrong & Raiderski's & Sarmad's & Kriomag & Paparazy & Alex & Ursa
// ******************************************************************************
//
// Video recording:
// High Quality=15fps to 20fps
// Low Quality=20fps to 30fps
// Normal Mode™ Dayligth=15fps
// Nigth Mode™=10fps to 15fps
// Normal 15fps to 20fps, Night 10fps to 15fps
// Normal mode has same Zoom
// Normal mode with Macro White Balance quality
// EnhancedNight™ mode has Auto Focus Not valid for w200 MT9V112
//
// Added properties:
// New Power sequence™ on/off with new Master Clock™ for w200
// Automatic mode
// Night Mode™ Adjust (Button 2 Two Keyboard)
// Color Correction™
// Standby Cam
// Hue Mode
// JPEG buffer 1280x960 BrAzUkA´s Snapshot™ interpol 1,2MB Mode Expanded
// Saturation Stable
// EnhancedNight™ Video
// More Reduction Noise
// Spot Mode ON (Brightness base of the center) Adjust(+/-)Volume
// SuperColor™ Scene Fly Clarity Super Color™ Mode
// New Sequence Brightness
// Shutter speed™
// New Zoom property
// Master Clock™ for w200
// Brightness adjust EV plus daylight and night to change value Adjust(+/-)Volume
// New White Balance™ High Quality
// Effects-Scenes™ Support w200 Adjust (Button 3 Three Keyboard)
// Scenes support w200:
// -Auto Mode
// -Landscape Mode
// -Fly Clarity Super Color™ Mode
// -Clear sky Mode
// -Portrait Mode
// Incredible Photo metering
// More Sharpening and stable
// Contrast stable
// Auto Framerate Flash
// Auto Exposure™ and Max Manual Exposure™ Sometimes Restart the camera for a new reading of exposure
// Max Manual Exposure™ Adjust EV(+/-)
//=========================================================
//Information section
//=========================================================

info_name=MT9V112;
info_vendor=BrAzUkA;
info_major_ver=7;
info_minor_ver=5;

//Camera characteristics section:

//=========================================================
//Power on sequence
//=========================================================


cam_power_on_0 = 5, 0, 0, 1, 5; // Pull RST pin and wait 5 ms
cam_power_on_1 = 5, 1, 12, 1, 0; // Set GPIO 12 as output (VDD_SA, VDD_IO 2.7V; VDD_AF 2.7V)
cam_power_on_2 = 5, 2, 12, 0, 5; // Set GPIO 12 low and wait 5 ms
cam_power_on_3= 5, 3, 0, 32c8,5; // Enable clock, 13 MHz clock on
cam_power_on_4 = 5, 0, 0, 0, 1F4; // Release RST pin and wait 500 ms

cam_power_i2c_0 = $f FE 00 $f 04 00 00; // Camera will enter Sleep state by setting Control register to zero.

//=========================================================
//Power off sequence
//=========================================================

cam_power_off_0= 5, 1, 12, 1, 0; // Set GPIO 12 as output
cam_power_off_1= 5, 2, 12, 1, 5; // Set GPIO 12 high
cam_power_off_2= 5, 3, 1, 0, 0; // Disable Turn off clock
cam_power_off_3= 5, 2, 12, 0, 0; // Standby low

//=============================
// BrAzUkA´s Master Clock™ w200
//=============================
//Frequency of Master Clock = 2*Frequency of Pixel Clock

cam_i2c_address=5D; //Micro Sensor
cam_i2c_clock_freq=6978; //27Mhz Master Clock™ for w200
cam_vf_clock_freq=0,5DC0; //24MHz Master Clock™ for w200
cam_ss_clock_freq=0,32C8; //13MHz Master Clock™ for w200
cam_ss_clock_freq_d=0,5DC0; //24 MHz yuv-mode Master Clock™ for w200
cam_init_result=;
cam_data_offset=0;
cam_vf_format=B100;
cam_ss_format=B100; //Picture format set to JPEG
cam_ss_sync=5; //Set to 0x0F instead of 0x05 and Mulan use 7, Doris use 5
cam_vf_sync=5; //Mulan use 7, Doris use 5
cam_ss_sync_d=05;
cam_ss_retries=3; //The number of times to retry taking a snapshot

//-- JPEG buffer sizes Fix BrAzUkA´s (only used for ITP)

cam_ss_jpeg_buf_size_1 = 80D40; // 528KB buffer for 640 x 480 snap
cam_ss_jpeg_buf_size_2 = 1E000; // 123KB buffer for 320 x 240 snap
cam_ss_jpeg_buf_size_3 = 7800; // 31KB buffer for 160 x 120 snap
cam_ss_jpeg_buf_size_4 = 1E00; // 8KB buffer for 100 x 60 snap
cam_ss_jpeg_buf_size_5 = 9600; // 38KB buffer for 640 x 480 snapshot
cam_ss_jpeg_buf_size_6 = 61A80; // 400KB buffer for 1280x 960 snapshot

//===========================
//Operating Power Consumption
//===========================
//VAA = 2.8V
//VAAPIX = 2.8V
//fCLKIN = 27 MHz (50% duty cycle)
//Ta = 30 °C
//Light Condition = 90 lux
//Mode fps Definition:VGA 30 fps
// (VDD,VDDQ = 2.8V) (VDD,VDDQ = 1.8V)
//Operating IDD 15 25 9 16 mA
//Operating IAA 19 22 19 22 mA
//Operating IDDQ 11 30 5 17 mA
//Operating IAAPIX 1 1 1 1 mA
//
//VGA 30 fps Total power consumption w/o IDDQ 98 136 72 94 mW

// ==================== Version ====================
// Major version stored in internal register 7
// Minor version stored in internal register .5
//==================================================

seq_get_prop_0 = $s1 04 $s0 00; // Version: 7.5

//=========================================================
//Support resolution
//=========================================================

sup_sizes=
// CAPTURE MODE
1[280,1E0,0], // SS 640 x 480 VGA
2[140,F0,0], // SS 320 x 240 QVGA
3[A0,78,0], // SS 160 x 120 QVGA
4[64,3C,0], // SS 100 x 60
5[280,1E0,0], // SS 640 x 480 Snapshot VGA in UYV422
6[500,3C0,0], // SS 1280x 960 Snapshot™ interpol 1,2MB Mode Expanded
7[280,1E0,0], // SS 640 x 480 Snapshot VGA in UYV422

// VF MODE DRAFT MODE

20[80,60,5DC], // VF 128x96
22[80,60,5DC], // VF 128x96
23[B0,90,03E8], // VF 176x144
24[B0,90,02EE], // VF 176x144
25[80,66,05DC], // VF 128x102
26[80,60,05DC], // VF 128x96
27[80,60,05DC], // VF 128x96
21[80,A0,5DC], // VF 128x160
30[50,3C,5DC], // VF 80x60
31[50,65,5DC], // VF 80x101


// VR MODE


41[80,60,3E8], // 128 x 96 Normal mode Viewfinder Video record SQCIF 10fps
42[B0,90,3E8], // 176 x 144 Normal mode Viewfinder Video record QCIF 10fps
43[80,60,2EE], // 128 x 96 Nigth mode Viewfinder Video record SQCIF 10fps
44[B0,90,2EE], // 176 x 144 Nigth mode Viewfinder Video record QCIF 10fps

;

//=========================================================
// Support Properties:
//=========================================================

//=========================================================
//Properties:
// 0 = Exposure Implemented
// 1 = White balance Implemented
// 2 = Flicker Implemented
// 3 = Vertical mirror Implemented
// 4 = Horisontal mirror Implemented
// 5 = JPEG Compression level Implemented
// 6 = Zoom Implemented
// 7 = Night mode Implemented
// 8 = Effect Implemented
// 9 = Focus mode Not valid for w200 MT9V112
// a = Focus operation Not valid for w200 MT9V112
// b = Exif (Read only) Implemented
// c = Qtable info (Read only) Implemented
// d = LED support Implemented
// e = Flash support Implemented for w200
// f = Power save mode Implemented
// 10 = Scene Not valid for w200 MT9V112
// 11 = ISO Implemented
// 12 = Auto exposure Implemented
// 13 = Brightness Implemented
// 14 = Contrast Implemented
// 15 = Sharpening Implemented
// 16 = ITP focus test Not valid for w200 MT9V112
// 17 = Spot Implemented
// 18 = Image Stable Implemented
// 19 = Half release Not valid for w200 MT9V112
// 20 = Snapshot operation interpol 1,2MB Implemented
// 21 = Snapshot with Flash Implemented

sup_properties =0[0,15,9],1[0, F,9],2[0, 4,0],3[0, 3,0],
4[0, 1,0],5[0, 1,0],6[a,28,a],7[0, 1,0],
8[0, 4,0],9[0,4,0],a[0, 2,0],b[0,4,0],
c[0,ff,0],d[0,1,0],e[0,2,0],f[0,1,0],
10[0,7,0],11[0,d,0],12[0,ff,0],13[0,15,7],
14[0,16,8],15[0,16,8],18[0,7,0],1e[0,1F,0];

//=========================================================
// MACROS to write registers of MT9V112
//=========================================================

CMD_END=$f $d0005;


WRITE_SENSOR = $a5d F0 00 00 $f !0 $f;
READ_SENSOR = $a5d F0 00 00 $f !0 $f;
WRITE_IFP = $a5d F0 00 01 $f !0 $f;
READ_IFP = $a5d F0 00 01 $f !0 $f;
WRITE_CONTROL = $a5d F0 00 02 $f !0 $f;
READ_CONTROL = $a5d F0 00 02 $f !0 $f;


// Only send command, no reply is read out
COMMAND = 06 02 00 01 !1 !0 $f $r3 012 $d0005;

// Waits for signal on TRIG, and clear the event register when it has arrived
CAPTURE_EVENT = #WAIT_FOR_TRIG #CLEAR_EVENT;

// This sends a command and waits for reply
// In most cases this is the command that should be used, isn't it?
COM_EVENT = #CLEAR_EVENT_FIFO
#CLEAR_EVENT
#COMMAND(!0,!1)
#WAIT_FOR_TRIG
#CLEAR_EVENT;

// Used to change mode, TRIG is not used, instead event register is polled.
CHANGE_MODE = #CLEAR_EVENT_FIFO
#SET_REG(06,03)
#COMMAND(!0,!1)
#WAIT_FOR_MODE
#SET_REG(06,03);


// Used where HALF_RELEASE should be done
HALF_RELEASE =
$"Half-release"
#CLEAR_EVENT_FIFO
#SET_REG(06,03)
#COMMAND(31,02) //No AF, AE hold, ACC locked
#WAIT_FOR_HALF_RELEASE
#SET_REG(06,03);

REGISTER_READ = !0 $r2 0 1 $f; // read 2 byte from cam reg !0 into internal 0 and 1

REGISTER_MODIFY =
!0 $r2 0 1 $f // Read from CamReg !0 (2 Bytes) to Internal Reg 0, 1
!1 // Do !1 sequence
$f !0 $w0 $w1 $f// Write to CamReg !0 (2 Bytes) from Internal Reg 0, 1
;

seq_ping = #SET_PAGE_SENSOR #REGISTER_READ(00); // read Chip Version
cam_ping_result = 12, 29;


//===============================================================
// SEQUENCE BrAzUkA´s Super Cam Driver Super Color™ for w200
//===============================================================

READ_AF_STATUS=05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $d0005 05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $d0005 05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $d0005 05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $d0005 05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $d0005 05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $d0005 05 01 00 03 03 $f$r4 4 4 4 5
$c5 E6 $cl $s4 01

$cx$cx$cx$cx$cx$cx$cx;

READ_JPEG_STATUS=05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $d0005 05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $d0005 05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $d0005 05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $d0005 05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $d0005 05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $d0005 05 01 00 03 03 $f $r4 4 4 4 5
$c5 E3 $cl $s4 01
$cx $cx $cx $cx $cx $cx $cx;


WAIT_FOR_POWER_SAVE_LEAVE=05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0064 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0064 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0064 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0064 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0100 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0100 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0100 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ec $cl $d0200 05 01 00 03 03 $f$r4 1 1 2 3

$cx$cx$cx$cx$cx$cx$cx$cx$cx$cx$
$cx$cx$cx$cx$cx$cx$cx$cx$cx$cx;



WAIT_FOR_POWER_SAVE_ENTER=05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0010 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0010 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0010 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0010 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0010 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0020 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0040 05 01 00 03 03 $f$r4 1 1 2 3
$c3 ed $cl $d0064 05 01 00 03 03 $f$r4 1 1 2 3

$cx$cx$cx$cx$cx$cx$cx$cx$cx$cx$
$cx$cx$cx$cx$cx$cx$cx$cx$cx$cx;

#GET_SENSOR_VERSION;

GET_SENSOR_VERSION=05 01 00 36 01 $f $r2 0 0
$c0 00 05 01 00 36 01 $f $r2 0 0
$c0 00 05 01 00 36 01 $f $r2 0 0
$>0 7 $c0 01 $sf 01
$cl $sf 00 $cx
$cl $>0 7 $c0 01 $sf 01
$cl $sf 00 $cx $cx
$cl $>0 7 $c0 01 $sf 01
$cl $sf 00 $cx $cx;


SM_MANUAL_FOCUS_STATUS=$m0 a $b0 00 0 1 $b0 00 2 6;

SM_CHANGE_FOCUS=$s0 %0 $c0 0a
06 02 00 01 00 43 #CMD_END
$ba 00 1 1
$cl
$-0 08 06 02 00 01 $w0 43 #CMD_END
$ba 01 1 1
$cx;

ADVANCED_ZOOM=$s0 %0 $p1 07
$c1 00
$c0 0a
06 02 00 01 80 61 #CMD_END
$cl
$s0 2a $-0 %0 $*0 02 $+0 80 06 02 00 01 $w0 61 #CMD_END
$z1
$c1 21 $cl
$c1 22 $cl
$c1 23 $cl
$c1 24 $cl
$c0 0a
06 02 00 01 00 61 #CMD_END
$cl
$s0 0a $<0 6 $s1 %0 $>1 1 $+0 r1 $/0 %0 06 02 00 01 $w0 61 #CMD_END
$cx
$cx
$cx
$cx
$cx
$cx
$cl
$c0 0a
06 02 00 01 00 61 #CMD_END
$cl
$s0 0a $<0 6 $s1 %0 $>1 1 $+0 r1 $/0 %0 06 02 00 01 $w0 61 #CMD_END
$cx
$cx;

LedEM= $p1 07
$c1 01
05 01 00 23 01 $f $r2 1 1
$m0 1 $/0 28
$c0 00
$m0 1 $/0 03
$c0 00
$cl
$c8 00
$s0 3a $-0 r1
$cl
$s0 3e $-0 r1
$cx
06 02 00 01 $w0 04 #CMD_END
$cx
$cx
$cl
05 01 00 23 01 $f $r2 1 1
$m0 1 $/0 28
$c0 00
$m0 1 $/0 03
$c0 00
$cl
$c8 00
$s0 3b $-0 r1
$cl
$s0 40 $-0 r1
$cx
06 02 00 01 $w0 04 $f $d0005
$cx
$cx
$cx;

EM= $p1 0d
$c1 00
$p1 0e
$c1 00
05 01 00 23 01 $f $r2 1 1
$m0 1 $/0 28
$c0 00
$m0 1 $/0 03
$c0 00
$cl
$c8 00
$s0 3b $-0 r1
$cl
$s0 40 $-0 r1
$cx
06 02 00 01 $w0 04 $f $d0005
$cx
$cx
$cx
$cx;


DEFAULT_SHOT= $c7 00
$s7 01
#EMPTY_EVENT_FIFO
#COLOR_COR
$z0 $-0 re
$c0 00
06 02 00 01 01 01 #CMD_END
$cl
$p0 0d
$c0 01
$p0 01
$c0 00
#LedEM
$cx
$cx
06 02 00 01 01 $ze
$ce 09 33 $cl 32 $cx $f
#WAIT_FOR_MODE_TRANSITION
#WAIT_FOR_CAPT_START
$cx
$t0020
$cx;

ENHANCED_SHOT=$c7 00
$s7 01
#EMPTY_EVENT_FIFO
#COLOR_COR
$z0 $-0 re
$c0 00
06 02 00 01 01 01 #CMD_END
$cl
$p0 0d
$c0 01
#LED_WB_SET
#LedEM
$cx
#EM
06 02 00 01 01 $ze
$ce 09 33 $cl 32 $cx $f
#WAIT_FOR_MODE_TRANSITION
#WAIT_FOR_CAPT_START
$cx
$t0020
$cx;

SM_LOCK_AE= $z1
$c1 21
$cl
$c1 22
$cl
$c1 23
$cl
$c1 24
$cl
$p1 0d
$c1 00
$p1 0e
$c1 00
06 02 00 01 01 01 #CMD_END
$cx
$cx
$cx
$cx
$cx
$cx;

SM_UNLOCK_AE= 06 02 00 01 00 01 #CMD_END;

//------------------------------------------------------------------------------------------
//These two lines controls the locked frame rate in VR.
//Use them to test different settings!
//The value entered is the desired frame rate * 4.
//Example: 3C means 0x3C = 60 => frame rate 60 / 4 = 15 fps
//Support W200
VR_NORMAL_MODE_FR=60;//24fps Fix BrAzUkA´s
VR_NIGHT_MODE_FR=38;//14fps Fix BrAzUkA´s
//------------------------------------------------------------------------------------------

//==========================================================================================
//*** Camera Control Registers Initial Sequence Super Cam Driver Fix BrAzUkA´s for w200***
//==========================================================================================
#WRITE_CONTROL(02 00AE) //BASE_MATRIX_SIGNS
#WRITE_CONTROL(03 3923) //BASE_MATRIX_SCALE_K1_K5
#WRITE_CONTROL(04 0724) //BASE_MATRIX_SCALE_K6_K9
#WRITE_CONTROL(09 00B1) //BASE_MATRIX_COEF_K1
#WRITE_CONTROL(0A 0091) //BASE_MATRIX_COEF_K2
#WRITE_CONTROL(0B 005B) //BASE_MATRIX_COEF_K3
#WRITE_CONTROL(0C 005F) //BASE_MATRIX_COEF_K4
#WRITE_CONTROL(0D 00DA) //BASE_MATRIX_COEF_K5
#WRITE_CONTROL(0E 0029) //BASE_MATRIX_COEF_K6
#WRITE_CONTROL(0F 0010) //BASE_MATRIX_COEF_K7
#WRITE_CONTROL(10 006D) //BASE_MATRIX_COEF_K8
#WRITE_CONTROL(11 00DF) //BASE_MATRIX_COEF_K9
#WRITE_CONTROL(15 0049) //DELTA_COEF_SIGNS
#WRITE_CONTROL(16 0017) //DELTA_MATRIX_COEF_D1
#WRITE_CONTROL(17 0011) //DELTA_MATRIX_COEF_D2
#WRITE_CONTROL(18 002E) //DELTA_MATRIX_COEF_D3
#WRITE_CONTROL(19 0034) //DELTA_MATRIX_COEF_D4
#WRITE_CONTROL(1A 0003) //DELTA_MATRIX_COEF_D5
#WRITE_CONTROL(1B 003E) //DELTA_MATRIX_COEF_D6
#WRITE_CONTROL(1C 004D) //DELTA_MATRIX_COEF_D7
#WRITE_CONTROL(1D 005A) //DELTA_MATRIX_COEF_D8
#WRITE_CONTROL(1E 006C) //DELTA_MATRIX_COEF_D9
#WRITE_CONTROL(1F 00A0) //DELTA_MATRIX_COEF_D10
#WRITE_CONTROL(20 C814) //LUM_LIMITS_WB_STATS
#WRITE_CONTROL(21 8080) //R_B_GAIN_MANUAL_WB
#WRITE_CONTROL(22 A078) //AWB_RED_LIMIT
#WRITE_CONTROL(23 A078) //AWB_BLUE_LIMIT
#WRITE_CONTROL(24 7F00) //MATRIX_ADJ_LIMITS
#WRITE_CONTROL(26 8000) //Auto Exposure Horizontal_AE
#WRITE_CONTROL(27 8008) //Auto Exposure Vertical_AE
#WRITE_CONTROL(28 EA02) //AWB_ADVANCED_CONTROL_REG
#WRITE_CONTROL(29 867A) //AWB_WIDE_GATES
#WRITE_CONTROL(2A 00D0) //COLORCorr_AWB
#WRITE_CONTROL(2B 6020) //Auto Exposure Horizontal_AE
#WRITE_CONTROL(2C 6020) //Auto Exposure Vertical_AE
#WRITE_CONTROL(2D F0A0) //COLORCorr_AWB
#WRITE_CONTROL(2E 0C4A) //Auto Exposure target and Precision Control_AE
#WRITE_CONTROL(2F DF20) //Auto Exposure Speed and Sensitivity Control—Context_A_AE
#WRITE_CONTROL(F5 0040) //DELTA_MATRIX_COEF_D11
#WRITE_CONTROL(F6 007F) //DELTA_MATRIX_COEF_D12
#WRITE_CONTROL(FF A880) //DELTA_MATRIX_COEF_D13
#WRITE_CONTROL(5E 5F49) //RATIO_BASE_REG
#WRITE_CONTROL(5F 3A22) //RATIO_DELTA_REG
#WRITE_CONTROL(60 0002) //SIGNS_DELTA_REG
#WRITE_CONTROL(EF 0008) //AWB_FLASH_ADV_CONTROL
#WRITE_CONTROL(F2 0000) //AWB_R_B_GAIN_OFFSETS
#WRITE_CONTROL(33 146E) //AE_GAIN
#WRITE_CONTROL(36 7810) //AE_GAIN
#WRITE_CONTROL(37 0300) //AE_GAIN
#WRITE_CONTROL(38 0440) //AE_GAIN
#WRITE_CONTROL(39 06A6) //AE_GAIN
#WRITE_CONTROL(3A 06A6) //AE_GAIN
#WRITE_CONTROL(3B 055B) //AE_GAIN
#WRITE_CONTROL(3C 055B) //AE_GAIN
#WRITE_CONTROL(3D 17D9) //AE_GAIN
#WRITE_CONTROL(3E 1CFF) //AWB_GAIN
#WRITE_CONTROL(46 D900) //AE_GAIN
#WRITE_CONTROL(57 01D6) //AE_GAIN
#WRITE_CONTROL(58 0234) //AE_GAIN
#WRITE_CONTROL(59 01D6) //AE_GAIN
#WRITE_CONTROL(5B 0002) //FLICK_CONTROL_FD
#WRITE_CONTROL(5C 100C) //FLICK_CONTROL_FD
#WRITE_CONTROL(5D 1510) //FLICK_CONTROL_FD
#WRITE_CONTROL(61 8080) //COLOR_Corr
#WRITE_CONTROL(62 1010) //Auto Exposure Digital Gains Monitor_AE
#WRITE_CONTROL(64 59FC) //COLOR_Corr
#WRITE_CONTROL(67 4010) //Auto Exposure Digital Gain Limits_AE
#WRITE_CONTROL(68 0011) //COLOR_Corr
#WRITE_CONTROL(82 03FC) //AE_GAIN
#WRITE_CONTROL(83 0301) //AE_GAIN
#WRITE_CONTROL(84 00C1) //AE_GAIN
#WRITE_CONTROL(85 03A1) //AE_GAIN
#WRITE_CONTROL(86 03D4) //AE_GAIN
#WRITE_CONTROL(87 03D7) //AE_GAIN
#WRITE_CONTROL(88 0399) //AE_GAIN
#WRITE_CONTROL(89 03F8) //AE_GAIN
#WRITE_CONTROL(8A 001C) //AE_GAIN
#WRITE_CONTROL(8B 03BD) //AE_GAIN
#WRITE_CONTROL(8C 03DB) //AE_GAIN
#WRITE_CONTROL(8D 03BD) //AE_GAIN
#WRITE_CONTROL(8E 03FC) //AE_GAIN
#WRITE_CONTROL(8F 03DE) //AE_GAIN
#WRITE_CONTROL(90 03DE) //AE_GAIN
#WRITE_CONTROL(91 03DE) //AE_GAIN
#WRITE_CONTROL(92 03DE) //AE_GAIN
#WRITE_CONTROL(93 001F) //AE_GAIN
#WRITE_CONTROL(94 0041) //AE_GAIN
#WRITE_CONTROL(95 0363) //AE_GAIN
#WRITE_CONTROL(98 00FF) //COLOR_Corr
#WRITE_CONTROL(99 0001) //COLOR_Corr
#WRITE_CONTROL(9C DF20) //Auto Exposure Speed and Sensitivity—Context_B_AE
#WRITE_CONTROL(B4 0020) //COLOR_Corr
#WRITE_CONTROL(CD 21A0) //CntxCtl_Correction
#WRITE_CONTROL(CE 1E9B) //CntxCtl_Correction
#WRITE_CONTROL(CF 4A4A) //CntxCtl_Correction
#WRITE_CONTROL(D0 168D) //CntxCtl_Correction
#WRITE_CONTROL(D1 004D) //CntxCtl_Correction
#WRITE_CONTROL(D2 0000) //CntxCtl_Correction
#WRITE_CONTROL(D3 0000) //CntxCtl_Correction
#WRITE_CONTROL(D4 0208) //CntxCtl_Correction
#WRITE_CONTROL(D5 0000) //CntxCtl_Correction
#WRITE_CONTROL(EF 0008) //AWB
#WRITE_IFP(06 700E) //Operating Mode Control
#WRITE_IFP(08 0080) //Output Format Control
#WRITE_IFP(25 0005) //Color Saturation Control
#WRITE_IFP(34 0010) //LUMA_OFFSET
#WRITE_IFP(35 F010) //LUMA_CLIP
#WRITE_IFP(3A 0200) //Output Format Control 1 (R/W)
#WRITE_IFP(48 0000) //Test Pattern Generator control (R/W)
#WRITE_IFP(99 0000) //Line Counter (R/O)
#WRITE_IFP(9A 0000) //Frame Counter (R/O)
#WRITE_IFP(9B 0200) //Output Format Control 2 (R/W)
#WRITE_IFP(A1 0280) //Reducer Horizontal Output Size (R/W)
#WRITE_IFP(A4 01E0) //Reducer Vertical Output Size (R/W)
#WRITE_IFP(A5 0000) //Reducer Horizontal Pan Resize (R/W)
#WRITE_IFP(A6 0280) //Reducer Horizontal Zoom Resize (R/W)
#WRITE_IFP(A7 0140) //Reducer Horizontal Output Size Resize—Context A (R/W)
#WRITE_IFP(A8 0000) //Reducer Vertical Pan Resize (R/W)
#WRITE_IFP(A9 01E0) //Reducer Vertical Zoom Resize (R/W)
#WRITE_IFP(AA 00F0) //Reducer Vertical Output Size Resize—Context A (R/W)
#WRITE_IFP(AB 0280) //Reducer Current Horizontal Zoom (R/O)
#WRITE_IFP(AC 01E0) //Reducer Current Vertical Zoom (R/O)
#WRITE_IFP(AE 0C09) //Reducer Zoom Step Size (R/W)
#WRITE_IFP(AF 0000) //Reducer Zoom Control (R/W)
#WRITE_IFP(C8 0000) //Global Context Control (R/W)
#WRITE_IFP(E2 7000) //Effects Mode (R/W)
#WRITE_IFP(E3 B023) //Effects Sepia (R/W)
#WRITE_IFP(26 8000) //Auto Exposure Horizontal Window Boundaries (R/W)
#WRITE_IFP(27 8008) //Auto Exposure Vertical Window Boundaries (R/W)
#WRITE_IFP(2B 6020) //Auto Exposure Horizontal Center Window Boundaries (R/W)
#WRITE_IFP(2C 6020) //Auto Exposure Vertical Center Window Boundaries (R/W)
#WRITE_IFP(2D F0A0) //AWB Window Boundaries (R/W)
#WRITE_IFP(2E 0C4A) //Auto Exposure target and Precision Control (R/W)
#WRITE_IFP(2F DF20) //Auto Exposure Speed and Sensitivity Control—Context A (R/W)
#WRITE_IFP(5B 0002) //Flicker Control (R/W)
#WRITE_IFP(62 1010) //Auto Exposure Digital Gains Monitor (R/W)
#WRITE_IFP(67 4010) //Auto Exposure Digital Gain Limits (R/W)
#WRITE_IFP(9C DF20) //Auto Exposure Speed and Sensitivity Control—Context B (R/W)
#WRITE_IFP(C8 0000) //Global Context Control (R/W)
$d01F4 //Wait500 ms delay for both Colour correction and PIXEL_ROW_NOISE_REDUCTION
#WRITE_CONTROL(3D 17DD)
#WRITE_SENSOR(5F 3630)
#WRITE_SENSOR(30 043E)
#WRITE_IFP(3B 043E)
#WRITE_CONTROL(2E 0000)
$d0064//delay 100 ms
#WRITE_CONTROL(2E 0C4A)
#WRITE_SENSOR(34 C019)
#WRITE_SENSOR(40 1800)
#WRITE_SENSOR(76 7358)
#WRITE_SENSOR(04 0282)
#WRITE_SENSOR(03 01E2)
#WRITE_IFP(A0 0282)
#WRITE_IFP(A3 01E2)
#WRITE_IFP(A6 0282)
#WRITE_IFP(A9 01E2)
#WRITE_IFP(06 $f $r2 0 1 $b0 01 7 1 06 $w0 $w1) //enable Manual White Balance
#WRITE_IFP(06 $f $r2 0 1 $b0 00 7 1 06 $w0 $w1) //Disable the Manual White Balance
#WRITE_IFP(05 0003) //Aperture Correction APERTURE_GAIN (sharpening adjusting)
#WRITE_IFP(06 $f $r2 0 1 $b0 01 2 1 06 $w0 $w1) //enable the lens correction
#WRITE_IFP(80 0003) //LENS_CORRECT_CONTROL
#WRITE_IFP(81 D606) //LENS_ADJ_VERT_RED_0
#WRITE_IFP(82 EFF2) //LENS_ADJ_VERT_RED_1_2
#WRITE_IFP(83 02FA) //LENS_ADJ_VERT_RED_3_4
#WRITE_IFP(84 E804) //LENS_ADJ_VERT_GREEN_0
#WRITE_IFP(85 F4F5) //LENS_ADJ_VERT_GREEN_1_2
#WRITE_IFP(86 03FC) //LENS_ADJ_VERT_GREEN_3_4
#WRITE_IFP(87 E303) //LENS_ADJ_VERT_BLUE_0
#WRITE_IFP(88 F7F6) //LENS_ADJ_VERT_BLUE_1_2
#WRITE_IFP(89 03FE) //LENS_ADJ_VERT_BLUE_3_4
#WRITE_IFP(8A D70A) //LENS_ADJ_HORIZ_RED_0
#WRITE_IFP(8B E8E1) //LENS_ADJ_HORIZ_RED_1_2
#WRITE_IFP(8C FCF5) //LENS_ADJ_HORIZ_RED_3_4
#WRITE_IFP(8D 0002) //LENS_ADJ_HORIZ_RED_5
#WRITE_IFP(8E E207) //LENS_ADJ_HORIZ_GREEN_0
#WRITE_IFP(8F EDE8) //LENS_ADJ_HORIZ_GREEN_1_2
#WRITE_IFP(90 FDF8) //LENS_ADJ_HORIZ_GREEN_3_4
#WRITE_IFP(91 0002) //LENS_ADJ_HORIZ_GREEN_5
#WRITE_IFP(92 DD07) //LENS_ADJ_HORIZ_BLUE_0
#WRITE_IFP(93 EEE9) //LENS_ADJ_HORIZ_BLUE_1_2
#WRITE_IFP(94 FFF9) //LENS_ADJ_HORIZ_BLUE_3_4
#WRITE_IFP(95 0000) //LENS_ADJ_HORIZ_BLUE_5
#WRITE_IFP(B6 140B) //LENS_ADJ_VERT_RED_5_6
#WRITE_IFP(B7 4A19) //LENS_ADJ_VERT_RED_7_8
#WRITE_IFP(B8 100A) //LENS_ADJ_VERT_GREEN_5_6
#WRITE_IFP(B9 7F12) //LENS_ADJ_VERT_GREEN_7_8
#WRITE_IFP(BA 130C) //LENS_ADJ_VERT_BLUE_5_6
#WRITE_IFP(BB 2D1A) //LENS_ADJ_VERT_BLUE_7_8
#WRITE_IFP(BC 1310) //LENS_ADJ_HORIZ_RED_6_7
#WRITE_IFP(BD 1B1F) //LENS_ADJ_HORIZ_RED_8_9
#WRITE_IFP(BE 0023) //LENS_ADJ_HORIZ_RED_10
#WRITE_IFP(BF 0F0C) //LENS_ADJ_HORIZ_GREEN_6_7
#WRITE_IFP(C0 1217) //LENS_ADJ_HORIZ_GREEN_8_9
#WRITE_IFP(C1 0013) //LENS_ADJ_HORIZ_GREEN_10
#WRITE_IFP(C2 0E0C) //LENS_ADJ_HORIZ_BLUE_6_7
#WRITE_IFP(C3 1712) //LENS_ADJ_HORIZ_BLUE_8_9
#WRITE_IFP(C4 0013) //LENS_ADJ_HORIZ_BLUE_10
#WRITE_IFP(3B 042A) //LENS_CORRECT_CONTROL
#WRITE_IFP(3C 0400) //LENS_CORRECT_CONTROL
#WRITE_IFP(53 1C0A) //(2) GAMMA_A_Y1_Y2
#WRITE_IFP(54 5434) //(2) GAMMA_A_Y3_Y4
#WRITE_IFP(55 AB86) //(2) GAMMA_A_Y5_Y6
#WRITE_IFP(56 DDC6) //(2) GAMMA_A_Y7_Y8
#WRITE_IFP(57 FFEF) //(2) GAMMA_A_Y9_Y10
#WRITE_IFP(58 0000) //(1) GAMMA_A_Y0
#WRITE_IFP(DC 1C0A) //(16) GAMMA_B_Y1_Y2
#WRITE_IFP(DD 5434) //(16) GAMMA_B_Y3_Y4
#WRITE_IFP(DE AB86) //(16) GAMMA_B_Y5_Y6
#WRITE_IFP(DF DDC6) //(16) GAMMA_B_Y7_Y8
#WRITE_IFP(E0 FFEF) //(16) GAMMA_B_Y9_Y10
#WRITE_IFP(E1 0000) //(8) GAMMA_B_Y0
#WRITE_IFP(E2 7000) //(8) GAMMA_B_Y1 Effects Mode
#WRITE_IFP(E3 B023) //(8) GAMMA_B_Y2 Effects Sepia
#WRITE_IFP(06 $f $r2 0 1 $b0 01 2 1 06 $w0 $w1) //enable the lens correction
#WRITE_IFP(06 $f $r2 0 1 $b0 01 7 1 06 $w0 $w1) //enable Manual White Balance
$d01F4 //Wait500 ms delay for both Colour correction and PIXEL_ROW_NOISE_REDUCTION
#WRITE_CONTROL(3D 17DD)
#WRITE_SENSOR(5F 3630)
#WRITE_SENSOR(30 043E)
#WRITE_IFP(3B 043E)
#WRITE_CONTROL(2E 0000)
$d0064//delay 100 ms
#WRITE_CONTROL(2E 0C4A)
#WRITE_SENSOR(34 C019)
#WRITE_SENSOR(40 1800)
#WRITE_SENSOR(76 7358)
#WRITE_SENSOR(04 0282)
#WRITE_SENSOR(03 01E2)
#WRITE_IFP(A0 0282)
#WRITE_IFP(A3 01E2)
#WRITE_IFP(A6 0282)
#WRITE_IFP(A9 01E2)

;

//==========================================================================================
// Initial Sequence Video Recording
//==========================================================================================

FRAME_RATE_7_5 =
#WRITE_SENSOR(05 00EE) // Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 01EA) // Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00EE) // Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 01EA) // Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0700) // Read Mode Context B
#WRITE_SENSOR(21 0400) // Read Mode Context A
#WRITE_CONTROL(39 0376) // AE Line size Context A
#WRITE_CONTROL(3A 0376) // AE Line size Context B
#WRITE_CONTROL(3B 055B) // AE shutter delay limit Context A
#WRITE_CONTROL(3C 055B) // AE shutter delay limit Context B
#WRITE_CONTROL(57 00F4) // Context A Flicker full frame time (60Hz)
#WRITE_CONTROL(58 0125) // Context A Flicker full frame time (50Hz)
#WRITE_CONTROL(59 00F4) // Context B Flicker full frame time (60Hz)
#WRITE_CONTROL(5A 0125) // Context B Flicker full frame time (50Hz)
#WRITE_CONTROL(5C 0905) // 60Hz Flicker Search Range
#WRITE_CONTROL(5D 0C08) // 50Hz Flicker Search Range
#WRITE_CONTROL(64 5E1C) // Flicker parameter
#WRITE_CONTROL(37 0200)
#WRITE_IFP(05 000C) // APERTURE_GAIN (sharpness adjusting)
;

FRAME_RATE_10 =
#WRITE_SENSOR(05 0289) // Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 000D) // Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 0289) // Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 000D) // Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0700) // Read Mode Context B
#WRITE_SENSOR(21 0400) // Read Mode Context A
#WRITE_CONTROL(39 0511) // AE Line size Context A
#WRITE_CONTROL(3A 0511) // AE Line size Context B
#WRITE_CONTROL(3B 055B) // AE shutter delay limit Context A
#WRITE_CONTROL(3C 055B) // AE shutter delay limit Context B
#WRITE_CONTROL(57 00A7) // Context A Flicker full frame time (60Hz)
#WRITE_CONTROL(58 00C8) // Context A Flicker full frame time (50Hz)
#WRITE_CONTROL(59 00A7) // Context B Flicker full frame time (60Hz)
#WRITE_CONTROL(5A 00C8) // Context B Flicker full frame time (50Hz)
#WRITE_CONTROL(5C 0602) // 60Hz Flicker Search Range
#WRITE_CONTROL(5D 0905) // 50Hz Flicker Search Range
#WRITE_CONTROL(64 5E1C) // Flicker parameter
#WRITE_CONTROL(37 0180)
#WRITE_IFP(05 000C) // APERTURE_GAIN (sharpness adjusting)
;
FRAME_RATE_14 =
#WRITE_SENSOR(05 00A3) // Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 0054) // Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00A3) // Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 000D) // Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0700) // Read Mode Context B
#WRITE_SENSOR(21 0400) // Read Mode Context A
#WRITE_CONTROL(39 032B) // AE Line size Context A
#WRITE_CONTROL(3A 032B) // AE Line size Context B
#WRITE_CONTROL(3B 055B) // AE shutter delay limit Context A
#WRITE_CONTROL(3C 055B) // AE shutter delay limit Context B
#WRITE_CONTROL(57 010B) // Context A Flicker full frame time (60Hz)
#WRITE_CONTROL(58 0140) // Context A Flicker full frame time (50Hz)
#WRITE_CONTROL(59 010B) // Context B Flicker full frame time (60Hz)
#WRITE_CONTROL(5A 0140) // Context B Flicker full frame time (50Hz)
#WRITE_CONTROL(5C 0905) // 60Hz Flicker Search Range
#WRITE_CONTROL(5D 0D09) // 50Hz Flicker Search Range
#WRITE_CONTROL(64 5E1C) // Flicker parameter
#WRITE_CONTROL(CD 2185) //snapshot config (CD 2187)
#WRITE_IFP(05 000C) // APERTURE_GAIN (sharpness adjusting)
;

//14 fps, 13MHz

FRAME_RATE_AUTO =
#WRITE_SENSOR(05 00A3) // Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 0054) // Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00A3) // Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 000D) // Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0700) // Read Mode Context B
#WRITE_SENSOR(21 0400) // Read Mode Context A
#WRITE_CONTROL(39 032B) // AE Line size Context A
#WRITE_CONTROL(3A 032B) // AE Line size Context B
#WRITE_CONTROL(3B 055B) // AE shutter delay limit Context A
#WRITE_CONTROL(3C 055B) // AE shutter delay limit Context B
#WRITE_CONTROL(57 010B) // Context A Flicker full frame time (60Hz)
#WRITE_CONTROL(58 0140) // Context A Flicker full frame time (50Hz)
#WRITE_CONTROL(59 010B) // Context B Flicker full frame time (60Hz)
#WRITE_CONTROL(5A 0140) // Context B Flicker full frame time (50Hz)
#WRITE_CONTROL(5C 0905) // 60Hz Flicker Search Range
#WRITE_CONTROL(5D 0D09) // 50Hz Flicker Search Range
#WRITE_CONTROL(64 5E1C) // Flicker parameter
#WRITE_CONTROL(CD 2185) //snapshot config (CD 2187)
#WRITE_IFP(05 000C) // APERTURE_GAIN (sharpness adjusting)
;

// Set framerate (fixed 15 fps) used for Xenon Flash.

SEQ_SET_AUTO_FRAMERATE_FLASH=
#WRITE_SENSOR(05 0118) //Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 000D) //Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00C0) //Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 01B0) //Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0100) //Read Mode Context B
#WRITE_SENSOR(21 8400) //Read Mode Context A
#WRITE_SENSOR(22 0D0F) //Dark col / rows
#WRITE_SENSOR(24 8000) //Extra Reset
#WRITE_CONTROL(39 0690) //AE Line Size Context A
#WRITE_CONTROL(3A 0626) //AE Line Size Context B
#WRITE_CONTROL(3B 03DE) //AE shutter delay limit Context A
#WRITE_CONTROL(3C 04CA) //AE shutter delay limit Context B
#WRITE_CONTROL(57 010C) //Context A Flicker full frame rate (60Hz)
#WRITE_CONTROL(58 0142) //Context A Flicker full frame rate (50Hz)
#WRITE_CONTROL(59 020B) //Context B Flicker full frame rate (60Hz)
#WRITE_CONTROL(5A 0274) //Context B Flicker full frame rate (50Hz)
#WRITE_CONTROL(5C 130E) //60Hz Flicker Search Range
#WRITE_CONTROL(5D 1712) //50Hz Flicker Search Range
#WRITE_CONTROL(64 1E1C) //Flicker parameter
#WRITE_CONTROL(37 0100) //(7) SHUTTER_WIDTH_LIM_AE
//#WRITE_CONTROL(37 8100) //(7) SHUTTER_WIDTH_LIM_AE
;


// Set Auto framerate YUV
SEQ_SET_AUTO_FRAMERATE_YUV=#WRITE_SENSOR(05 00FC) //Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 0007) //Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00B4) //Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 0011) //Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0100) //Read Mode Context B
#WRITE_SENSOR(21 8400) //Read Mode Context A
#WRITE_SENSOR(22 0509) //Dark col / rows
#WRITE_SENSOR(24 0000) //Extra Reset
#WRITE_CONTROL(39 0678) //AE Line Size Context A
#WRITE_CONTROL(3A 0604) //AE Line Size Context B
#WRITE_CONTROL(3B 0423) //AE shutter delay limit Context A
#WRITE_CONTROL(3C 0555) //AE shutter delay limit Context B
#WRITE_CONTROL(57 01E3) //Context A Flicker full frame rate (60Hz)
#WRITE_CONTROL(58 0243) //Context A Flicker full frame rate (50Hz)
#WRITE_CONTROL(59 0103) //Context B Flicker full frame rate (60Hz)
#WRITE_CONTROL(5A 0137) //Context B Flicker full frame rate (50Hz)
#WRITE_CONTROL(5C 110C) //60Hz Flicker Search Range
#WRITE_CONTROL(5D 1510) //50Hz Flicker Search Range
#WRITE_CONTROL(64 5E1C) //Flicker parameter
#WRITE_CONTROL(37 0200) //(7) SHUTTER_WIDTH_LIM_AE
;

// Set framerate to 24 fps
SEQ_SET_FRAMERATE_24=
#WRITE_SENSOR(05 0118) //Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 000D) //Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00C0) //Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 0012) //Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0100) //Read Mode Context B
#WRITE_SENSOR(21 8400) //Read Mode Context A
#WRITE_SENSOR(22 0D0F) //Dark col / rows
#WRITE_SENSOR(24 8000) //Extra Reset
#WRITE_CONTROL(39 0690) //AE Line Size Context A
#WRITE_CONTROL(3A 0626) //AE Line Size Context B
#WRITE_CONTROL(3B 03DE) //AE shutter delay limit Context A
#WRITE_CONTROL(3C 04CA) //AE shutter delay limit Context B
#WRITE_CONTROL(57 010C) //Context A Flicker full frame rate (60Hz)
#WRITE_CONTROL(58 0142) //Context A Flicker full frame rate (50Hz)
#WRITE_CONTROL(59 020B) //Context B Flicker full frame rate (60Hz)
#WRITE_CONTROL(5A 0274) //Context B Flicker full frame rate (50Hz)
#WRITE_CONTROL(5C 130E) //60Hz Flicker Search Range
#WRITE_CONTROL(5D 1712) //50Hz Flicker Search Range
#WRITE_CONTROL(64 1E1C) //Flicker parameter
#WRITE_CONTROL(37 0100) //(7) SHUTTER_WIDTH_LIM_AE
#WRITE_CONTROL(37 8100)//(7) SHUTTER_WIDTH_LIM_AE
;


// Set framerate to 24 fps
SEQ_SET_FRAMERATE_24=
#WRITE_SENSOR(05 0700) //Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 0007) //Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 0954) //Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 0007) //Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0100) //Read Mode Context B
#WRITE_SENSOR(21 8400) //Read Mode Context A
#WRITE_SENSOR(22 0509) //Dark col / rows
#WRITE_SENSOR(24 0000) //Extra Reset
#WRITE_CONTROL(39 17B8) //AE Line Size Context A
#WRITE_CONTROL(3A 0C08) //AE Line Size Context B
#WRITE_CONTROL(3B 0423) //AE shutter delay limit Context A
#WRITE_CONTROL(3C 0555) //AE shutter delay limit Context B
#WRITE_CONTROL(57 0083) //Context A Flicker full frame rate (60Hz)
#WRITE_CONTROL(58 009E) //Context A Flicker full frame rate (50Hz)
#WRITE_CONTROL(59 0103) //Context B Flicker full frame rate (60Hz)
#WRITE_CONTROL(5A 0137) //Context B Flicker full frame rate (50Hz)
#WRITE_CONTROL(5C 0905) //60Hz Flicker Search Range
#WRITE_CONTROL(5D 0D09) //50Hz Flicker Search Range
#WRITE_CONTROL(64 1E1C) //Flicker parameter
#WRITE_CONTROL(37 0200) //(5) SHUTTER_WIDTH_LIM_AE

;

//29 fps, 20MHz

FRAME_RATE_AUTO =
#WRITE_SENSOR(05 00A3) // Context B (full-res) Horizontal Blank
#WRITE_SENSOR(06 0054) // Context B (full-res) Vertical Blank
#WRITE_SENSOR(07 00A3) // Context A (preview) Horizontal Blank
#WRITE_SENSOR(08 000D) // Context A (preview) Vertical Blank
#WRITE_SENSOR(20 0700) // Read Mode Context B
#WRITE_SENSOR(21 0400) // Read Mode Context A
#WRITE_CONTROL(39 032B) // AE Line size Context A
#WRITE_CONTROL(3A 032B) // AE Line size Context B
#WRITE_CONTROL(3B 055B) // AE shutter delay limit Context A
#WRITE_CONTROL(3C 055B) // AE shutter delay limit Context B
#WRITE_CONTROL(57 010B) // Context A Flicker full frame time (60Hz)
#WRITE_CONTROL(58 0140) // Context A Flicker full frame time (50Hz)
#WRITE_CONTROL(59 010B) // Context B Flicker full frame time (60Hz)
#WRITE_CONTROL(5A 0140) // Context B Flicker full frame time (50Hz)
#WRITE_CONTROL(5C 0905) // 60Hz Flicker Search Range
#WRITE_CONTROL(5D 0D09) // 50Hz Flicker Search Range
#WRITE_CONTROL(64 5E1C) // Flicker parameter
#WRITE_CONTROL(CD 2185) //snapshot config (CD 2187)
#WRITE_IFP(05 000C) // APERTURE_GAIN (sharpness adjusting)
;

//==========================================================================================
// End Sequence Video Recording
//==========================================================================================


COMPARE_TWO_BYTE_NUMBERS = // Compare a with b, where a and b are 1 byte long. Result passed in register 0.
// Result: a output 1, a=b => output 2, a>b => output 3
$-5 r6 // Subtract register 6 from register 5
// If the result is negative, then register 0 will contain a very large number
// since the registers are 32-bit unsigned. Thus, if the second byte is a FF, then
// b is larger than a, otherwise a is larger than b. If the result is 0, then
// a is equal to b.
$c5 00 // IF register 5 is 0 THEN
$s7 02 // a=b: pass result 02 in register 0.
$cl // ELSE
$>5 8 // Shift one byte to the right
$c5 FF // IF register 5 is FF THEN
$s7 01 // ab: pass result 03 in register 7.
$cx // ENDIF
$cx // ENDIF
;

IS_A_LARGER_THAN_B = // Compare a with b, where a and b are 2 bytes long each. Result passed in register 0.
// a=r2r1 and b=r4r3, where rx refers to the byte sized register x
// Result: a output 1, a=b => output 2, a>b => output 3
$m5 2 $m6 4 // Copy MSB of a and b to register 5 and 6
#COMPARE_TWO_BYTE_NUMBERS // First compare MSB of the two numbers
$c7 02 // IF MSB a = MSB b: LSB needs to be compared also.
$m5 1 $m6 3 // Copy LSB of a and b to register 5 and 6
#COMPARE_TWO_BYTE_NUMBERS // Compare LSB of the two numbers stored in !
$c7 02 // IF LSB a = LSB b THEN
$s0 02 // a=b: pass result 02 in register 0
$cl // ELSE
$c7 01 // IF LSB a < LSB b THEN $s0 01 // ab: pass result 03 in register 0
$cx
$cx
$cl // ELSE find out if aa
$c7 01 // IF MSB a< MSB b THEN $s0 01 // ab: pass result 03 in register 0.
$cx // ENDIF
$cx // ENDIF
;



// Set a flag if luma is below 40 => flash will be fired
SEQ_FLASH_LIMIT= $c9 01 $"DORIS_flash_attached_intreg_9_%9" //Is the flash attached
#WRITE_CONTROL(CC 0004)
#WRITE_CONTROL(CB 0001)
#READ_CONTROL(4D $f $r2 2 1) $"DORIS_Status_reg_4D_%2_%1" //Store the Time averaged luma value in r1 and r2
$s4 00 $s3 30 $"DORIS_Status_int_reg_4_3_%4_%3" // Luma limit for flash
#IS_A_LARGER_THAN_B $"DORIS_Status_int_reg_0_%0"
$c0 01
$s8 01 $"DORIS_Flash_will_be_fired" // Flash will be fired
$cl
$s8 00 $"DORIS_Flash_will_not_be_fired_9_1" // Flash will not be fired
$cx

$cl
$s8 00 $"DORIS_Flash_will_not_be_fired_9_0" // Flash will not flash (flash not attached)
$cx
$"DORIS_Status_int_reg_8_%8"
;

// adjustings for xenon flash
SEQ_SET_FLASH=
#WRITE_CONTROL(37 0120) //fixed upperlower
#WRITE_CONTROL(2E 0000) //target 0
$d064 //pause 100 ms
#WRITE_CONTROL(2E 0C4A)

#WRITE_SENSOR(23 0008) //Turn off Fire flash every frame
#WRITE_CONTROL(D4 5469)
//$d00C0 //default: C0
#WRITE_CONTROL(F6 0020)
#WRITE_CONTROL(FF 8080) //Xenon RB gain
//#WRITE_CONTROL(37 0100)

;

//===================================================
//Color Saturation
//===================================================
//***************************************************
seq_set_prop_0_0=#WRITE_CONTROL(25 0005); //auto on default
seq_set_prop_0_1=#WRITE_CONTROL(25 0006); //25%
seq_set_prop_0_2=#WRITE_CONTROL(25 0007); //37.5%
seq_set_prop_0_3=#WRITE_CONTROL(25 0008); //50%
seq_set_prop_0_4=#WRITE_CONTROL(25 000E); //75%
seq_set_prop_0_5=#WRITE_CONTROL(25 000D); //150%
seq_set_prop_0_6=#WRITE_CONTROL(25 0014); //black and white
seq_set_prop_0_7=#WRITE_CONTROL(25 0000); //auto off
//****************************************************

//===================================================
//Sharpening
//===================================================
//***************************************************
seq_set_prop_0_0=#WRITE_CONTROL(05 0003); //auto on default
seq_set_prop_0_1=#WRITE_CONTROL(05 0004); //25%
seq_set_prop_0_2=#WRITE_CONTROL(05 0005); //50%
seq_set_prop_0_3=#WRITE_CONTROL(05 0006); //75%
seq_set_prop_0_4=#WRITE_CONTROL(05 0007); //100%
seq_set_prop_0_5=#WRITE_CONTROL(05 0009); //125%
seq_set_prop_0_6=#WRITE_CONTROL(05 000A); //150%
seq_set_prop_0_6=#WRITE_CONTROL(05 000E); //200%
seq_set_prop_0_7=#WRITE_CONTROL(05 0000); //auto off
//****************************************************


//====================================================
//Exposure Digital Gains Monitor EDGM
//====================================================
//****************************************************
seq_set_prop_0_0=#WRITE_CONTROL(62 1010); //Auto Exposure enable on default
seq_set_prop_0_1=#WRITE_CONTROL(62 10DD); //EDGM(+5%)
seq_set_prop_0_2=#WRITE_CONTROL(62 11B4); //EDGM(+10%)
seq_set_prop_0_3=#WRITE_CONTROL(62 1296); //EDGM(+15%)
seq_set_prop_0_4=#WRITE_CONTROL(62 1383); //EDGM(+20%)
seq_set_prop_0_5=#WRITE_CONTROL(62 147C); //EDGM(+25%)
seq_set_prop_0_6=#WRITE_CONTROL(62 0000); //Auto Exposure disable off


//====================================================
//Exposure Digital Gains Limits EDGL
//====================================================
//****************************************************
seq_set_prop_0_0=#WRITE_CONTROL(67 4010); //Auto Exposure enable on default
seq_set_prop_0_1=#WRITE_CONTROL(67 4344); //EDGL(+5%)
seq_set_prop_0_2=#WRITE_CONTROL(67 49FE); //EDGL(+10%)
seq_set_prop_0_3=#WRITE_CONTROL(67 5517); //EDGL(+15%)
seq_set_prop_0_4=#WRITE_CONTROL(67 661C); //EDGL(+20%)
seq_set_prop_0_5=#WRITE_CONTROL(67 8F43); //EDGL(+25%)
seq_set_prop_0_6=#WRITE_CONTROL(67 0000); //Auto Exposure disable off

//======================================================
//Effects Mode
//======================================================
//******************************************************
seq_set_prop_0_0=#WRITE_CONTROL(E2 7000); //Auto on default
seq_set_prop_0_1=#WRITE_CONTROL(E2 7001); //Effect:Black & White (Monochrome)
seq_set_prop_0_2=#WRITE_CONTROL(E2 7002); //Effect:Sepia
seq_set_prop_0_3=#WRITE_CONTROL(E2 7003); //Effect:Negative
seq_set_prop_0_4=#WRITE_CONTROL(E2 7104); //Effect:Solarize 1
seq_set_prop_0_5=#WRITE_CONTROL(E2 3C05); //Effect:Solarize 2
seq_set_prop_0_0=#WRITE_CONTROL(E2 0000); //Auto off default

//======================================================
//Effects Sepia
//======================================================
//******************************************************
seq_set_prop_0_0=#WRITE_CONTROL(E3 B023); //Auto on default
seq_set_prop_0_1=;
seq_set_prop_0_2=;
seq_set_prop_0_3=;
seq_set_prop_0_4=;
seq_set_prop_0_5=;
seq_set_prop_0_0=#WRITE_CONTROL(E3 0000); //Auto off default

//=====================================================
// WHITE BALANCE AUTO NORMAL MODE/NIGTH MODE ISO MACROS
//=====================================================

// ISO MACROS
ISO_A = #COM_EVENT(05,00);
ISO100 = #COM_EVENT(05,01);
ISO125 = #COM_EVENT(05,02);
ISO160 = #COM_EVENT(05,03);
ISO200 = #COM_EVENT(05,04);
ISO250 = #COM_EVENT(05,05);
ISO320 = #COM_EVENT(05,06);
ISO400 = #COM_EVENT(05,07);

//*********************************
//***Functions Macros Camdriver***
//*********************************
// Shutter speed 1/x seconds
// Sharpness auto
// Exposure (EV +/-) auto
// ISO auto
// Spot Photometry auto
// Focus auto
// Flick Correction auto
//*********************************


//=========================================================
// Properties:
//=========================================================



//************************************************
// Exposure property 0 *****
//************************************************

// 3 => -2 EV, 9 => -(0) EV .... f => 2 EV
//---------------------------------------------------
seq_set_prop_0=$s0 %0 $-0 0a 06 02 00 01 $w5 06 #CMD_END;


//***********************************************
// ---Exposure-Brightness Auto property 1 ---------------------
//
// 0 => -3 EV 1=> -(2 2/3) EV ....
// 9 => 0 EV ....
// 15 => 2 EV
//------------------------------------------------
//************************************************


seq_set_prop_0_0 = #WRITE_CONTROL(2E 0108); // -3.0EV
seq_set_prop_0_1 = #WRITE_CONTROL(2E 010A); // -2.7EV
seq_set_prop_0_2 = #WRITE_CONTROL(2E 010E); // -2.3EV
seq_set_prop_0_3 = #WRITE_CONTROL(2E 0110); // -2.0EV
seq_set_prop_0_4 = #WRITE_CONTROL(2E 0116); // -1.7EV
seq_set_prop_0_5 = #WRITE_CONTROL(2E 011A); // -1.3EV
seq_set_prop_0_6 = #WRITE_CONTROL(2E 0120); // -1.0EV
seq_set_prop_0_7 = #WRITE_CONTROL(2E 0128); // -0.7EV
seq_set_prop_0_8 = #WRITE_CONTROL(2E 0138); // -0.3EV
seq_set_prop_0_9 = #WRITE_CONTROL(2E 0240); // default
seq_set_prop_0_a = #WRITE_CONTROL(2E 0250); // 0.3EV
seq_set_prop_0_b = #WRITE_CONTROL(2E 0270); // 0.7EV
seq_set_prop_0_c = #WRITE_CONTROL(2E 1088); // 1.0EV
seq_set_prop_0_d = #WRITE_CONTROL(2E 10A8); // 1.3EV
seq_set_prop_0_e = #WRITE_CONTROL(2E 10C0); // 1.7EV
seq_set_prop_0_f = #WRITE_CONTROL(2E 10D8); // 2.0EV


//*******************************************************************
// --- White balance RGB property 2 Sequence BrAzUkA´s-----
//
// 0 => auto 1 =>incandescent lamp tungsten 2 => fluorescent
// 3 => clear sky 4 => cloudy
// 5 => one push 6 => hold
//------------------------------------------------
//********************************************************************
seq_set_prop_1_0_Auto = #COM_EVENT (11,00); //Auto
#COM_EVENT (03,0F); //Slow Shutter speed 1/7.5 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,00); // Spot Photometry
#COM_EVENT (21,00); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;
seq_set_prop_1_1_Clear_sky = #COM_EVENT (11,05); //clear sky (daylight)
#COM_EVENT (03,78); //Slow Shutter speed 1/60 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,01); // Spot Photometry
#COM_EVENT (21,00); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;
seq_set_prop_1_2_Cloudy_Indoor = #COM_EVENT (11,06); // cloudy (Indoor)
#COM_EVENT (03,04); //Slow Shutter speed 1/2 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,01); // Spot Photometry
#COM_EVENT (21,01); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;

seq_set_prop_1_3_One_push = #COM_EVENT (11,07); //one push
#COM_EVENT (03,78); //Slow Shutter speed 1/60 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,01); // Spot Photometry
#COM_EVENT (21,00); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;
seq_set_prop_1_4_Hold = #COM_EVENT (11,01); // hold
#COM_EVENT (03,78); //Slow Shutter speed 1/60 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,01); // Spot Photometry
#COM_EVENT (21,00); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;
seq_set_prop_1_5_Fluorescent = #COM_EVENT (11,04); //fluorescent (white ice)
#COM_EVENT (03,0A); //Slow Shutter speed 1/5 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,01); // Spot Photometry
#COM_EVENT (21,02); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;
seq_set_prop_1_6_Incandescent= #COM_EVENT (11,03); //incandescent lamp (tungsten)
#COM_EVENT (03,04); //Slow Shutter speed 1/2 sec
#COM_EVENT (05,01); //ISO 100
#COM_EVENT (42,00); // Focus
#COM_EVENT (08,01); // Spot Photometry
#COM_EVENT (21,03); // Flicker correction
#COM_EVENT (2E,00); // Exposure reset
;


/*******************************************
// --- Flicker correction property 3 -------
//
// 0 => auto, (Thelma uses only auto)
// 1 => 50 Hz, 2 => 60 Hz,
//------------------------------------------
//******************************************
seq_set_prop_2_0=#CMD(21,01);//50Hz
seq_set_prop_2_1=#CMD(21,02);//55Hz
seq_set_prop_2_2=#CMD(21,03);//60Hz
seq_set_prop_2_3=#CMD(21,00);//auto

////******************************************
// --- Vertical mirror property 4 -----------
//
// 0 => off, 1 => on
//-------------------------------------------
////******************************************
seq_set_prop_3_0 = #WRITE_IFP(#REGISTER_MODIFY(20,$b1 01 0 1));// off
seq_set_prop_3_1 = #WRITE_IFP(#REGISTER_MODIFY(20,$b1 00 0 1));// on

////******************************************
// --- Horizontal mirror property 5 ---------
//
// 0 => off, 1 => on
//-------------------------------------------
////******************************************
seq_set_prop_4_0 = #WRITE_IFP(#REGISTER_MODIFY(20,$b1 00 1 1));// off
seq_set_prop_4_1 = #WRITE_IFP(#REGISTER_MODIFY(20,$b1 01 1 1));// on



SET_JPEG_MAX=06 02 00 0D !1 !0 #CMD_END;
SET_JPEG_MIN=06 02 00 0F !1 !0 #CMD_END;
SET_JPEG_AVG=06 02 00 11 !1 !0 #CMD_END;
//SET_JPEG_QUALITY=07 02 00 13 !0 !1 !2 #CMD_END; // INIT, AVE, LAST

SET_JPEG_QUALITY= $p1 0e // Check if accessory flash is connected
$c1 01 // If accessory flash is connected...
$s2 32 // ...then use a hardcoded compression value
#SET_JPEG_MIN(00,01) // ...and change the min size limit to 1KB
$cx // End if
07 02 00 13 $w2 $w2 $w2 #CMD_END; // INIT, AVE, LAST


////******************************************
// ----------- JPEG compression property 6 ---
//
// 0 => normal, 1 => fine (low compression)
//
//---------------------------------------------
////******************************************
//=========================================================
// Normal quality settings:
// MIN MAX AVG COMPRESSION for initial, average and last quality
// 100 x 60: 0 15 5 75
// 160 x 120: 0 25 8 75
// 320 x 240: 0 40 15 75
// 640 x 480: 0 150 55 75
// 1280 x 960: 0 320 150 75
// 1600 x1200: 0 520 370 75
// 1632 x1088: 0 480 350 75
// 1632 x1224: 0 540 400 75
//=========================================================
seq_set_prop_5_0=$z0
$s2 4b // Keep in mind which compression value to use...
$c0 01 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,0F) #SET_JPEG_AVG(00,05) #SET_JPEG_QUALITY $cl
$c0 02 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,19) #SET_JPEG_AVG(00,08) #SET_JPEG_QUALITY $cl
$c0 03 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,28) #SET_JPEG_AVG(00,0F) #SET_JPEG_QUALITY $cl
$c0 04 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,96) #SET_JPEG_AVG(00,37) #SET_JPEG_QUALITY $cl
$c0 05 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(01,40) #SET_JPEG_AVG(00,96) #SET_JPEG_QUALITY $cl
$c0 06 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(02,08) #SET_JPEG_AVG(01,72) #SET_JPEG_QUALITY $cl
$c0 07 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(01,e0) #SET_JPEG_AVG(01,5e) #SET_JPEG_QUALITY $cl
$c0 08 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(02,1c) #SET_JPEG_AVG(01,90) #SET_JPEG_QUALITY
$cx $cx $cx $cx $cx $cx $cx $cx;


//=========================================================
// Fine quality settings:
// MIN MAX AVG COMPRESSION for initial, average and last quality
// 100 x 60: 0 15 8 85
// 160 x 120: 0 25 15 85
// 320 x 240: 0 40 20 85
// 640 x 480: 0 150 80 85
// 1280 x 960: 0 340 300 85
// 1600 x1200: 0 540 460 85
// 1632 x1088: 0 500 420 85
// 1632 x1224: 0 560 480 85
//=========================================================
seq_set_prop_5_1=$z0
$s2 55 // Keep in mind which compression value to use...
$c0 01 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,0F) #SET_JPEG_AVG(00,08) #SET_JPEG_QUALITY $cl
$c0 02 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,19) #SET_JPEG_AVG(00,0F) #SET_JPEG_QUALITY $cl
$c0 03 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,28) #SET_JPEG_AVG(00,14) #SET_JPEG_QUALITY $cl
$c0 04 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(00,96) #SET_JPEG_AVG(00,50) #SET_JPEG_QUALITY $cl
$c0 05 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(01,54) #SET_JPEG_AVG(01,2C) #SET_JPEG_QUALITY $cl
$c0 06 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(02,1c) #SET_JPEG_AVG(01,cc) #SET_JPEG_QUALITY $cl
$c0 07 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(01,f4) #SET_JPEG_AVG(01,a4) #SET_JPEG_QUALITY $cl
$c0 08 #SET_JPEG_MIN(00,00) #SET_JPEG_MAX(02,30) #SET_JPEG_AVG(01,e0) #SET_JPEG_QUALITY
$cx $cx $cx $cx $cx $cx $cx $cx;


////****************************************
// --- Zoom property 7 ---------------------
//******************************************
// 0 => No zoom, 1 => 2x zoom, 2 => 4x zoom
// 10 => 1.0 x zoom
// 20 => 2.0 x zoom
// 1[280,1E0,0], // SS 1280 x 960
// 2[140,F0,0], // SS 640 x 320
// 3[A0,78,0], // SS 320 x 240
//

seq_set_prop_6 = $"DORIS_zoom"
$z0
$s2 %0
$w2 $"DORIS_zoom_number_$w2_%2"
$c2 0A
$c0 41
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 0080)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0060

#WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
$cl
$c0 42
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0090)

#WRITE_IFP(A6 024A)
#WRITE_IFP(A9 01E0)

$cl
$c0 44
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0090)

#WRITE_IFP(A6 024A)
#WRITE_IFP(A9 01E0)
$cl
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 0080)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0060)

#WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
$cx
$cx

$cx
$"DORISsetuptest_zoom_mode_1x"

$cl
$w2
$c2 14

$c0 41
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 0080)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0060)

#WRITE_IFP(A6 0140)
#WRITE_IFP(A9 00F0)
$cl
$c0 42
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0090)

#WRITE_IFP(A6 0125)
#WRITE_IFP(A9 00F0)

$cl
$c0 44
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0090)

#WRITE_IFP(A6 0125)
#WRITE_IFP(A9 00F0)
$cl
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 0080)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0060)

#WRITE_IFP(A6 0140)
#WRITE_IFP(A9 00F0)
$cx
$cx

$cx
$"DORISsetuptest_zoom_mode_2x"
$cl
$"DORISsetuptest_zoom_mode_4x"
$c0 41
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 0080)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0060)

#WRITE_IFP(A6 00A0)
#WRITE_IFP(A9 0078)
$cl
$c0 42
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0090)

#WRITE_IFP(A6 0092)
#WRITE_IFP(A9 0078)

$cl
$c0 44
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0090)

#WRITE_IFP(A6 00A0)
#WRITE_IFP(A9 0078)
$cl
#WRITE_IFP(A5 4000)
#WRITE_IFP(A7 0080)
#WRITE_IFP(A8 4000)
#WRITE_IFP(AA 0060)

#WRITE_IFP(A6 00A0)
#WRITE_IFP(A9 0078)
$cx
$cx

$cx

$cx
$cx
;


//**************************************************************
// Effect-Scenes for w200 property 9 Sequence BrAzUkA´s
//
// 0 => normal auto (no effects) = Auto Mode
// 1 => negative/incandescent(tungsten) = Landscape Mode
// 2 => sepia/fluorescent(white ice) = Fly Clarity Super Color™ Mode
// 3 => solarize/clear sky(dayligth) = Clear sky Mode
// 4 => black & white/cloudy(indoor) = Portrait Mode
//===============================================================
// COLOR CORRECTION RGB WB WHITE BALANCE
//
// 22=>Green 23=>Blue 24=>Red
//===============================================================
//***************************************************************

//Auto Mode Effect:Normal auto (no effects)
seq_set_prop_8_0 = #WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 3))//Effect normal auto on
#WRITE_CONTROL (24 6018) // WB_R
#WRITE_CONTROL (22 B078) // WB_G
#WRITE_CONTROL (23 A058) // WB_B
#COM_EVENT (2E,0120) // Exposure EV(-1.0)
#COM_EVENT (62,147C) // EDGM auto
#COM_EVENT (67,4010) // EDGL auto
#COM_EVENT (2F,DF20) // Dynamic_AE
#COM_EVENT (2E,0C4A) // Adjusted AE target (default)
#COM_EVENT (0C,0F) // Slow Shutter speed 1/7.5 sec
#COM_EVENT (05,01) // ISO 100
#COM_EVENT (42,00) // Focus
#COM_EVENT (08,00) // Spot Photometry
#COM_EVENT (21,00) // Flicker correction
#COM_EVENT (2E,00) // Exposure reset
#WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 0))//Effect normal auto off reset
;

//Landscape Mode Effect:Normal auto (no effects)
seq_set_prop_8_1 = #WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 3))//Effect normal auto on
#WRITE_CONTROL (24 1518) // WB_R
#WRITE_CONTROL (22 8878) // WB_G
#WRITE_CONTROL (23 9888) // WB_B
#COM_EVENT (2E,0250) // Exposure EV(0.3)
#WRITE_CONTROL (2F DF20) // Dynamic_AE
#WRITE_CONTROL (2E 0C4A) // Adjusted AE target (default)
#WRITE_CONTROL (62 147C) // EDGM auto
#WRITE_CONTROL (67 4010) // EDGL auto
#COM_EVENT (0C,04) // Slow Shutter speed 1/2 sec
#COM_EVENT (05,01) // ISO 100
#COM_EVENT (42,00) // Focus
#COM_EVENT (08,00) // Spot Photometry
#COM_EVENT (21,00) // Flicker correction
#COM_EVENT (2E,00) // Exposure reset
#WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 0))//Effect normal auto off reset
;

//Fly Clarity Super Color™ Mode Effect:Normal auto (no effects)
seq_set_prop_8_2 = #WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 3))//Effect normal auto on
#WRITE_CONTROL (24 6060) // WB_R
#WRITE_CONTROL (22 8878) // WB_G
#WRITE_CONTROL (23 CCB4) // WB_B
#COM_EVENT (2E,10D8) // Exposure EV(2.0)
#WRITE_CONTROL (2F DF20) // Dynamic_AE
#WRITE_CONTROL (2E 0C4A) // Adjusted AE target (default)
#WRITE_CONTROL (62 147C) // EDGM auto
#WRITE_CONTROL (67 4010) // EDGL auto
#WRITE_CONTROL (25 0008) // Color Saturation (50%)
#COM_EVENT (0C,0A) // Slow Shutter speed 1/5 sec
#COM_EVENT (05,01) // ISO 100
#COM_EVENT (06,0a) // Exposure
#COM_EVENT (42,00) // Focus
#COM_EVENT (08,00) // Spot Photometry
#COM_EVENT (21,00) // Flicker correction
#COM_EVENT (55,01) // Contrast
#COM_EVENT (57,7F) // Hue
#COM_EVENT (58,02) // Saturation
#COM_EVENT (20,FD) // correction colors
#COM_EVENT (21,F6) // correction colors
#COM_EVENT (13,01) // Apply change of colors
#COM_EVENT (08,00) // on spot (Brightness center)
#COM_EVENT (2E,00) // Exposure reset
#WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 0))//Effect normal auto off reset
;

//Clear sky Mode Effect:Normal auto (no effects)
seq_set_prop_8_3 = #WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 3))//Effect normal auto on
#WRITE_CONTROL (24 5050) // WB_R
#WRITE_CONTROL (22 8878) // WB_G
#WRITE_CONTROL (23 7868) // WB_B
#COM_EVENT (2E,0138) // Exposure EV(-0.3)
#WRITE_CONTROL (2F DF20) // Dynamic_AE
#WRITE_CONTROL (2E 0C4A) // Adjusted AE target (default)
#WRITE_CONTROL (62 147C) // EDGM auto
#WRITE_CONTROL (67 4010) // EDGL auto
#COM_EVENT (0C,78) // Slow Shutter speed 1/60 sec
#COM_EVENT (05,01) // ISO 100
#COM_EVENT (42,00) // Focus
#COM_EVENT (08,00) // Spot Photometry
#COM_EVENT (21,00) // Flicker correction
#COM_EVENT (2E,00) // Exposure reset
#WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 0))//Effect normal auto off reset
;

//Portrait Mode Effect:Sepia/fluorescent(white ice)
seq_set_prop_8_4 = #WRITE_IFP(#REGISTER_MODIFY(E2,$b1 02 0 3) E3 b0 23)//Effect Sepia on
#WRITE_CONTROL (24 6018) // WB_R
#WRITE_CONTROL (22 8878) // WB_G
#WRITE_CONTROL (23 B168) // WB_B
#WRITE_CONTROL (25 0008) // Color Saturation (50%)
#COM_EVENT (2E,0138) // Exposure EV(-0.3)
#WRITE_CONTROL (2F DF20) // Dynamic_AE
#WRITE_CONTROL (2E 0C4A) // Adjusted AE target (default)
#WRITE_CONTROL (62 147C) // EDGM auto
#WRITE_CONTROL (67 4010) // EDGL auto
#COM_EVENT (0C,04) // Slow Shutter speed 1/2 sec
#COM_EVENT (05,01) // ISO 100
#COM_EVENT (42,00) // Focus
#COM_EVENT (08,00) // Spot Photometry
#COM_EVENT (21,00) // Flicker correction
#COM_EVENT (2E,00) // Exposure reset
#WRITE_IFP(#REGISTER_MODIFY(E2,$b1 00 0 0) E3 b0 00)//Effect Sepia off reset
;


//******************************************
// Night mode , property 10 *****
//******************************************

seq_set_prop_9_0=06 02 00 01 28 03 #CMD_END //(28) Slowshutter locked at min 5 fps => 10 fps draft mode 1/2 sec
05 02 00 08 3C #CMD_END //(3C) 15fps, Normal mode
06 02 00 01 81 34 #CMD_END //(81) Transition to draft mode, use each 2 frame
06 02 00 01 01 05 #CMD_END //ISO 100
06 02 00 01 155 2e #CMD_END //Exposure 1.0EV
06 02 00 01 01 34 #CMD_END //Draft mode
06 02 00 01 00 42 #CMD_END //Focus
06 02 00 01 01 08 #CMD_END //Spot Photometry
06 02 00 01 02 21 #CMD_END //Flicker correction
06 02 00 01 00 2e #CMD_END //Exposure reset
#WAIT_FOR_MODE_TRANSITION;

seq_set_prop_9_1=06 02 00 01 0a 03 #CMD_END //(0a) Slowshutter locked at 5 fps draft mode
05 02 00 08 1E #CMD_END //(1E) 15fps, Nigth mode
06 02 00 01 01 34 #CMD_END //(01) Transition to draft mode, use every frame
06 02 00 01 01 05 #CMD_END //ISO 100
06 02 00 01 155 2e #CMD_END //Exposure 1.0EV
06 02 00 01 01 34 #CMD_END //Draft mode
06 02 00 01 00 42 #CMD_END //Focus
06 02 00 01 01 08 #CMD_END //Spot Photometry
06 02 00 01 02 21 #CMD_END //Flicker correction
06 02 00 01 00 2e #CMD_END //Exposure reset
#WAIT_FOR_MODE_TRANSITION;


//****************************
//=== XENON FLASH PROPERTY ===
//****************************

seq_set_prop_a_0 = #WRITE_IFP(06 $f $r2 0 1 $b0 01 6 1 06 $w0 $w1) //turn on auto exposure
#WRITE_CONTROL(37 $f $r2 0 1 $b0 01 7 1 37 $w0 $w1) //Force Auto Exposure Settings Reevaluation
#SEQ_SET_AUTO_FRAMERATE // variable 7.5 -> fps
$s9 00 // flash disabled, use internal reg 9 as a flag for the flash property
;

seq_set_prop_a_1 = #SEQ_SET_AUTO_FRAMERATE_FLASH
$s9 01 // flash enabled, use internal reg 9 as a flag for the flash property
;

seq_set_prop_a_2 = #SEQ_SET_AUTO_FRAMERATE_FLASH
#WRITE_CONTROL(CC 0002) // Prog_Sel_snapshot
#WRITE_CONTROL(CB 0001)
$s9 01 // flash enabled, use internal reg 9 as a flag for the flash property
;

//*********************************************
// Focus setting, property 12 *****
//*********************************************

// 0 => Normal mode (no macro range scanning) //by start up
// 1 => Full range
// 2 => Fast mode (no macro, reduced normal scanning)
// 3 => Fast mode and full range
// 4 => Macro range (only macro range scanning)

seq_set_prop_9=06 02 00 01 %0 41 #CMD_END;



//************************************************
// Focus operation, property 13 *****
//************************************************

// 0 => Stop AF scan and hold position
// 1 => Start AF scan
// 2 => Stop AF and go to infinity

// Return values:
// 3 <= Focus ongoing // 4 <= Focus operation success // 5 <= Focus operation failure seq_set_prop_a_0=06 02 00 01 02 42 #CMD_END; seq_set_prop_a_1=06 02 00 01 01 42 #CMD_END; seq_set_prop_a_2=06 02 00 01 00 42 #CMD_END; seq_get_prop_a=#READ_AF_STATUS $m0 4 $c0 03 $cl $+0 04 $cx; //*************************************** // Exif, property 14 ***** //*************************************** // // Property used to read out EXIF info. // // Start by setting the property to one of the values: // 0(L) 1(H) => ISO Sensitivity
// 2(L) 3(H) => Exposure
//---------------------------------------------------
seq_get_prop_b=05 01 00 25 04 $f $r5 0 0 1 2 3
$c3 ff
05 01 00 25 04 $f $r5 0 0 1 2 3
$c3 ff
05 01 00 25 04 $f $r5 0 0 1 2 3
$c3 ff
05 01 00 25 04 $f $r5 0 0 1 2 3
$c3 ff
05 01 00 25 04 $f $r5 0 0 1 2 3
$cx
$cx
$cx
$cx ;

//***************************************
// 0 => White Balance
// 1 => Distance (LED)
// 2 => Fill flash (Xenon)
// 3 => Q-table, property 12
//***************************************

seq_get_prop_c=05 01 00 29 03 $f $r4 0 0 1 2
$c2 ff
05 01 00 29 03 $f $r4 0 0 1 2
$c2 ff
05 01 00 29 03 $f $r4 0 0 1 2
$c2 ff
05 01 00 29 03 $f $r4 0 0 1 2
$c2 ff
05 01 00 29 03 $f $r4 0 0 1 2
$cx
$cx
$cx
$cx
$m 3 9
$m 2 8;

//***************************************
// LED flash, property 15 ***
//***************************************


// Set to 1 if the camera should expect LED support
//
// If white balance is set to auto - change to cloudy when using LED
//---------------------------------------------------
LED_WB_SET = 06 02 00 01 05 11 #CMD_END
05 02 00 20 05 #CMD_END
05 02 00 21 f4 #CMD_END
06 02 00 01 01 13 #CMD_END;
LED_WB_UNSET =05 02 00 20 00 #CMD_END
05 02 00 21 00 #CMD_END
06 02 00 01 01 13 #CMD_END
$u 01;


seq_set_prop_d_0= #LED_WB_UNSET;
seq_set_prop_d_1= #LED_WB_SET;
//****************************************
// Flash tube, property 16 ***
//****************************************


// Set to 1 if the camera should expect flash support
//
//---------------------------------------------------
seq_set_prop_e_0= 06 02 00 01 00 5a #CMD_END; //Off
seq_set_prop_e_1= 06 02 00 01 01 5a #CMD_END; //Force LED Fill Light Mode
seq_set_prop_e_2= 06 02 00 01 02 5a #CMD_END; //Automatic LED Fill Light Mode
seq_set_prop_e_3= 06 02 00 01 03 5a #CMD_END; //Forced Xenon Fill Light Mode
seq_set_prop_e_4= 06 02 00 01 04 5a #CMD_END; //Automatic Xenon Fill Light Mode

//************************************************
// Power save mode, property 17 ***
//************************************************
//
// 0 => Leave power save mode
// 1 => Enter power save mode
//
//---------------------------------------------------
seq_set_prop_f_0=06 02 00 01 00 5C #CMD_END #WAIT_FOR_POWER_SAVE_LEAVE
03 55 AA #CMD_END
07 04 20 80 00 05 0E #CMD_END
07 04 98 12 04 00 00 #CMD_END;

seq_set_prop_f_1=06 02 00 01 81 34 #CMD_END
#WAIT_FOR_MODE_TRANSITION
06 02 00 01 00 53 #CMD_END
06 02 00 01 01 5C #CMD_END #WAIT_FOR_POWER_SAVE_ENTER;

//************************************************
// Scene, property 18 *****
//************************************************

seq_set_prop_10=06 02 00 01 %0 51 #CMD_END;

//************************************************
// ISO, property 19 ***
//************************************************
//
// 0 => Auto 1 => 100 2 => 200
// 3 => 400 4 => 800 5 => 1600
//
// 6=>125 7=>160 8=>250 9=>320
// 10=>500 11=> 640 12=>1000 13=>1250
//
//---------------------------------------------------

seq_set_prop_11_0=06 02 00 01 00 05 #CMD_END;
seq_set_prop_11_1=06 02 00 01 01 05 #CMD_END;
seq_set_prop_11_2=06 02 00 01 04 05 #CMD_END;
seq_set_prop_11_3=06 02 00 01 07 05 #CMD_END;
seq_set_prop_11_4=06 02 00 01 0a 05 #CMD_END;
seq_set_prop_11_5=06 02 00 01 0d 05 #CMD_END;
seq_set_prop_11_6=06 02 00 01 02 05 #CMD_END;
seq_set_prop_11_7=06 02 00 01 03 05 #CMD_END;
seq_set_prop_11_8=06 02 00 01 05 05 #CMD_END;
seq_set_prop_11_9=06 02 00 01 06 05 #CMD_END;
seq_set_prop_11_a=06 02 00 01 08 05 #CMD_END;
seq_set_prop_11_b=06 02 00 01 09 05 #CMD_END;
seq_set_prop_11_c=06 02 00 01 0b 05 #CMD_END;
seq_set_prop_11_d=06 02 00 01 0c 05 #CMD_END;



//************************************************
// AE level, property 20 ***
//************************************************

seq_get_prop_12= 05 01 00 22 02 $f $r3 0 0 1;

//************************************************
// Brightness, property 21 ***
//************************************************
//
// 0 => Darkest .... 15 => Brightest
//
//---------------------------------------------------
seq_set_prop_13=06 02 00 01 %0 54 #CMD_END;



//************************************************
// Contrast, property 22 ***
//************************************************
//
// 0 => Lowest ..... 16 => Highest
//
//---------------------------------------------------
seq_set_prop_22=$s0 %0 $-0 08 06 02 00 01 $w0 55 #CMD_END;

//************************************************
// Sharpening, property 23 ***
//************************************************
//
// 0 => Lowest ..... 16 => Highest
//
//---------------------------------------------------
seq_set_prop_23=$s0 %0 $-4 08 06 02 00 01 $w1 56 #CMD_END;

//************************************************
// Focus test, property 24 ***
//************************************************
// Returns: 0xDDCCBBAA, where
// AA = AF value before scan
// BB = AF value 64 ms after start
// CC = AF value 128 ms after start
// DD = AF value 2 s after scan
//************************************************
seq_get_prop_16=05 01 00 2E 01 $f $r2 0 0
06 02 00 01 01 42 $f $d0080
05 01 00 2E 01 $f $r2 1 1 $d0080
05 01 00 2E 01 $f $r2 2 2 $d0710
05 01 00 2E 01 $f $r2 3 3;

//************************************************
// Focus test, property 25 ***
// Just returns read out AF value ***
//************************************************
seq_get_prop_17=05 01 00 2E 01 $f $r2 0 0;

//***************************************
// Spot, property 26 ***
//***************************************
seq_set_prop_18=; //TBD
seq_set_prop_18_0=06 02 00 01 00 08 #CMD_END;
seq_set_prop_18_1=06 02 00 01 01 08 #CMD_END;

//**************************************************
// Photo metering, property 27
//**************************************************

seq_set_prop_19_0 = #COM_EVENT(08,00); // Multimode, centerweighted
seq_set_prop_19_1 = #COM_EVENT(08,01); // Spot, centerspot

//**************************************************
// Check if flash needed, property 28
//**************************************************
// This property also changes scenes when flash is used.
seq_get_prop_17 =;


//**************************************************
// Image stabilization, property 29 ***
//**************************************************
seq_set_prop_18_0 =;

seq_set_prop_18_1 =;

//***************************************************
// Linear zoom, property 30 *****
//***************************************************
// 0 => Stop 1 => zoom in 2 => zoom out
//---------------------------------------------------
seq_set_prop_19_0 = #CMD(61,84);
seq_set_prop_19_1 = #SET(3d,01)
#SET(3e,01)
#CMD(61,04);
seq_set_prop_19_2 = #SET(3d,01)
#SET(3e,01)
#CMD(61,40);


//***************************************************
// Get zoom value, property 31 *****
//***************************************************

seq_get_prop_1a = ;

//**************************************************
// Snapshot operation, property 32 ****
//**************************************************
// 0 = Still Capture mode/IS Still Capture mode
// 1 = Burst output. Read out picture 1
// .
// .
// 9 = Burst output. Read out picture 9
//--------------------------------------------------

seq_set_prop_1b =;


//**************************************************
// Half release, property 33, **
//**************************************************

seq_set_prop_1c_0 = #CHANGE_MODE(34,01) // Draft mode
#COM_EVENT(43,00); // Go to infinity
seq_set_prop_1c_1 = #HALF_RELEASE; // Half-release mode


// --- Test Pattern property 33 (1e) -------------
// for ITP
// 0 => off, others
//------------------------------------------------
seq_set_prop_1e = #WRITE_IFP(#REGISTER_MODIFY(48, $b1 %0 0 3))
$s0 %0
$c0 00 #WRITE_IFP(06 64 8E)
$cl #WRITE_IFP(06 b0 1e)
#WRITE_CONTROL(62 10 10)
#WRITE_IFP(09 02 19)
$cx;




//================================================
//=============== SIZE CONFIGS ===================
//================================================

LOCK_NIGHT_FPS=05 02 00 08 #VR_NIGHT_MODE_FR #CMD_END // Draft mode frame rate max x fps
06 02 00 01 #VR_NIGHT_MODE_FR 03 #CMD_END // Slowshutter locked at min x fps
06 02 00 01 81 34 #CMD_END // Transition to draft mode at half rate => x/2 fps
#WAIT_FOR_MODE_TRANSITION;

LOCK_NORMAL_FPS=05 02 00 08 #VR_NORMAL_MODE_FR #CMD_END // Draft mode frame rate max x fps
06 02 00 01 #VR_NORMAL_MODE_FR 03 #CMD_END // Slowshutter locked at min x fps
06 02 00 01 81 34 #CMD_END // Transition to draft mode at half rate => x/2 fps
#WAIT_FOR_MODE_TRANSITION;

RELEASE_LOCK_FPS=$u07; // Set draft mode frame rate and do
// transition to draft mode according to property 7

//Remove this when differentiation between FP1.2 and FP1.3 cameras are no longer needed!
//VF_TRANSITION_DELAY=05 01 00 36 01 $f $r1 0 $c0 00 $d00c8 $cx;

VF_TRANSITION_DELAY=$d00c8;

//===============================================
//VF mode
//=============================================

// For viewfind turn off JPEG and set input size to 128x96
seq_vf_config_20= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0080) // Set Horizontal Output Size to 0x80 = 128
#WRITE_IFP(AA 0060) // Set Vertical Output Size A to 0x60 = 96
#WRITE_IFP(AE 0C09)
#WRITE_SENSOR(0D 00 08)
#FRAME_RATE_AUTO
$c9 01
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms ms (Old 1000)
#WRITE_CONTROL(2E 0C4A)
$cl
$cx
$"DORISsetuptest_VF32"
;

// For viewfinder and set input size to 128x160
seq_vf_config_21= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0080) // Set Horizontal Output Size to 0x80 = 128
#WRITE_IFP(AA 00A0)
#WRITE_IFP(AE 0C09)
#FRAME_RATE_AUTO
$c9 01
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms (Old 1000 ms)
#WRITE_CONTROL(2E 0C4A)
$cl

$cx
;

// For viewfind turn off JPEG and set input size to 128x96
seq_vf_config_22= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0080) // Set Horizontal Output Size to 0x80 = 128
#WRITE_IFP(AA 0060)// Set Vertical Output Size A to 0x60 = 96
#WRITE_IFP(AE 0C09)
#WRITE_SENSOR(0D 00 08)
#FRAME_RATE_AUTO
$c9 01
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms ms (Old 1000)
#WRITE_CONTROL(2E 0C4A)
$cl
$cx
$"DORISsetuptest_VF32"
;

// For viewfind turn off JPEG and set input size to 176x144 locked at 24fps
seq_vf_config_23 = #WRITE_IFP(A7 00B0)
#WRITE_IFP(AA 0090)
#WRITE_IFP(AE 0B09) // Aspect ratio 11:9
#WRITE_SENSOR(0D 00 08)
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms ms (Old 1000)
#WRITE_CONTROL(2E 0C4A)
$cl
$cx
;

// For viewfind turn off JPEG and set input size to 176x144 locked at 20fps
seq_vf_config_24 = #WRITE_IFP(A7 00B0)
#WRITE_IFP(AA 0090)
#WRITE_IFP(AE 0B09) // Aspect ratio 11:9
#WRITE_SENSOR(0D 00 08)
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms (Old 1000 ms)
#WRITE_CONTROL(2E 0C4A)
$cl
$cx
;
// For viewfind turn off JPEG and set input size to 128x102
seq_vf_config_25 = //#WRITE_CONTROL(37 $f $r2 0 1 $b0 01 7 1 37 $w0 $w1) //Force Auto Exposure Settings Reevaluation

#WRITE_IFP(A7 0080)
#WRITE_IFP(AA 0066)
#WRITE_IFP(AE 4033) // Aspect ratio 64:51 (close to 5:4)
#WRITE_SENSOR(0D 00 08)
$c9 01
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms ms (Old 1000)
#WRITE_CONTROL(2E 0C4A)
$cl
;

// For viewfind turn off JPEG and set input size to 128x96
seq_vf_config_26 = #WRITE_IFP(A7 0080)
#WRITE_IFP(AA 0060)
#WRITE_IFP(AE 0C09) // Aspect ratio 4:3
#WRITE_SENSOR(0D 00 08)
$c9 01
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms ms (Old 1000)
#WRITE_CONTROL(2E 0C4A)
$cl
$cx
;

// For viewfind turn off JPEG and set input size to 128x96
seq_vf_config_27 = #WRITE_IFP(A7 0080)
#WRITE_IFP(AA 0060)
#WRITE_IFP(AE 0C09) // Aspect ratio 4:3
#WRITE_SENSOR(0D 00 08)
$c9 01
#WRITE_CONTROL(37 0120) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms ms (Old 1000)
#WRITE_CONTROL(2E 0C4A)
$cl
$cx

;
// For viewfinder and set input size to 80x60
seq_vf_config_30= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0050)
#WRITE_IFP(AA 003C)//15fps
#WRITE_IFP(AE 0C09)
#FRAME_RATE_AUTO
$c9 01
#WRITE_CONTROL(37 0100) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms (Old 1000 ms)
#WRITE_CONTROL(2E 0C4A)
$cl

$cx
;

// For viewfinder and set input size to 80x60
seq_vf_config_31= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0050)
#WRITE_IFP(AA 0065)
#WRITE_IFP(AE 0C09)
#FRAME_RATE_AUTO
$c9 01
#WRITE_CONTROL(37 0100) //15 fps
#WRITE_CONTROL(2E 0000) //target 0
$d0064//pause 100 ms (Old 1000 ms)
#WRITE_CONTROL(2E 0C4A)
$cl

$cx
;


//==============================================
// VR mode
//==============================================

seq_vf_config_41= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0080)
#WRITE_IFP(AA 0060)
#WRITE_IFP(AE 0C09)
#FRAME_RATE_14
;

seq_vf_config_42= #WRITE_IFP(A6 024A)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(AA 0090)
#WRITE_IFP(AE 0B09)
#FRAME_RATE_14
;

seq_vf_config_43= #WRITE_IFP(A6 0280)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 0080)
#WRITE_IFP(AA 0060)
#WRITE_IFP(AE 0C09)
#FRAME_RATE_10
;

seq_vf_config_44= #WRITE_IFP(A6 024A)
#WRITE_IFP(A9 01E0)
#WRITE_IFP(A7 00B0)
#WRITE_IFP(AA 0090)
#WRITE_IFP(AE 0B09)
#FRAME_RATE_10
;

//==============================================================
// SS mode
//==============================================================

// Form YUV-SS turn off JPEG and set size to 640x480
seq_ss_config_1=
#WRITE_IFP(A1 0280)
#WRITE_IFP(A4 01e0)
#WRITE_IFP(AE C009)
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
;
// For JPEG-SS turn on JPEG and set input size to QVGA
seq_ss_config_2=
#WRITE_IFP(A1 0140)
#WRITE_IFP(A4 00F0)
#WRITE_IFP(AE C009)
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
;
// For JPEG-SS turn on JPEG and set input size to QQVGA
seq_ss_config_3=
#WRITE_IFP(A1 00A0)
#WRITE_IFP(A4 0078)
#WRITE_IFP(AE C009)
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
;

//For JPEG-SS turn on JPEG and set input size to 100 x 60 ;
seq_ss_config_4=
#WRITE_IFP(A1 0064)
#WRITE_IFP(A4 003C)
#WRITE_IFP(AE C009)
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
;

//For JPEG-SS turn on JPEG and set input size to 640 x 480 Snapshot VGA in UYV422
seq_ss_config_5=
#WRITE_IFP(A1 0280)
#WRITE_IFP(A4 01e0)
#WRITE_IFP(AE C009)
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
;

//For JPEG-SS turn on JPEG and set input size to 1280x960 Snapshot™ interpol 1,2MB Mode Expanded
seq_ss_config_6 =
#WRITE_IFP(A1 0500)
#WRITE_IFP(A4 03C0)
#WRITE_IFP(AE C009) //Fix BrAzUkA´s
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
;


// For JPEG-SS turn on JPEG and set input size to VGA
seq_ss_config_7 = #WRITE_IFP(A1 0280)
#WRITE_IFP(A4 01E0)
#WRITE_IFP(AE 0C09)
#WRITE_SENSOR(0D 0008) // Normal operation (Chip enable)
#SET_JPEG_ON(0280,01E0,095F)
;



// Init sequence
seq_init= $c9 01 //If flash attached at camera startup then keep flag set
$s9 01
$cl
$s9 00 //Else unset flag
$cx //Flash disabled, use internal reg 9 as a flag for the flash property
$s8 00 //Flash fire flag disabled => no flash fired. Reg 8 as flag.

#WRITE_IFP(A5 4000)

#WRITE_IFP(A8 4000)

#WRITE_IFP(AF 0000)

#LENS_CORRECTION_NORMAL

#COLOR_CORRECTION

#FRAME_RATE_AUTO

#LUMA_SET_SS

#ROW_NOISE_REDUCTION

#PIXEL_NOISE_REDUCTION

#WRITE_SENSOR(#REGISTER_MODIFY(20,$b1 00 0 1))


;


// Switch state 00 = VF 84 = SS
seq_vf_start=

$"DORISsetuptest_VF_start"
;

seq_vf_stop=
$"DORISsetuptest_VF_stop"
;

seq_ss_start=;

seq_ss_take=
#SEQ_FLASH_LIMIT $"DORIS_SEQ_FLASH_LIMIT"
$"DORIS_Status_int_reg_2check_8_%8"
$c8 01 //01 Should the flash be fired?
#SEQ_SET_FLASH $"DORIS Flash fired" //Set flash properties
#WRITE_CONTROL(CC 0002)
#WRITE_CONTROL(CB 0001)
$d0020 //Pause: 0x40/2
$cl
#WRITE_CONTROL(CC 0000)
#WRITE_CONTROL(CB 0001)
$d007F //Pause : 0xFF/2 for 13MHz
$cx
;

seq_ss_stop=
#WRITE_CONTROL(CC 0004)
#WRITE_CONTROL(CB 0001)
;



semoga bermanfaat * Maju terus indonesia dan tetap berhati-hati dalam hidup ini,semoga bermanfaat dan sukses semoga ALLAH slalu memberikan yang terbaik selamanya kepada galihrezah dan kekasihnya,,,amin hehehe makasih bentar ane mikir dulu buat postingan besok,,hehe hehehe jadi malu kabur ah..hahaha waduh kurang cepet ne balik lagi ah hehehe.. eh ga jadi kabur hihihi maaf-maaf kalau ane ada salah..hehe minum dulu gan salam kenal yah hehehe thanks for visiting this blog and CMIIW (Correct Me If I am Wrong).

0 komentar:

Posting Komentar