Commits

Giovanni C committed 62c8e40

650D: Fixes

  • Participants
  • Parent commits fdf5e30

Comments (0)

Files changed (19)

platform/650D.101/consts.h

 #define MIN_MSLEEP 10
 
 #define INFO_BTN_NAME "INFO"
-#define Q_BTN_NAME "[Q]"
+#define Q_BTN_NAME "[1-Finger Tap]"
 #define ARROW_MODE_TOGGLE_KEY "DISP"
 
     //~ #define DISPLAY_STATEOBJ (*(struct state_object **)0x3EBB8)

platform/650D.101/features.h

 // First try to print Hello World
 
-#define CONFIG_HELLO_WORLD
+//#define CONFIG_HELLO_WORLD
 
 // Then, start with a tiny feature set
 
-//~ #define FEATURE_GLOBAL_DRAW
-//~ #define FEATURE_ZEBRA
-//~ #define FEATURE_HISTOGRAM
-//~ #define FEATURE_INTERVALOMETER
+#define FEATURE_GLOBAL_DRAW
+#define FEATURE_ZEBRA
+#define FEATURE_HISTOGRAM
+#define FEATURE_INTERVALOMETER

platform/650D.101/gui.c

 	if (handle_common_events_startup(event) == 0) return 0;
 	extern int ml_started;
 	if (!ml_started) return 1;
-
+    bmp_printf(FONT_LARGE,10,10,"%08x", event->arg);
 	if (handle_common_events_by_feature(event) == 0) return 0;
 
 	return 1;

platform/650D.101/gui.h

 #ifndef _cameraspecific_gui_h_
 #define _cameraspecific_gui_h_
 
+    // touch events
+    #define TOUCH_1_FINGER 0x6f
+    #define UNTOUCH_1_FINGER 0x70
+    #define TOUCH_2_FINGER 0x76
+    #define UNTOUCH_2_FINGER 0x77
+
+    // used for knowing when canon's lv overlays are showing
+    #define GUI_LV_OVERLAYS_HIDDEN -7
+    #define GUI_LV_OVERLAYS_VISIBLE 0x37
+
+
     // button codes as received by gui_main_task
     // need to print those on screen
     #define BGMT_WHEEL_UP 0
     #define BGMT_WHEEL_DOWN 1
     #define BGMT_WHEEL_LEFT 2
     #define BGMT_WHEEL_RIGHT 3
+    #define BGMT_PRESS_SET 4
+    #define BGMT_UNPRESS_SET 5
+    #define BGMT_MENU 6
+    #define BGMT_INFO 7
+    #define BGMT_PRESS_DISP 8 // new, old value for BGMT_Q
+    #define BGMT_UNPRESS_DISP 9 // new, old value for BGMT_PLAY
+    #define BGMT_PLAY 0xB
+    #define BGMT_TRASH 0xD
 
-#define BGMT_PRESS_SET 0x4
-#define BGMT_UNPRESS_SET 0x5
-
-#define BGMT_MENU 0x6
-#define BGMT_INFO 0xfff
-#define BGMT_PLAY 0xb
-#define BGMT_TRASH 0x2c
-
-    #define BGMT_PRESS_DP 0x2f
-    #define BGMT_UNPRESS_DP 0x35
-    #define BGMT_RATE 0x21
     #define BGMT_REC 0x1E
 
 
     //~ #define BGMT_UNPRESS_ZOOMOUT_MAYBE 0x5678
 
     #define BGMT_LV 0x1E
-#define BGMT_Q 0x7
+    #define BGMT_Q TOUCH_1_FINGER
     //~ #define BGMT_Q_ALT 0x67
 
     //~ #define BGMT_FUNC 0x12
     #define BGMT_PICSTYLE 0x13
     //~ #define BGMT_JOY_CENTER (lv ? 0x1e : 0x3b)
-#if 0
-#define BGMT_JOY_CENTER 0x3e
-#define BGMT_UNPRESS_UDLR 0x35
-#endif
 
-#define BGMT_PRESS_UP 0x2a          //~ unpress = 0x2b
-#define BGMT_UNPRESS_UP 0x2b
+    #define BGMT_PRESS_UP 0x2a          //~ unpress = 0x2b
+    #define BGMT_UNPRESS_UP 0x2b
     #define BGMT_PRESS_UP_RIGHT 0x17
     #define BGMT_PRESS_UP_LEFT 0x18
