Index: format/app_mouse.format
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/format/app_mouse.format	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/format/app_mouse.format	(working copy)
@@ -399,6 +399,7 @@
 4 mem_mouse_24g_addr_temp
 
 1 mem_mouse_ice_sdio_for_sensor_angle
+1 mem_mouse_logo_enable_gpio0
 
 )
 
Index: output/eeprom.dat
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/output/eeprom.dat	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/output/eeprom.dat	(working copy)
@@ -2,7 +2,7 @@
 02
 aa
 55
-8e
+26
 03
 c2
 84
@@ -11,47 +11,51 @@
 c0
 1e
 80
-4c
+50
 c0
 23
 00
-53
+62
 c0
 26
 00
-5e
+6d
 c0
 27
 00
-6d
+8e
 c0
 29
 00
-80
+a1
 c0
 2d
 00
-41
+45
 c0
 2f
 00
-2c
+30
 c0
 2f
 80
-30
+34
 c0
 38
 00
-0e
+0f
 c0
 71
 80
-47
+4b
 20
 20
 3a
 8a
+c0
+30
+80
+59
 c1
 7f
 80
@@ -71,7 +75,7 @@
 20
 40
 00
-18
+19
 20
 40
 57
@@ -95,7 +99,7 @@
 20
 40
 00
-34
+38
 20
 20
 52
@@ -115,11 +119,7 @@
 20
 40
 00
-b9
-20
-40
-00
-d1
+b7
 d8
 40
 00
@@ -172,6 +172,10 @@
 20
 68
 83
+20
+40
+00
+2d
 70
 45
 e5
@@ -180,6 +184,18 @@
 20
 5b
 81
+6f
+e0
+c5
+c0
+67
+e0
+c6
+3f
+20
+60
+00
+00
 18
 42
 7e
@@ -223,7 +239,7 @@
 58
 00
 00
-39
+3d
 67
 e1
 45
@@ -283,7 +299,7 @@
 24
 5a
 00
-3f
+43
 20
 20
 5e
@@ -295,7 +311,7 @@
 c2
 80
 80
-4a
+4e
 20
 20
 3c
@@ -312,6 +328,14 @@
 40
 53
 39
+6f
+e0
+c9
+12
+c0
+00
+80
+54
 70
 80
 70
@@ -336,6 +360,42 @@
 20
 5a
 f0
+78
+34
+7c
+00
+20
+40
+3b
+1b
+6f
+e1
+c0
+be
+20
+3a
+74
+ca
+6f
+e0
+c0
+94
+20
+3a
+74
+ca
+6f
+e0
+c8
+99
+24
+7a
+00
+00
+20
+20
+4d
+1c
 1a
 62
 7e
@@ -387,7 +447,11 @@
 c0
 1e
 00
-61
+71
+c0
+1d
+00
+7d
 20
 20
 59
@@ -440,6 +504,74 @@
 20
 5e
 17
+6f
+e0
+c5
+4b
+24
+3a
+5d
+80
+6f
+e0
+c5
+2d
+c0
+01
+5d
+f4
+c0
+02
+00
+84
+c0
+01
+80
+89
+20
+20
+5d
+ed
+6f
+e4
+48
+64
+c3
+17
+dd
+ed
+6f
+e0
+c8
+6c
+c0
+00
+dd
+ed
+20
+20
+5d
+cb
+6f
+e4
+48
+64
+c3
+17
+dd
+ed
+c2
+89
+dd
+ed
+c2
+89
+5d
+ed
+20
+20
+5d
+c4
 20
 40
 53
@@ -495,7 +627,7 @@
 20
 40
 00
-7c
+9d
 20
 20
 5a
@@ -524,10 +656,6 @@
 0b
 80
 00
-20
-40
-00
-97
 df
 e0
 07
@@ -539,7 +667,7 @@
 20
 40
 00
-dd
+c3
 6f
 e2
 49
@@ -547,7 +675,7 @@
 20
 3a
 00
-8f
+af
 67
 e2
 49
@@ -575,7 +703,7 @@
 20
 20
 00
-85
+a5
 6f
 e2
 49
@@ -611,238 +739,6 @@
 df
 e0
 07
-60
-1f
-e2
-24
-00
-20
-40
-00
-c5
-6f
-e0
-c9
-07
-20
-3a
-00
-a3
-67
-e0
-c9
-06
-1a
-40
-a4
-01
-df
-e0
-07
-8f
-9a
-46
-7c
-00
-24
-61
-00
-00
-1a
-42
-7e
-00
-20
-20
-00
-99
-6f
-e0
-c9
-06
-1f
-e1
-7e
-f0
-20
-3a
-00
-ac
-6f
-e0
-c6
-3f
-67
-e0
-c9
-08
-df
-20
-00
-01
-1a
-42
-7e
-00
-da
-20
-49
-08
-20
-20
-68
-83
-6f
-e0
-c9
-06
-68
-48
-c6
-3f
-98
-46
-7c
-00
-20
-62
-80
-00
-18
-52
-04
-00
-98
-40
-fe
-00
-67
-e0
-c9
-08
-1a
-42
-7e
-00
-d8
-40
-07
-60
-98
-46
-7c
-00
-20
-22
-80
-a8
-1a
-40
-a5
-ff
-20
-20
-00
-a8
-df
-e0
-07
-60
-1f
-e2
-24
-00
-20
-40
-00
-c5
-6f
-e0
-c9
-07
-20
-3a
-00
-c8
-67
-e0
-c9
-06
-1a
-40
-a4
-01
-df
-e0
-07
-8f
-9a
-46
-7c
-00
-24
-21
-00
-c8
-1a
-42
-7e
-00
-20
-20
-00
-bb
-d8
-40
-00
-01
-da
-20
-49
-07
-20
-20
-68
-c5
-6f
-e0
-c9
-06
-1f
-e2
-26
-00
-1f
-e1
-7e
-f0
-20
-3a
-00
-ce
-1f
-f1
-fe
-00
-20
-20
-00
-cf
-1a
-62
-7e
-00
-67
-e0
-c6
-3f
-20
-60
-00
-00
-df
-e0
-07
 90
 1f
 e2
@@ -851,7 +747,7 @@
 20
 40
 00
-dd
+c3
 6f
 e2
 49
@@ -859,7 +755,7 @@
 20
 3a
 00
-e0
+c6
 67
 e2
 49
@@ -879,7 +775,7 @@
 24
 21
 00
-e0
+c6
 1a
 42
 7e
@@ -887,7 +783,7 @@
 20
 20
 00
-d3
+b9
 d8
 40
 00
@@ -912,8 +808,8 @@
 60
 00
 00
-50
-50
+a7
+f0
 aa
 55
 06
@@ -956,6 +852,13 @@
 08
 aa
 55
+01
+00
+2c
+40
+02
+aa
+55
 02
 00
 94
@@ -1015,7 +918,7 @@
 a0
 0f
 00
-04
+03
 aa
 55
 04
@@ -1102,6 +1005,18 @@
 7d
 aa
 55
+06
+00
+8b
+45
+74
+0e
+b8
+0b
+80
+0c
+aa
+55
 01
 00
 9f
@@ -1126,7 +1041,7 @@
 63
 75
 80
-00
+20
 01
 03
 06
@@ -1434,11 +1349,18 @@
 77
 01
 00
+aa
+55
+01
+00
+11
+49
+01
 55
 aa
 aa
 55
-93
-9c
-1e
-8c
+21
+a3
+0b
+c5
Index: output/memmap.format
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/output/memmap.format	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/output/memmap.format	(working copy)
@@ -1685,6 +1685,7 @@
 0x4909 mem_mouse_24g_addr_last
 0x490d mem_mouse_24g_addr_temp
 0x4911 mem_mouse_ice_sdio_for_sensor_angle