-#define BGMT_PRESS_RIGHT 0x26       //~ unpress = 0x27
-#define BGMT_UNPRESS_RIGHT 0x27
-#define BGMT_PRESS_LEFT 0x28        //~ unpress = 0x29
-#define BGMT_UNPRESS_LEFT 0x29
+    #define BGMT_PRESS_RIGHT 0x26       //~ unpress = 0x27
+    #define BGMT_UNPRESS_RIGHT 0x27
+    #define BGMT_PRESS_LEFT 0x28        //~ unpress = 0x29
+    #define BGMT_UNPRESS_LEFT 0x29
     #define BGMT_PRESS_DOWN_RIGHT 0x1B
     #define BGMT_PRESS_DOWN_LEFT 0x1C
-#define BGMT_PRESS_DOWN 0x2c        //~ unpress = 0x2d
-#define BGMT_UNPRESS_DOWN 0x2d
+    #define BGMT_PRESS_DOWN 0x2c        //~ unpress = 0x2d
+    #define BGMT_UNPRESS_DOWN 0x2d
 
-#define BGMT_PRESS_HALFSHUTTER 0x50
-#define BGMT_UNPRESS_HALFSHUTTER 0x51
-    #define BGMT_PRESS_FULLSHUTTER 0x50
-    #define BGMT_UNPRESS_FULLSHUTTER 0x51
+    #define BGMT_PRESS_HALFSHUTTER 0x50
+    #define BGMT_UNPRESS_HALFSHUTTER 0x51
+    #define BGMT_PRESS_FULLSHUTTER 0x52
+    #define BGMT_UNPRESS_FULLSHUTTER 0x53
 
     #define BGMT_FLASH_MOVIE 0
     #define BGMT_PRESS_FLASH_MOVIE 0
 
     #define BGMT_LIGHT 0x20 // the little button for top screen backlight
 
-#define GMT_OLC_INFO_CHANGED 105 // backtrace copyOlcDataToStorage call in gui_massive_event_loop
+    #define GMT_OLC_INFO_CHANGED 105 // backtrace copyOlcDataToStorage call in gui_massive_event_loop
 
 // needed for correct shutdown from powersave modes
-#define GMT_GUICMD_START_AS_CHECK 97
-#define GMT_GUICMD_OPEN_SLOT_COVER 93
-#define GMT_GUICMD_LOCK_OFF 91
+#define GMT_GUICMD_START_AS_CHECK 89
+#define GMT_GUICMD_OPEN_SLOT_COVER 85
+#define GMT_GUICMD_LOCK_OFF 83
 
-    #define BTN_ZEBRAS_FOR_PLAYBACK BGMT_LIGHT // what button to use for zebras in Play mode
+    #define BGMT_FLASH_MOVIE (event->type == 0 && event->param == 0x61 && is_movie_mode() && event->arg == 9)
+    #define BGMT_PRESS_FLASH_MOVIE (BGMT_FLASH_MOVIE && (*(int*)(event->obj) & 0x4000000))
+    #define BGMT_UNPRESS_FLASH_MOVIE (BGMT_FLASH_MOVIE && (*(int*)(event->obj) & 0x4000000) == 0)
+    #define FLASH_BTN_MOVIE_MODE (get_disp_pressed() && lv)
 
-#define GMT_LOCAL_DIALOG_REFRESH_LV 0x36 // event type = 2, gui code = 0x100000C6 in EOS-M
+    #define BGMT_PRESS_ZOOMOUT_MAYBE 0x10
+    #define BGMT_UNPRESS_ZOOMOUT_MAYBE 0x11
+
+    #define BGMT_PRESS_ZOOMIN_MAYBE 0xe
+    #define BGMT_UNPRESS_ZOOMIN_MAYBE 0xf
+
+    #define BTN_ZEBRAS_FOR_PLAYBACK BGMT_PRESS_DISP // what button to use for zebras in Play mode
 
 #endif

platform/650D.101/stubs.S

 NSTUB(0xFF32861C, MuteOff_0)
 NSTUB(0xFF3285D4, MuteOn_0)
 NSTUB(0xFF4D3090, RedrawDisplay)