+0x4912 mem_mouse_logo_enable_gpio0
 0x443c mem_shutter_bluetooth_type
 0x443d mem_shutter_config_eeprom_offset_addr
 0x443f mem_shutter_config_eeprom_start_flag
Index: output/program.lis
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/output/program.lis	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/output/program.lis	(working copy)
@@ -1,44 +1,44 @@
               include "bt_format "
               org 0x0000
 0000 c284000c bbit1 8 ,pf_patch_ext 
-0001 c01e804c beq patch07_5 ,p_mouse_setgpio_hibernate 
-0002 c0230053 beq patch08_6 ,p_mouse_3io6key_check 
-0003 c026005e beq patch09_4 ,p_mouse_priority_bb_event 
-0004 c027006d beq patch09_6 ,p_mouse_bb_event_timer 
-0005 c0290080 beq patch0a_2 ,p_mouse_store_device_info 
-0006 c02d0041 beq patch0b_2 ,p_mouse_24g_package_data 
-0007 c02f002c beq patch0b_6 ,p_mouse_ui_led_off_static 
-0008 c02f8030 beq patch0b_7 ,p_mouse_ui_led_on_static 
-0009 c038000e beq patch0e_0 ,p_app_init 
-000a c0718047 beq patch1c_3 ,p_le_enable_phy_by_pdata 
+0001 c01e8050 beq patch07_5 ,p_mouse_setgpio_hibernate 
+0002 c0230062 beq patch08_6 ,p_mouse_3io6key_check 
+0003 c026006d beq patch09_4 ,p_mouse_priority_bb_event 
+0004 c027008e beq patch09_6 ,p_mouse_bb_event_timer 
+0005 c02900a1 beq patch0a_2 ,p_mouse_store_device_info 
+0006 c02d0045 beq patch0b_2 ,p_mouse_24g_package_data 
+0007 c02f0030 beq patch0b_6 ,p_mouse_ui_led_off_static 
+0008 c02f8034 beq patch0b_7 ,p_mouse_ui_led_on_static 
+0009 c038000f beq patch0e_0 ,p_app_init 
+000a c071804b beq patch1c_3 ,p_le_enable_phy_by_pdata 
 000b 20203a8a branch assert 
 
 pf_patch_ext:
-000c c17f8000 rtneq patch3f_7 
-000d 20203a8a branch assert 
+000c c0308059 beq patch2c_1 ,p_g24_lpm_wait 
+000d c17f8000 rtneq patch3f_7 
+000e 20203a8a branch assert 
 
 p_app_init:
 
 p_mouse_init:
-000e 70808073 jam 0x73 ,core_spid_ctrl 
-000f 20406eb3 call enable_authrom 
-0010 20400018 call p_mouse_setting_config 
-0011 204057a0 call mouse_init_sunt 
-0012 20758000 rtn wake 
-0013 204059bd call mouse_le_name_load 
-0014 2040562e call mouse_dpi_config 
-0015 20405cc5 call mouse_drawing_optima_init 
-0016 20400034 call p_mouse_cb_fuction 
-0017 20205234 branch mouse_init + 8 
+000f 70808073 jam 0x73 ,core_spid_ctrl 
+0010 20406eb3 call enable_authrom 
+0011 20400019 call p_mouse_setting_config 
+0012 204057a0 call mouse_init_sunt 
+0013 20758000 rtn wake 
+0014 204059bd call mouse_le_name_load 
+0015 2040562e call mouse_dpi_config 
+0016 20405cc5 call mouse_drawing_optima_init 
+0017 20400038 call p_mouse_cb_fuction 
+0018 20205234 branch mouse_init + 8 
 
 p_mouse_setting_config:
-0018 20758000 rtn wake 
-0019 2040525e call mouse_setting_config 
-001a c40b8000 rtnbit0 mouse_enable_otp 
+0019 20758000 rtn wake 
+001a 2040525e call mouse_setting_config 
+001b c40b8000 rtnbit0 mouse_enable_otp 
 
 p_mouse_load_otp_info_check:
-001b 204000b9 call p_mouse_read_otp_dpi 
-001c 204000d1 call p_mouse_read_otp_24g_addr 
+001c 204000b7 call p_mouse_read_otp_24g_addr 
 
 p_mouse_otp_load_app_initflag:
 001d d8400002 arg 2 ,temp 
@@ -58,259 +58,223 @@
 0029 20206883 branch otp_write 
 
 p_mouse_load_device_info:
-002a 7045e500 jam mode_24g_device ,mem_device_flag 
-002b 20205b81 branch mouse_load_device_info + 1 
+002a 2040002d call p_mouse_load_default_dpi 
+002b 7045e500 jam mode_24g_device ,mem_device_flag 
+002c 20205b81 branch mouse_load_device_info + 1 
+
+p_mouse_load_default_dpi:
+002d 6fe0c5c0 fetch 1 ,mem_config_sensor_dpi 
+002e 67e0c63f store 1 ,mem_mouse_dpi 
+002f 20600000 rtn 
 
 p_mouse_ui_led_off_static:
-002c 18427e00 copy temp ,pdata 
-002d 207a0000 rtn blank 
-002e c17f8000 rtneq gpio_disable 
-002f 20205f23 branch mouse_ui_led_off_static + 1 
-
-p_mouse_ui_led_on_static:
 0030 18427e00 copy temp ,pdata 
 0031 207a0000 rtn blank 
 0032 c17f8000 rtneq gpio_disable 
-0033 20205f30 branch mouse_ui_led_on_static + 1 
+0033 20205f23 branch mouse_ui_led_off_static + 1 
+
+p_mouse_ui_led_on_static:
+0034 18427e00 copy temp ,pdata 
+0035 207a0000 rtn blank 
+0036 c17f8000 rtneq gpio_disable 
+0037 20205f30 branch mouse_ui_led_on_static + 1 
 
 p_mouse_cb_fuction:
-0034 58005fad setarg mouse_24g_short_sleep 
-0035 67e14543 store 2 ,mem_cb_24g_transmit_short_sleep 
-0036 58000039 setarg p_mouse_24g_long_sleep 
-0037 67e14545 store 2 ,mem_cb_24g_transmit_long_sleep 
-0038 2020523d branch mouse_cb_fuction + 4 
+0038 58005fad setarg mouse_24g_short_sleep 
+0039 67e14543 store 2 ,mem_cb_24g_transmit_short_sleep 
+003a 5800003d setarg p_mouse_24g_long_sleep 
+003b 67e14545 store 2 ,mem_cb_24g_transmit_long_sleep 
+003c 2020523d branch mouse_cb_fuction + 4 
 
 p_mouse_24g_long_sleep:
-0039 20404d15 call g24_lpm_wait 
-003a 24740000 nrtn user 
-003b 6fe0c863 fetch 1 ,mem_24g_device_led_status 
-003c 247a0000 nrtn blank 
-003d 70490501 jam 1 ,mem_mouse_24g_long_sleep_flag 
-003e 20205fa6 branch mouse_24g_long_sleep + 4 
+003d 20404d15 call g24_lpm_wait 
+003e 24740000 nrtn user 
+003f 6fe0c863 fetch 1 ,mem_24g_device_led_status 
+0040 247a0000 nrtn blank 
+0041 70490501 jam 1 ,mem_mouse_24g_long_sleep_flag 
+0042 20205fa6 branch mouse_24g_long_sleep + 4 
 
 p_mouse_24g_short_sleep_clear_wake:
-003f 204074e0 call clear_wake 
-0040 20203c18 branch lpm_write_gpio_wakeup 
+0043 204074e0 call clear_wake 
+0044 20203c18 branch lpm_write_gpio_wakeup 
 
 p_mouse_24g_package_data:
-0041 2040549b call mouse_motion 
-0042 24740000 nrtn user 
-0043 6fe0c905 fetch 1 ,mem_mouse_24g_long_sleep_flag 
-0044 70490500 jam 0 ,mem_mouse_24g_long_sleep_flag 
-0045 245a003f ncall p_mouse_24g_short_sleep_clear_wake ,blank 
-0046 20205e35 branch mouse_24g_package_data + 4 
+0045 2040549b call mouse_motion 
+0046 24740000 nrtn user 
+0047 6fe0c905 fetch 1 ,mem_mouse_24g_long_sleep_flag 
+0048 70490500 jam 0 ,mem_mouse_24g_long_sleep_flag 
+0049 245a0043 ncall p_mouse_24g_short_sleep_clear_wake ,blank 
+004a 20205e35 branch mouse_24g_package_data + 4 
 
 p_le_enable_phy_by_pdata:
-0047 18427e00 copy temp ,pdata 
-0048 c280804a bbit1 bit_le_2m_phy ,p_le_enable_2m 
-0049 20203ce3 branch le_enable_phy_by_pdata + 3 
+004b 18427e00 copy temp ,pdata 
+004c c280804e bbit1 bit_le_2m_phy ,p_le_enable_2m 
+004d 20203ce3 branch le_enable_phy_by_pdata + 3 
 
 p_le_enable_2m:
-004a 708a6d89 jam 0x89 ,core_rx_bq_cfg0 
-004b 20203ce9 branch le_enable_2m 
+004e 708a6d89 jam 0x89 ,core_rx_bq_cfg0 
+004f 20203ce9 branch le_enable_2m 
 
 p_mouse_setgpio_hibernate:
-004c 20405339 call mouse_setgpio_hibernate + 1 
-004d 70807080 jam 0x80 ,0x8070 
-004e 6fe08017 fetch 1 ,mem_gpio_wakeup_low + 1 
-004f 79207e05 set1 5 ,pdata 
-0050 67e08017 store 1 ,mem_gpio_wakeup_low + 1 
-0051 20403c18 call lpm_write_gpio_wakeup 
-0052 20205af0 branch mouse_1io2led_all_off 
+0050 20405339 call mouse_setgpio_hibernate + 1 
+0051 6fe0c912 fetch 1 ,mem_mouse_logo_enable_gpio0 
+0052 c0008054 beq 1 ,p_mouse_setgpio_hibernate_next 
+0053 70807080 jam 0x80 ,0x8070 
+
+p_mouse_setgpio_hibernate_next:
+0054 6fe08017 fetch 1 ,mem_gpio_wakeup_low + 1 
+0055 79207e05 set1 5 ,pdata 
+0056 67e08017 store 1 ,mem_gpio_wakeup_low + 1 
+0057 20403c18 call lpm_write_gpio_wakeup 
+0058 20205af0 branch mouse_1io2led_all_off 
+
+p_g24_lpm_wait:
+0059 78347c00 enable user 
+005a 20403b1b call lpo_calibration 
+005b 6fe1c0be fetch 3 ,mem_clks_per_lpo 
+005c 203a74ca branch disable_user ,blank 
+005d 6fe0c094 fetch 1 ,mem_lpm_mode 
+005e 203a74ca branch disable_user ,blank 
+005f 6fe0c899 fetch 1 ,mem_sensor_shutdown_flag 
+0060 247a0000 nrtn blank 
+0061 20204d1c branch g24_lpm_wait_next 
 
 p_mouse_3io6key_check:
-0053 1a627e00 copy regc ,pdata 
-0054 67e0c850 store 1 ,mem_mouse_key_status 
-0055 1fe3fe00 lshift pdata ,pdata 
-0056 1fe22400 copy pdata ,regb 
-0057 18422600 copy temp ,regc 
-0058 2040547b call mouse_gpio_config_input_pd 
-0059 1a620400 copy regc ,temp 
-005a 20406b85 call gpio_get_bit 
-005b 7d20a400 nsetflag true ,0 ,regb 
-005c 20405753 call mouse_check_press 
-005d 2020573f branch mouse_check_key_connect_gnd_1 
+0062 1a627e00 copy regc ,pdata 
+0063 67e0c850 store 1 ,mem_mouse_key_status 
+0064 1fe3fe00 lshift pdata ,pdata 
+0065 1fe22400 copy pdata ,regb 
+0066 18422600 copy temp ,regc 
+0067 2040547b call mouse_gpio_config_input_pd 
+0068 1a620400 copy regc ,temp 
+0069 20406b85 call gpio_get_bit 
+006a 7d20a400 nsetflag true ,0 ,regb 
+006b 20405753 call mouse_check_press 
+006c 2020573f branch mouse_check_key_connect_gnd_1 
 
 p_mouse_priority_bb_event:
-005e 1a627e00 copy regc ,pdata 
-005f c01e0061 beq bt_evt_24g_attempt_success ,p_mouse_24g_attempt_success 
-0060 20205914 branch mouse_priority_bb_event + 2 
+006d 1a627e00 copy regc ,pdata 
+006e c01e0071 beq bt_evt_24g_attempt_success ,p_mouse_24g_attempt_success 
+006f c01d007d beq bt_evt_24g_attempt_fail ,p_mouse_24g_attempt_fail 
+0070 20205914 branch mouse_priority_bb_event + 2 
 
 p_mouse_24g_attempt_success:
-0061 6fe244da fetch 4 ,mem_24g_addr 
-0062 67e24533 store 4 ,mem_24g_receiver_addr 
-0063 67e24640 store 4 ,mem_mouse_24g_addr 
-0064 20404bce call g24_ch_syncword_crc8_init 
-0065 20405e1b call mouse_device_poweron_led_config 
-0066 20405aa9 call mouse_no_data_timer_init 
-0067 204058c4 call mouse_init_sensor_reset 
-0068 70476800 jam 0 ,mem_mouse_long_mult_flag 
-0069 70454700 jam 0 ,mem_24g_conn_sm 
-006a 70452d00 jam 0 ,mem_24g_reconn_type 
-006b 684a4533 fetcht 4 ,mem_24g_receiver_addr 
-006c 20205e17 branch mouse_24g_attempt_success + 11 
+0071 6fe244da fetch 4 ,mem_24g_addr 
+0072 67e24533 store 4 ,mem_24g_receiver_addr 
+0073 67e24640 store 4 ,mem_mouse_24g_addr 
+0074 20404bce call g24_ch_syncword_crc8_init 
+0075 20405e1b call mouse_device_poweron_led_config 
+0076 20405aa9 call mouse_no_data_timer_init 
+0077 204058c4 call mouse_init_sensor_reset 
+0078 70476800 jam 0 ,mem_mouse_long_mult_flag 
+0079 70454700 jam 0 ,mem_24g_conn_sm 
+007a 70452d00 jam 0 ,mem_24g_reconn_type 
+007b 684a4533 fetcht 4 ,mem_24g_receiver_addr 
+007c 20205e17 branch mouse_24g_attempt_success + 11 
+
+p_mouse_24g_attempt_fail:
+007d 6fe0c54b fetch 1 ,mem_24g_attempt_fail_flag 
+007e 243a5d80 nbranch mouse_24g_hibernate_set ,blank 
+007f 6fe0c52d fetch 1 ,mem_24g_reconn_type 
+0080 c0015df4 beq fast_conn_and_3_0_addr ,mouse_24g_fast_conn_attempt_fail 
+0081 c0020084 beq pair_and_3_0_addr ,p_mouse_24g_auto_pair_attempt_fail 
+0082 c0018089 beq receiver_and_3_0_addr ,p_mouse_reconn_dongle_attempt_fail 
+0083 20205ded branch mouse_24g_attempt_fail_enter_hibernate_next 
+
+p_mouse_24g_auto_pair_attempt_fail:
+0084 6fe44864 fetch mouse_flag_len ,mem_mouse_flag 
+0085 c317dded bbit0 mouse_enable_24g_first_auto_pairing ,mouse_24g_attempt_fail_enter_hibernate_next 
+0086 6fe0c86c fetch 1 ,mem_device_number 
+0087 c000dded beq 1 ,mouse_24g_attempt_fail_enter_hibernate_next 
+0088 20205dcb branch mouse_24g_first_bluetooth_reconnect 
+
+p_mouse_reconn_dongle_attempt_fail:
+0089 6fe44864 fetch mouse_flag_len ,mem_mouse_flag 
+008a c317dded bbit0 mouse_enable_24g_first_auto_pairing ,mouse_24g_attempt_fail_enter_hibernate_next 
+008b c289dded bbit1 mouse_enable_eeprom ,mouse_24g_attempt_fail_enter_hibernate_next 
+008c c2895ded bbit1 mouse_enable_flash ,mouse_24g_attempt_fail_enter_hibernate_next 
+008d 20205dc4 branch mouse_24g_start_auto_pair + 1 
 
 p_mouse_bb_event_timer:
-006d 204053c6 call mouse_adc_read 
-006e 20405f47 call mouse_low_voltage_led_timer 
-006f 20404907 call g24_pair_timeout_timer 
-0070 20404ba5 call g24_reconn_timeout_timer 
-0071 20405d6b call mouse_24g_long_sleep_param_update_timer 
-0072 20405e9a call mouse_device_poweron_timer 
-0073 20405ecb call mouse_dpi_led_blink_delay_timer 
-0074 20405ac1 call mouse_led_multi_timer 
-0075 20405af3 call mouse_logo_led_on_timer 
-0076 2040561c call mouse_dpi_key_check_long_press 
-0077 20405a36 call mouse_bt_discovery_check 
-0078 20405a46 call mouse_commbination_key_process 
-0079 20405a69 call mouse_check_discovery_timeout_timer 
-007a 2040007c call p_mouse_check_direct_timeout_timer 
-007b 20205a2d branch mouse_bb_event_timer + 15 
+008e 204053c6 call mouse_adc_read 
+008f 20405f47 call mouse_low_voltage_led_timer 
+0090 20404907 call g24_pair_timeout_timer 
+0091 20404ba5 call g24_reconn_timeout_timer 
+0092 20405d6b call mouse_24g_long_sleep_param_update_timer 
+0093 20405e9a call mouse_device_poweron_timer 
+0094 20405ecb call mouse_dpi_led_blink_delay_timer 
+0095 20405ac1 call mouse_led_multi_timer 
+0096 20405af3 call mouse_logo_led_on_timer 
+0097 2040561c call mouse_dpi_key_check_long_press 
+0098 20405a36 call mouse_bt_discovery_check 
+0099 20405a46 call mouse_commbination_key_process 
+009a 20405a69 call mouse_check_discovery_timeout_timer 
+009b 2040009d call p_mouse_check_direct_timeout_timer 
+009c 20205a2d branch mouse_bb_event_timer + 15 
 
 p_mouse_check_direct_timeout_timer:
-007c da604831 arg mem_mouse_direct_timer ,regc 
-007d da405a74 arg mouse_check_direct_timeout ,regb 
-007e 20404dcc call timer_single_step 
-007f 20205a71 branch mouse_check_direct_timeout_timer + 3 
+009d da604831 arg mem_mouse_direct_timer ,regc 
+009e da405a74 arg mouse_check_direct_timeout ,regb 
+009f 20404dcc call timer_single_step 
+00a0 20205a71 branch mouse_check_direct_timeout_timer + 3 
 
 p_mouse_store_device_info:
-0080 20405b90 call mouse_store_device_info + 1 
-0081 c40b8000 rtnbit0 mouse_enable_otp 
+00a1 20405b90 call mouse_store_device_info + 1 
+00a2 c40b8000 rtnbit0 mouse_enable_otp 
 
 p_mouse_store_otp_device_info:
-0082 20400097 call p_mouse_otp_store_dpi 
 
 p_mouse_otp_store_24g_addr:
-0083 dfe00790 arg otp_offset_24g_addr ,pdata 
-0084 1fe22400 copy pdata ,regb 
+00a3 dfe00790 arg otp_offset_24g_addr ,pdata 
+00a4 1fe22400 copy pdata ,regb 
 
 p_mouse_otp_store_24g_addr_loop:
-0085 204000dd call p_mouse_read_otp_24g_addr_common 
-0086 6fe2490d fetch 4 ,mem_mouse_24g_addr_temp 
-0087 203a008f branch p_mouse_24g_addr_store ,blank 
-0088 67e24909 store 4 ,mem_mouse_24g_addr_last 
-0089 1a40a404 increase 4 ,regb 
-008a dfe007cf arg otp_offset_24g_addr_end ,pdata 
-008b 9a467c00 isub regb ,null 
-008c 24610000 nrtn positive 
-008d 1a427e00 copy regb ,pdata 
-008e 20200085 branch p_mouse_otp_store_24g_addr_loop 
+00a5 204000c3 call p_mouse_read_otp_24g_addr_common 
+00a6 6fe2490d fetch 4 ,mem_mouse_24g_addr_temp 
+00a7 203a00af branch p_mouse_24g_addr_store ,blank 
+00a8 67e24909 store 4 ,mem_mouse_24g_addr_last 
+00a9 1a40a404 increase 4 ,regb 
+00aa dfe007cf arg otp_offset_24g_addr_end ,pdata 
+00ab 9a467c00 isub regb ,null 
+00ac 24610000 nrtn positive 
+00ad 1a427e00 copy regb ,pdata 
+00ae 202000a5 branch p_mouse_otp_store_24g_addr_loop 
 
 p_mouse_24g_addr_store:
-008f 6fe24909 fetch 4 ,mem_mouse_24g_addr_last 
-0090 684a4640 fetcht 4 ,mem_mouse_24g_addr 
-0091 98467c00 isub temp ,null 
-0092 20628000 rtn zero 
-0093 df200004 arg 4 ,loopcnt 
-0094 da204640 arg mem_mouse_24g_addr ,rega 
-0095 1a427e00 copy regb ,pdata 
-0096 20206883 branch otp_write 
-
-p_mouse_otp_store_dpi:
-0097 dfe00760 arg otp_offset_dpi ,pdata 
-0098 1fe22400 copy pdata ,regb 
-
-p_mouse_otp_store_dpi_loop:
-0099 204000c5 call p_mouse_read_otp_dpi_common 
-009a 6fe0c907 fetch 1 ,mem_mouse_dpi_temp 
-009b 203a00a3 branch p_mouse_dpi_store ,blank 
-009c 67e0c906 store 1 ,mem_mouse_dpi_last 
-009d 1a40a401 increase 1 ,regb 
-009e dfe0078f arg otp_offset_dpi_end ,pdata 
-009f 9a467c00 isub regb ,null 
-00a0 24610000 nrtn positive 
-00a1 1a427e00 copy regb ,pdata 
-00a2 20200099 branch p_mouse_otp_store_dpi_loop 
-
-p_mouse_dpi_store:
-00a3 6fe0c906 fetch 1 ,mem_mouse_dpi_last 
-00a4 1fe17ef0 and pdata ,0xf0 ,pdata 
-00a5 203a00ac branch p_mouse_dpi_store_next ,blank 
-00a6 6fe0c63f fetch 1 ,mem_mouse_dpi 
-00a7 67e0c908 store 1 ,mem_mouse_otp_dpi_value 
-
-p_mouse_dpi_store_end:
-00a8 df200001 arg 1 ,loopcnt 
-00a9 1a427e00 copy regb ,pdata 
-00aa da204908 arg mem_mouse_otp_dpi_value ,rega 
-00ab 20206883 branch otp_write 
-
-p_mouse_dpi_store_next:
-00ac 6fe0c906 fetch 1 ,mem_mouse_dpi_last 
-00ad 6848c63f fetcht 1 ,mem_mouse_dpi 
-00ae 98467c00 isub temp ,null 
-00af 20628000 rtn zero 
-00b0 18520400 lshift4 temp ,temp 
-00b1 9840fe00 iadd temp ,pdata 
-00b2 67e0c908 store 1 ,mem_mouse_otp_dpi_value 
-00b3 1a427e00 copy regb ,pdata 
-00b4 d8400760 arg otp_offset_dpi ,temp 
-00b5 98467c00 isub temp ,null 
-00b6 202280a8 branch p_mouse_dpi_store_end ,zero 
-00b7 1a40a5ff increase -1 ,regb 
-00b8 202000a8 branch p_mouse_dpi_store_end 
-
-p_mouse_read_otp_dpi:
-00b9 dfe00760 arg otp_offset_dpi ,pdata 
-00ba 1fe22400 copy pdata ,regb 
-
-p_mouse_read_otp_dpi_loop:
-00bb 204000c5 call p_mouse_read_otp_dpi_common 
-00bc 6fe0c907 fetch 1 ,mem_mouse_dpi_temp 
-00bd 203a00c8 branch p_mouse_dpi_load ,blank 
-00be 67e0c906 store 1 ,mem_mouse_dpi_last 
-00bf 1a40a401 increase 1 ,regb 
-00c0 dfe0078f arg otp_offset_dpi_end ,pdata 
-00c1 9a467c00 isub regb ,null 
-00c2 242100c8 nbranch p_mouse_dpi_load ,positive 
-00c3 1a427e00 copy regb ,pdata 
-00c4 202000bb branch p_mouse_read_otp_dpi_loop 
-
-p_mouse_read_otp_dpi_common:
-00c5 d8400001 arg 1 ,temp 
-00c6 da204907 arg mem_mouse_dpi_temp ,rega 
-00c7 202068c5 branch otpd_read_data_with_pwr_operation 
-
-p_mouse_dpi_load:
-00c8 6fe0c906 fetch 1 ,mem_mouse_dpi_last 
-00c9 1fe22600 copy pdata ,regc 
-00ca 1fe17ef0 and pdata ,0xf0 ,pdata 
-00cb 203a00ce branch p_mouse_dpi_load_next ,blank 
-00cc 1ff1fe00 rshift4 pdata ,pdata 
-00cd 202000cf branch p_mouse_dpi_load_end 
-
-p_mouse_dpi_load_next:
-00ce 1a627e00 copy regc ,pdata 
-
-p_mouse_dpi_load_end:
-00cf 67e0c63f store 1 ,mem_mouse_dpi 
-00d0 20600000 rtn 
+00af 6fe24909 fetch 4 ,mem_mouse_24g_addr_last 
+00b0 684a4640 fetcht 4 ,mem_mouse_24g_addr 
+00b1 98467c00 isub temp ,null 
+00b2 20628000 rtn zero 
+00b3 df200004 arg 4 ,loopcnt 
+00b4 da204640 arg mem_mouse_24g_addr ,rega 
+00b5 1a427e00 copy regb ,pdata 
+00b6 20206883 branch otp_write 
 
 p_mouse_read_otp_24g_addr:
-00d1 dfe00790 arg otp_offset_24g_addr ,pdata 
-00d2 1fe22400 copy pdata ,regb 
+00b7 dfe00790 arg otp_offset_24g_addr ,pdata 
+00b8 1fe22400 copy pdata ,regb 
 
 p_mouse_read_otp_24g_addr_loop:
-00d3 204000dd call p_mouse_read_otp_24g_addr_common 
-00d4 6fe2490d fetch 4 ,mem_mouse_24g_addr_temp 
-00d5 203a00e0 branch p_mouse_24g_addr_load ,blank 
-00d6 67e24909 store 4 ,mem_mouse_24g_addr_last 
-00d7 1a40a404 increase 4 ,regb 
-00d8 dfe007cf arg otp_offset_24g_addr_end ,pdata 
-00d9 9a467c00 isub regb ,null 
-00da 242100e0 nbranch p_mouse_24g_addr_load ,positive 
-00db 1a427e00 copy regb ,pdata 
-00dc 202000d3 branch p_mouse_read_otp_24g_addr_loop 
+00b9 204000c3 call p_mouse_read_otp_24g_addr_common 
+00ba 6fe2490d fetch 4 ,mem_mouse_24g_addr_temp 
+00bb 203a00c6 branch p_mouse_24g_addr_load ,blank 
+00bc 67e24909 store 4 ,mem_mouse_24g_addr_last 
+00bd 1a40a404 increase 4 ,regb 
+00be dfe007cf arg otp_offset_24g_addr_end ,pdata 
+00bf 9a467c00 isub regb ,null 
+00c0 242100c6 nbranch p_mouse_24g_addr_load ,positive 
+00c1 1a427e00 copy regb ,pdata 
+00c2 202000b9 branch p_mouse_read_otp_24g_addr_loop 
 
 p_mouse_read_otp_24g_addr_common:
-00dd d8400004 arg 4 ,temp 
-00de da20490d arg mem_mouse_24g_addr_temp ,rega 
-00df 202068c5 branch otpd_read_data_with_pwr_operation 
+00c3 d8400004 arg 4 ,temp 
+00c4 da20490d arg mem_mouse_24g_addr_temp ,rega 
+00c5 202068c5 branch otpd_read_data_with_pwr_operation 
 
 p_mouse_24g_addr_load:
-00e0 6fe24909 fetch 4 ,mem_mouse_24g_addr_last 
-00e1 67e24640 store 4 ,mem_mouse_24g_addr 
-00e2 20600000 rtn 
+00c6 6fe24909 fetch 4 ,mem_mouse_24g_addr_last 
+00c7 67e24640 store 4 ,mem_mouse_24g_addr 
+00c8 20600000 rtn 
               org 0x3800
 
 start:
@@ -7404,6 +7368,8 @@
 4d19 203a74ca branch disable_user ,blank 
 4d1a 6fe0c094 fetch 1 ,mem_lpm_mode 
 4d1b 203a74ca branch disable_user ,blank 
+
+g24_lpm_wait_next:
 4d1c 6fe0c563 fetch 1 ,mem_24g_transmit_by_interrupt 
 4d1d c000f4ca beq g24_tx_timer_int_enable ,disable_user 
 4d1e 20600000 rtn 
@@ -9403,6 +9369,8 @@
 5290 245a48e4 ncall g24_chamap_param_update ,blank 
 5291 2040526c call mouse_xtal_init 
 5292 204053a6 call mouse_adc_vol_init 
+
+mouse_default_init_next:
 5293 20405271 call mouse_24g_phy_select 
 5294 20405d72 call mouse_24g_long_sleep_set 
 5295 20204900 branch g24_pair_param_init 
@@ -13425,6 +13393,8 @@
 mouse_24g_attempt_fail_enter_hibernate:
 5deb 6fe44864 fetch mouse_flag_len ,mem_mouse_flag 
 5dec c29e5d80 bbit1 mouse_enable_wheel_wake_up_cancel ,mouse_24g_hibernate_set 