-NSTUB(0xFFFA60014 - RAM_OFFSET, ReleaseRecursiveLock) // AJ_KernelDry_KerRLock.c_p2
+NSTUB(0xFFA60014 - RAM_OFFSET, ReleaseRecursiveLock) // AJ_KernelDry_KerRLock.c_p2
 NSTUB(0xFF128734, SetBitmapVramAddress)
 NSTUB(0xFF1A953C, SetGUIRequestMode)
 
 NSTUB(0xFF51FCE0, dialog_set_property_str)
 NSTUB(   0x241BC, dm_names)
 NSTUB(0xFFA50320 - RAM_OFFSET, dm_set_store_level) // Not so sure
-//NSTUB(0xFFA502B8 - RAM_OFFSET, dm_set_print_level) // Not so sure
+NSTUB(0xFFA502B8 - RAM_OFFSET, dm_set_print_level) // Not so sure
 NSTUB(0xFF327FCC, dispcheck)
 
 NSTUB(0xFF0C8364, free) // see "can't malloc"
 
 // for task information
 NSTUB(0x247A4, task_max) // Not so sure....
-//NSTUB(0xFFA65F84 - RAM_OFFSET, is_taskid_valid) // AJ_task_trampoline_related_p10
-NSTUB(0xFFA65F84, is_taskid_valid)
-//NSTUB(0xFFA5ACE4 - RAM_OFFSET, get_obj_attr) // AJ_checks_if_Process_id_created_by_Dryos
-NSTUB(0xFFA5ACE4, get_obj_attr)
+NSTUB(0xFFA65F84 - RAM_OFFSET, is_taskid_valid) // AJ_task_trampoline_related_p10
+NSTUB(0xFFA5ACE4 - RAM_OFFSET, get_obj_attr) // AJ_checks_if_Process_id_created_by_Dryos
 NSTUB(0xFF1337F0, PowerAudioOutput) // not sure, looks different
 NSTUB(0xFF108918, StartASIFDMADAC)  //~ warning: looks different
 NSTUB(0xFF108760, StartASIFDMAADC)  //~ warning: looks different
 
 #define SOUND_RECORDING_ENABLED (sound_recording_mode != 1) // not 100% sure
 