+
+mouse_24g_attempt_fail_enter_hibernate_next:
 5ded 20405efb call mouse_device_led_off 
 5dee 20405da6 call mouse_24g_stop 
 5def 6fe0c76a fetch 1 ,mem_reconn_times 
Index: program/app_mouse.prog
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/program/app_mouse.prog	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/program/app_mouse.prog	(working copy)
@@ -123,7 +123,8 @@
 	ncall g24_chamap_param_update,blank
 
 	call mouse_xtal_init
-	call mouse_adc_vol_init	
+	call mouse_adc_vol_init
+mouse_default_init_next:
 	call mouse_24g_phy_select
 	call mouse_24g_long_sleep_set
 	branch g24_pair_param_init
@@ -4102,6 +4103,7 @@
 mouse_24g_attempt_fail_enter_hibernate:
 	fetch MOUSE_FLAG_LEN,mem_mouse_flag
 	bbit1 MOUSE_ENABLE_WHEEL_WAKE_UP_CANCEL,mouse_24g_hibernate_set
+mouse_24g_attempt_fail_enter_hibernate_next:
 	call mouse_device_led_off
 	call mouse_24g_stop
 	fetch 1,mem_reconn_times
Index: program/g24_protocol_stack/24g_transmitter.prog
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/program/g24_protocol_stack/24g_transmitter.prog	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/program/g24_protocol_stack/24g_transmitter.prog	(working copy)
@@ -290,6 +290,7 @@
 	branch disable_user,blank
 	fetch 1,mem_lpm_mode
 	branch disable_user,blank
+g24_lpm_wait_next:
 	fetch 1,mem_24g_transmit_by_interrupt
 	beq G24_TX_TIMER_INT_ENABLE,disable_user
 	rtn
Index: program/patch.prog
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/program/patch.prog	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/program/patch.prog	(working copy)
@@ -1,11 +1,17 @@
 
-//define G24_NEW_REVISION
 //define SENSOR_ANGLE_ICE_SDIO
+//define DPI_LOAD_AND_STORE
+//define ADC_ENABLE
 
 	bbit1 8,pf_patch_ext
 ifdef SENSOR_ANGLE_ICE_SDIO
 	beq patch06_7,p_mouse_sensor_set_angle
 endif
+ifdef ADC_ENABLE
+	beq patch00_0,p_soft_reset
+	beq patch14_0,p_enable_adc
+	beq patch07_7,p_mouse_adc_gpio_check_output
+endif
 	beq patch07_5,p_mouse_setgpio_hibernate
 	beq patch08_6,p_mouse_3io6key_check
 	beq patch09_4,p_mouse_priority_bb_event
@@ -19,9 +25,7 @@
 	branch assert
 	
 pf_patch_ext:
-ifdef G24_NEW_REVISION
-	beq patch2b_1,p_g24_transmit_no_interrupt
-endif
+	beq patch2c_1,p_g24_lpm_wait
 	rtneq patch3f_7
 	branch assert
 
@@ -46,7 +50,9 @@
 	call mouse_setting_config
 	rtnbit0 MOUSE_ENABLE_OTP
 p_mouse_load_otp_info_check:
+ifdef DPI_LOAD_AND_STORE
 	call p_mouse_read_otp_dpi
+endif
 	call p_mouse_read_otp_24g_addr
 p_mouse_otp_load_app_initflag:
 	arg 2,temp
@@ -66,9 +72,23 @@
 	branch otp_write
 
 p_mouse_load_device_info:
+ifdef DPI_LOAD_AND_STORE
+	arg OTP_OFFSET_DPI,pdata
+	call p_mouse_read_otp_dpi_common			
+	fetch 1,mem_mouse_dpi_temp
+	call p_mouse_load_default_dpi,blank
+else
+	call p_mouse_load_default_dpi
+endif	
 	jam MODE_24G_DEVICE,mem_device_flag
 	branch mouse_load_device_info+1
 
+p_mouse_load_default_dpi:
+	fetch 1,mem_config_sensor_dpi
+	store 1,mem_mouse_dpi
+	rtn
+
+
 
 p_mouse_ui_led_off_static:
 	copy temp,pdata
@@ -114,11 +134,7 @@
 endif
 	
 p_mouse_cb_fuction:
-ifdef G24_NEW_REVISION
-	setarg p_mouse_24g_short_sleep
-else
 	setarg mouse_24g_short_sleep
-endif	
 	store 2,mem_cb_24g_transmit_short_sleep
 	setarg p_mouse_24g_long_sleep
 	store 2,mem_cb_24g_transmit_long_sleep
@@ -143,170 +159,6 @@
 	jam 0,mem_mouse_24g_long_sleep_flag
 	ncall p_mouse_24g_short_sleep_clear_wake,blank	
 	branch mouse_24g_package_data+4
-	
-	
-ifdef G24_NEW_REVISION		
-p_mouse_24g_short_sleep:
-	fetch 1,mem_mouse_sleep_deal_type
-	branch g24_short_sleep,blank
-	call g24_lpm_wait
-	nrtn user
-	fetch 1,mem_24g_device_led_status
-	nrtn blank
-	fetch 1,mem_mouse_24g_sleep_miss
-	jam 0,mem_mouse_24g_sleep_miss
-	sub pdata,0,null
-	nbranch p_mouse_24g_short_sleep_last_miss,zero
-	fetcht 2,mem_24g_retransmit
-	sub temp,0,null
-	branch p_mouse_24g_short_sleep_default,zero
-
-	fetch 4,mem_mouse_24g_tx_time_last_delt
-	branch p_mouse_24g_short_sleep_default,blank
-p_mouse_24g_short_sleep_last_miss:	
-	fetcht 4,mem_mouse_24g_sleep_miss_temp
-	isolate1 31,temp
-	branch p_mouse_24g_sub_miss_temp,true
-	fetch 4,mem_mouse_24g_tx_time_last_delt
-	iadd temp,pdata	
-p_mouse_24g_short_sleep_notify:
-	fetcht 4,mem_mouse_24g_tsniff
-	isub temp,temp
-	storet 4,mem_mouse_24g_sleep_miss_temp
-	nbranch p_mouse_24g_short_sleep_long,positive
-	fetch 3,mem_24g_short_sleep_set
-	isub temp,pdata
-	nbranch mouse_24g_short_sleep_2,positive
-	arg 0x600,temp
-	isub temp,null
-	nbranch mouse_24g_short_sleep_2,positive
-p_mouse_24g_short_sleep2:
-//	call clk2lpo
-//	storet 4,mem_sleep_counter
-//p_lpm_short_sleep:
-//	fetch 1,mem_fcomp_div
-//	beq XTAL_16M,p_lpm_short_sleep_skip_pll_set
-//	setarg 0
-//	store 3,core_clkpll_ctrl0// close pll
-//p_lpm_short_sleep_skip_pll_set:
-//	jam 250,mem_mouse_24g_tx_time_offset
-//	branch lpm_sleep
-	jam 250,mem_mouse_24g_tx_time_offset
-	branch mouse_24g_short_sleep3
-
-
-
-p_mouse_24g_short_sleep_default:
-	call mouse_24g_miss_temp_clear
-	fetch 3,mem_24g_short_sleep_set
-	branch p_mouse_24g_short_sleep2
-
-p_mouse_24g_short_sleep_long:
-	sub temp,0,temp
-	fetch 3,mem_24g_short_sleep_set
-	iadd temp,pdata
-	branch p_mouse_24g_short_sleep2
-
-p_mouse_24g_sub_miss_temp:
-	arg -1,pdata
-	isub temp,regext
-	fetch 4,mem_mouse_24g_tx_time_last_delt
-	isub regext,pdata
-	branch p_mouse_24g_short_sleep_notify
-
-
-p_g24_transmit_no_interrupt:
-	call g24_txdata_prep
-	nbranch p_g24_nodata_transmit,user
-p_g24_transmit_start:
-	call p_g24_transmit_process
-	branch g24_transmit_start+1
-
-p_g24_nodata_transmit:
-	fetch 1,mem_24g_abort_pac
-	call p_g24_send_abort_packet,blank
-	branch g24_nodata_transmit+2
-p_g24_send_abort_packet:
-	jam TYPE_MS,mem_24g_data_type
-	jam 1,mem_24g_abort_pac
-	call g24_transmit_rf_ctrl_clear
-	store 1,mem_24g_txbuf
-	setarg 0
-	store 7,mem_24g_txbuf+1
-	fetch 4,mem_24g_device_addr
-	store 4,mem_24g_txbuf+8
-	jam 12,mem_24g_datalen
-	fetch 1,mem_24g_data_type
-	set1 bit_abort,pdata
-	store 1,mem_24g_data_type
-	call g24_transmit_prep
-	branch p_g24_transmit_start
-
-p_g24_transmit_process:
-	setarg 0
-	store 1,mem_24g_retry
-	store 2,mem_24g_retransmit
-p_g24_transmit_loop:
-	call g24_transmit_receive_ack
-//	fetch 1,mem_24g_no_ack	//tx noack
-//	beq no_ack_24g,g24_transmit_no_ack
-	nbranch p_g24_retransmit,sync
-	nbranch p_g24_retransmit,user3
-	call g24_ackpayload_parse	
-	call p_mouse_24g_transmit_callback
-	branch g24_transmit_no_ack
-
-p_mouse_24g_transmit_callback:
-	call p_mouse_24g_send_time_check
-	branch mouse_wakeup_24g
-
-p_g24_retransmit:
-	fetch 1,mem_mouse_need_soft_reset
-	nrtn blank
-	call mouse_select_device_by_pb_button
-p_g24_retransmit0:	
-	fetch 1,mem_24g_abort_pac
-	nrtn blank
-	fetch 2,mem_24g_txfail_cnt
-	increase 1,pdata
-	store 2,mem_24g_txfail_cnt	
-	fetch 1,mem_24g_txfail_cnt+1
-	bbit1 4,g24_tx_attempt_fail
-	call g24_transmit_hop_process
-	fetch 2,mem_24g_retransmit
-	increase 1,pdata
-	store 2,mem_24g_retransmit	
-	branch p_g24_transmit_loop
-
-p_mouse_24g_send_time_check:
-	fetch 1,mem_mouse_sleep_deal_type
-	rtn blank
-	fetch 1,mem_24g_transmit_by_interrupt
-	beq G24_TX_TIMER_INT_ENABLE,mouse_24g_send_timer_first
-	fetch 1,mem_mouse_24g_tx_count
-	branch mouse_24g_send_timer_first,blank
-	copy clkn,pdata
-	fetcht 6,mem_mouse_24g_tx_time_last
-	store 6,mem_mouse_24g_tx_time_last
-	call clk_diff_rt
-	store 4,mem_mouse_24g_tx_time_last_delt
-
-	fetch 1,mem_mouse_24g_sleep_miss
-	nrtn blank
-	fetch 2,mem_24g_retransmit
-	nrtn blank
-	fetch 4,mem_mouse_24g_sleep_miss_temp
-	nrtn blank
-	fetch 4,mem_mouse_24g_tx_time_last_delt
-	fetcht 4,mem_mouse_24g_tsniff
-	lshift temp,temp
-	isub temp,null
-	branch mouse_24g_send_time_long_wake,positive
-	jam 210,mem_mouse_24g_tx_time_offset	//rom bugfix:increase -40,temp
-	call mouse_24g_send_time_check_1
-	jam 250,mem_mouse_24g_tx_time_offset
-	rtn
-endif
 
 p_le_enable_phy_by_pdata:
 	copy temp,pdata
@@ -318,13 +170,29 @@
 	
 p_mouse_setgpio_hibernate:
 	call mouse_setgpio_hibernate+1
+	fetch 1,mem_mouse_logo_enable_gpio0
+	beq 1,p_mouse_setgpio_hibernate_next
 	jam 0x80,0x8070
+p_mouse_setgpio_hibernate_next:
 	fetch 1,mem_gpio_wakeup_low+1	//enable ice wakeup
 	set1 5,pdata
 	store 1,mem_gpio_wakeup_low+1
 	call lpm_write_gpio_wakeup
 	branch mouse_1io2led_all_off
 
+
+p_g24_lpm_wait:
+	enable user
+	call lpo_calibration
+	fetch 3,mem_clks_per_lpo
+	branch disable_user,blank
+	fetch 1,mem_lpm_mode
+	branch disable_user,blank
+	fetch 1,mem_sensor_shutdown_flag
+	nrtn blank
+	branch g24_lpm_wait_next
+
+
 p_mouse_3io6key_check:
 	copy regc,pdata
 	store 1,mem_mouse_key_status
@@ -341,6 +209,7 @@
 p_mouse_priority_bb_event:
 	copy regc,pdata
 	beq BT_EVT_24G_ATTEMPT_SUCCESS,p_mouse_24g_attempt_success
+	beq BT_EVT_24G_ATTEMPT_FAIL,p_mouse_24g_attempt_fail
 	branch mouse_priority_bb_event+2
 
 p_mouse_24g_attempt_success:
@@ -357,6 +226,28 @@
 	fetcht 4,mem_24g_receiver_addr
 	branch mouse_24g_attempt_success+11
 	
+p_mouse_24g_attempt_fail:
+	fetch 1,mem_24g_attempt_fail_flag
+	nbranch mouse_24g_hibernate_set,blank
+	fetch 1,mem_24g_reconn_type
+	beq FAST_CONN_AND_3_0_ADDR,mouse_24g_fast_conn_attempt_fail
+	beq PAIR_AND_3_0_ADDR,p_mouse_24g_auto_pair_attempt_fail
+	beq RECEIVER_AND_3_0_ADDR,p_mouse_reconn_dongle_attempt_fail
+	branch mouse_24g_attempt_fail_enter_hibernate_next
+	
+p_mouse_24g_auto_pair_attempt_fail:
+	fetch MOUSE_FLAG_LEN,mem_mouse_flag 
+	bbit0 MOUSE_ENABLE_24G_FIRST_AUTO_PAIRING,mouse_24g_attempt_fail_enter_hibernate_next
+	fetch 1,mem_device_number
+	beq 1,mouse_24g_attempt_fail_enter_hibernate_next		//24g first mode and only 2.4g device
+	branch mouse_24g_first_bluetooth_reconnect
+
+p_mouse_reconn_dongle_attempt_fail:
+	fetch MOUSE_FLAG_LEN,mem_mouse_flag
+	bbit0 MOUSE_ENABLE_24G_FIRST_AUTO_PAIRING,mouse_24g_attempt_fail_enter_hibernate_next
+	bbit1 MOUSE_ENABLE_EEPROM,mouse_24g_attempt_fail_enter_hibernate_next
+	bbit1 MOUSE_ENABLE_FLASH,mouse_24g_attempt_fail_enter_hibernate_next
+	branch mouse_24g_start_auto_pair+1
 	
 p_mouse_bb_event_timer:
 	call mouse_adc_read
@@ -390,7 +281,9 @@
 	call mouse_store_device_info+1
 	rtnbit0 MOUSE_ENABLE_OTP 
 p_mouse_store_otp_device_info:
+ifdef DPI_LOAD_AND_STORE
 	call p_mouse_otp_store_dpi