-#if defined(CONFIG_500D) || defined(CONFIG_5D3) || defined(CONFIG_7D) || defined(CONFIG_EOSM)
+#if defined(CONFIG_500D) || defined(CONFIG_5D3) || defined(CONFIG_7D) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
 int audio_thresholds[] = { 0x7fff, 0x7213, 0x65ab, 0x5a9d, 0x50c2, 0x47fa, 0x4026, 0x392c, 0x32f4, 0x2d6a, 0x2879, 0x2412, 0x2026, 0x1ca7, 0x1989, 0x16c2, 0x1449, 0x1214, 0x101d, 0xe5c, 0xccc, 0xb68, 0xa2a, 0x90f, 0x813, 0x732, 0x66a, 0x5b7, 0x518, 0x48a, 0x40c, 0x39b, 0x337, 0x2dd, 0x28d, 0x246, 0x207, 0x1ce, 0x19c, 0x16f, 0x147 };
 #endif
 
     {
         buf = alloc_dma_memory(BUF_SIZE);
         
-        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
         uint32_t d = (uint32_t)&DryosDebugMsg;
         *(uint32_t*)(d) = B_INSTR((uint32_t)&DryosDebugMsg, my_DebugMsg);
         #else
 
 #define FPS_TIMER_A_MAX 0x2000
 
-#ifdef CONFIG_EOSM
+#if defined(CONFIG_EOSM) || defined(CONFIG_650D)
     #define FPS_TIMER_B_MAX fps_timer_b_orig
 #else
     #define FPS_TIMER_B_MAX (0x4000-1)
 
 int get_current_shutter_reciprocal_x1000()
 {
-#if defined(CONFIG_500D) || defined(CONFIG_50D) || defined(CONFIG_7D) || defined(CONFIG_40D) || defined(CONFIG_EOSM)
+#if defined(CONFIG_500D) || defined(CONFIG_50D) || defined(CONFIG_7D) || defined(CONFIG_40D) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
     if (!lens_info.raw_shutter) return 0;
     return (int) roundf(powf(2.0f, (lens_info.raw_shutter - 136) / 8.0f) * 1000.0f * 1000.0f);
 #else
                 .select = fps_change_value,
                 .help = "FPS value for recording. Video will play back at Canon FPS.",
             },
-#ifndef CONFIG_EOSM     //~ we only modify FPS_REGISTER_A, so no optimizations possible.
+#if !(defined(CONFIG_EOSM) || defined(CONFIG_650D))     //~ we only modify FPS_REGISTER_A, so no optimizations possible.
             {
                 .name = "Optimize for\b",
                 .priv       = &fps_criteria,
         else
         #endif
         {
-            #if defined(CONFIG_500D) || defined(CONFIG_1100D) || defined(CONFIG_EOSM)
+            #if defined(CONFIG_500D) || defined(CONFIG_1100D) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
             msleep(fps_override && recording ? 10 : 100);
             #else
             msleep(100);
                 float ff = default_fps * ks + f * (1-ks);
                 int fr = (int)roundf(ff);
                 fps_setup_timerA(fr);
-#ifndef CONFIG_EOSM
+#if !(defined(CONFIG_EOSM) || defined(CONFIG_650D))
                 fps_setup_timerB(fr);
 #endif
                 fps_read_current_timer_values();
         
         //~ info_led_on();
         fps_setup_timerA(f);
-#ifndef CONFIG_EOSM
+#if !(defined(CONFIG_EOSM) || defined(CONFIG_650D))
         fps_setup_timerB(f);
 #endif
         //~ info_led_off();
 int display_filter_enabled;
 
 //~ doesn't use _AllocateMemory()
-#if !defined(CONFIG_50D) && !defined(CONFIG_500D) && !defined(CONFIG_550D) && !defined(CONFIG_5D2) && !defined(CONFIG_EOSM)
+#if !defined(CONFIG_50D) && !defined(CONFIG_500D) && !defined(CONFIG_550D) && !defined(CONFIG_5D2) && !defined(CONFIG_EOSM) && !defined(CONFIG_650D)
 void *AllocateMemory(size_t size){return 0;}
 #endif
 
 #define MAX_ISO 136 // may be better to fine-tune this for each camera
 
 // max iso with expo override
-#if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+#if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
 #define MAX_ISO_BV 199
 #elif defined(CONFIG_500D)
 #define MAX_ISO_BV (is_movie_mode() ? 104 : 112) // 1600 or 3200
 // max ISO that can be set via FRAME_ISO 
 // I think it's the same as max analog ISO
 // todo: ask Guillermo Luijk :)
-#if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+#if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
 #define MAX_ANALOG_ISO 136 // iso 25600
 #else
 #define MAX_ANALOG_ISO 112 // iso 3200

src/lv-img-engio.c

     do {
         i = mod(i + delta, COUNT(digic_iso_presets));
     } while ((!mv && digic_iso_presets[i] < 1024)
-    #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+    #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
     || (mv && digic_iso_presets[i] > 2048) // high display gains not working
     || (!mv && digic_iso_presets[i] > 65536) // +7EV not working
     #endif
     while (1)
     {
         result = default_white_level * COERCE(movie_gain, 0, 65536) / 1024;
-        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
         break;
         #endif
         if (result > 8192 && *boost_stops < 7) 
             int new_gain = get_new_white_level(total_movie_gain, &boost_stops);
             EngDrvOut(SHAD_GAIN, new_gain);
             shad_gain_last_written = new_gain;
-            #if !defined(CONFIG_5D3) && !defined(CONFIG_EOSM)
+            #if !defined(CONFIG_5D3) && !defined(CONFIG_EOSM) && !defined(CONFIG_650D)
             EngDrvOut(ISO_PUSH_REGISTER, boost_stops << 8);
             #endif
         }
             EngDrvOut(SHAD_PRESETUP, presetup);
         }
 
-        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
         if (LVAE_DISP_GAIN) call("lvae_setdispgain", 0); // reset display gain
         #endif
 
         int total_photo_gain = digic_iso_gain_photo * digic_iso_gain_photo_for_bv / 1024;
 
         if (total_photo_gain == 0) total_photo_gain = 1024;
-    #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+    #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
         int g = total_photo_gain == 1024 ? 0 : COERCE(total_photo_gain, 0, 65534);
         if (LVAE_DISP_GAIN != g) 
         {
         .name = "Pict.Style : Bring up submenu...",
         #elif defined(CONFIG_5DC) || defined(CONFIG_40D)
         .name = "Press JUMP : Bring up submenu...",
-        #elif defined(CONFIG_EOSM)
+        #elif defined(CONFIG_EOSM) || defined(CONFIG_650D)
         .name = "1-fingr Tap: Bring up submenu...",
         #else
         error
 
 PROP_HANDLER(PROP_HOUTPUT_TYPE)
 {
-    #if defined(CONFIG_60D) || defined(CONFIG_600D) || defined(CONFIG_5D3) || defined(CONFIG_1100D) || defined(CONFIG_50D) || defined(CONFIG_EOSM)
+    #if defined(CONFIG_60D) || defined(CONFIG_600D) || defined(CONFIG_5D3) || defined(CONFIG_1100D) || defined(CONFIG_50D) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
     lv_disp_mode = (uint8_t)buf[1];
     #else
     lv_disp_mode = (uint8_t)buf[0];
     ".globl blob_end\n"
 );
 
-#if defined(CONFIG_5D3) || defined(CONFIG_7D) || defined(CONFIG_7D_MASTER) || defined(CONFIG_EOSM)
+#if defined(CONFIG_5D3) || defined(CONFIG_7D) || defined(CONFIG_7D_MASTER) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
 static void busy_wait(int n)
 {
     int i,j;
         case 800:
         case 1600:
         case 3200:
-        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
         case 6400: // on digic 4, those are digital gains applied to 3200 ISO
         case 12800:
         case 25600:
         case 640:  // ISO 800 - 1/3EV
         case 1250: // ISO 1600 - 1/3EV
         case 2500: // ISO 3200 - 1/3EV
-        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM)
+        #if defined(CONFIG_5D3) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
         case 5000:
         case 10000:
         #endif

src/state-object.c

 
 static void vsync_func() // called once per frame.. in theory :)
 {
-    #if !defined(CONFIG_60D) && !defined(CONFIG_600D) && !defined(CONFIG_1100D) && !defined(CONFIG_5D3) && !defined(CONFIG_EOSM) // for those cameras, it's called from a different spot of the evf state object
+    #if !defined(CONFIG_60D) && !defined(CONFIG_600D) && !defined(CONFIG_1100D) && !defined(CONFIG_5D3) && !defined(CONFIG_EOSM) && !defined(CONFIG_650D) // for those cameras, it's called from a different spot of the evf state object
     hdr_step();
     #endif
     
                 task_id, short_name, task_attr.pri, task_attr.wait_id, mem_percent, 0, task_attr.state);
             }
 
-            #if defined(CONFIG_5D3) || defined(CONFIG_60D) || defined(CONFIG_7D) || defined(CONFIG_EOSM)
+            #if defined(CONFIG_5D3) || defined(CONFIG_60D) || defined(CONFIG_7D) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
             y += font_small.height - ((tasks_show_flags & 1) ? 2 : 0); // too many tasks - they don't fit on the screen :)
             #else
             y += font_small.height;
     vram_hd.pitch = hd_size & 0xFFFF;
     vram_hd.width = vram_hd.pitch / 2;
     vram_hd.height = ((hd_size >> 16) & 0xFFFF)
-        #if !defined(CONFIG_5D3) && !defined(CONFIG_EOSM)
+        #if !defined(CONFIG_5D3) && !defined(CONFIG_EOSM) && !defined(CONFIG_650D)
         + 1
         #endif
         ;
     #if defined(CONFIG_600D)
     int bar_x = is_movie_mode() && video_mode_resolution >= 2 ? off_43 : 0;
     int bar_y = is_movie_mode() && video_mode_resolution <= 1 ? os.off_169 : 0;
-    #elif defined(CONFIG_5D3) || defined(CONFIG_1100D) || defined(CONFIG_EOSM)
+    #elif defined(CONFIG_5D3) || defined(CONFIG_1100D) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
     int bar_x = 0;
     int bar_y = is_movie_mode() && video_mode_resolution == 1 ? os.off_169 : 0;
     off_43+=0; // bypass warning
     uint16_t*       hdr = (uint16_t*) hd->vram;
 
     // select buffer where MZ should be written (camera-specific, guesswork)
-    #if defined(CONFIG_5D2) || defined(CONFIG_EOSM)
+    #if defined(CONFIG_5D2) || defined(CONFIG_EOSM) || defined(CONFIG_650D)
     lvr = (uint16_t*) shamem_read(REG_EDMAC_WRITE_LV_ADDR);
     busy_vsync(0, 20);
     #endif