+endif
 p_mouse_otp_store_24g_addr:
 	arg OTP_OFFSET_24G_ADDR,pdata
 	copy pdata,regb
@@ -416,7 +309,7 @@
 	copy regb,pdata
 	branch otp_write
 
-
+ifdef DPI_LOAD_AND_STORE
 p_mouse_otp_store_dpi:
 	arg OTP_OFFSET_DPI,pdata
 	copy pdata,regb
@@ -495,6 +388,7 @@
 p_mouse_dpi_load_end:
 	store 1,mem_mouse_dpi
 	rtn	
+endif
 
 p_mouse_read_otp_24g_addr:
 	arg OTP_OFFSET_24G_ADDR,pdata
@@ -520,8 +414,102 @@
 p_mouse_24g_addr_load:
 	fetch 4,mem_mouse_24g_addr_last
 	store 4,mem_mouse_24g_addr
-	rtn
+	rtn 
+
+ifdef ADC_ENABLE
+p_soft_reset:
+	clear_stack
+	call p_app_param_init
+	branch soft_reset+3
 
+p_app_param_init:
+	rtn wake
+	call adc_init_data
+p_mouse_default_init:
+	fetch 2,mem_mouse_24g_pair_timeout_init
+	store 2,mem_24g_pair_timeout_init
+
+	fetch 1,mem_mouse_24g_reconn_timeout_init
+	store 2,mem_24g_reconn_timeout_init
+
+	fetch 5,mem_rssi_dis_min_24g_init
+	store 5,mem_rssi_dis_min_24g
+
+	fetch 1,mem_mouse_24g_pair_tx_power
+	store 1,mem_24g_pair_tx_power
+
+	fetch 1,mem_mouse_enable_flag
+	isolate1 MOUSE_ADC_ENABLE,pdata
+	call mouse_adc_read_enable,true
+
+	fetch 1,mem_mouse_enable_flag
+	isolate1 MOUSE_24G_250HZ_ENABLE,pdata
+	call mouse_24g_set_250Hz,true
+	fetch 1,mem_mouse_enable_flag
+	isolate1 MOUSE_SEARCH_DONGLE_ENABLE,pdata
+	call mouse_24g_search_dongle_enable,true
+	fetch 1,mem_mouse_enable_flag
+	isolate1 MOUSE_CLK_16M_ENABLE,pdata
+	call mouse_16M_enable,true
+	fetch 1,mem_mouse_enable_flag
+	isolate1 MOUSE_DPI_4_LEVEL_ENABLE,pdata
+	call mouse_dpi_4level_enable,true
+	fetch 1,mem_mouse_enable_flag
+	isolate1 MOUSE_KEYBOARD_ENABLE,pdata
+	call mouse_customer_key_enable,true
+	
+	fetch 1,mem_24g_ch_map_update
+	ncall g24_chamap_param_update,blank
+
+	call mouse_xtal_init
+//	call mouse_adc_vol_init
+	branch mouse_default_init_next
+
+p_enable_adc:
+	fetchr regb,1,core_rf_ldo_cfg6
+	jam 0x3d,core_rf_ldo_cfg6
+	jam 0xaa,core_rf_ldo_cfg5
+	jam 0x0c,core_rf_ldo_en0
+	fetch 1,core_clkpll_cfg6
+	set1 7,pdata
+	store 1,core_clkpll_cfg6
+	jam 0x04,core_rf_ldo_en1
+	nop 60
+	jam 0,core_syn_en
+	jam 6,core_rx_en0
+	call read_adc_mode
+	store 1,core_gpadc_ctrl
+	jam 0x03,core_sum_ctrl
+	nop 60
+	fetch 1,core_sum_en
+	set1 7,pdata
+	store 1,core_sum_en
+	nop 1000  // 1/24ms
+	
+	fetch 2,mem_adc_delay
+	call sleep
+//	fetcht 1,mem_adc_config_flag
+//	sub temp,ADC_CONFIG_HVIN,null
+//	call sleep,zero	
+	fetch 2,core_adc_sum
+	store 2,mem_adc_current_value
+	fetch 1,core_sum_en
+	set0 7,pdata
+	store 1,core_sum_en
+	jam 0,core_gpadc_ctrl
+	storer regb,1,core_rf_ldo_cfg6
+	rtn
 
+p_mouse_adc_gpio_check_output:
+	fetcht 1,mem_adc_channel
+	sub temp,3,null
+	branch p_mouse_adc_gpio_3_6_set,positive
+	increase 4,temp
+	branch mouse_adc_gpio_check_output+5
+
+p_mouse_adc_gpio_3_6_set:
+	increase 3,temp
+	branch mouse_adc_gpio_4_7_set+1
 
+endif
 
Index: sched/1306.dat
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/sched/1306.dat	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/sched/1306.dat	(working copy)
@@ -21,6 +21,7 @@
 
 mem_load_check_sum:5a
 mem_mouse_no_data_timeout:70 17   #10mins
+mem_mouse_enable_flag:20	#20:win+d	60:ctrl+alt+a	a0:ac home	d0:key_play
 
 #mem_flash_base:00 50 00
 #mem_eeprom_base:80 1f
Index: sched/mouse_basic.dat
===================================================================
--- /1306ac/branch/mouse/branch/mouse_public_xzr/sched/mouse_basic.dat	(revision 426)
+++ /1306ac/branch/mouse/branch/mouse_public_xzr/sched/mouse_basic.dat	(working copy)
@@ -1,12 +1,14 @@
-
+#mem_patch00:01	#adc
 #mem_patch06:80
-mem_patch07:20
+mem_patch07:20	#a0 adc
 mem_patch08:40
 mem_patch09:50
 mem_patch0a:04
 mem_patch0b:c4
 mem_patch0e:01
+#mem_patch14:01	#adc
 mem_patch1c:08
+mem_patch2c:02
 
 
 mem_mouse_flag:
@@ -138,7 +140,8 @@
 #0X02 MOUSE_12CLK_ANGLE
 #0X03 MOUSE_3CLK_ANGLE
 
-mem_mouse_ice_sdio_for_sensor_angle:00	#00 disable, 01 enable
+mem_mouse_ice_sdio_for_sensor_angle:01	#00 disable, 01 enable
+mem_mouse_logo_enable_gpio0:00	#00:disable logo	01:enable,gpio=0
 
 mem_device_option:08
 mem_device_flag:00	#00--24g 01--bt
@@ -185,16 +188,24 @@
 mem_adc_read_time_init:0a
 mem_adc_config_flag_init:02   #00-vinlpm   01-hvin   02-gpio
 mem_adc_low_volatage_led_blink_timer:64 00
-mem_adc_channel:04       
-#00-gpio4   
-#01-gpio5   
-#02-gpio6  
-#03-gpio7
-#04-gpio9  
-#05-gpio10  
-#06-gpio11  
-#07-gpio12
-
+mem_adc_channel:03      
+#00-gpio3 
+#01-gpio4   
+#02-gpio5  
+#03-gpio6
+#04-gpio8  
+#05-gpio9  
+#06-gpio10  
+#07-gpio11
+
+#0x0099--1.5V   0x005d--0.9V  0x0068--1.0V  0x0071--1.1V
+#mem_mouse_vdd_full_vol:99 00	#1.5v
+#5d 00#mem_mouse_vdd_empty_vol	#0.9v
+#71 00#mem_mouse_vdd_low_vol	#1.1v
+
+mem_mouse_vdd_full_vol:74 0e	#3.7v
+b8 0b#mem_mouse_vdd_empty_vol	#3.0v
+80 0c#mem_mouse_vdd_low_vol	#3.2v
 
 #2.4g
 mem_24g_lap:14 27 32 41 51 61
