500D control such as 5D II.

Started by Greg, November 12, 2012, 09:19:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Greg

Yes, the menu buttons are handled differently, perhaps by tx19a.

Greg

Double buffering should completely eliminate the problem of flicker.
To test this, I drew on the menu, and double buffering turned off, it started to flicker.

scrax

i've managed to add a dirty C mode to focus dialog, now that it works as proof of concept i'll try to polish it, but needing your help. For the double buffer too. :D
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-


scrax

Quote from: Greg on December 05, 2012, 06:49:26 PM
See, it should be better now ;)
https://bitbucket.org/Gr3g01/magic-lantern-500d-control/commits/f2f10de3a9dc32c625ebcac211fe8edfb8aa940e
Yes, working on 600D too.
now looking into those c modes, 5 are enough?  :)
I'm not sure to keep them in focus dialog, maybe better in picstyle/quality dialog
By the way how many drive modes has the 500D?
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Greg

500D has five drive modes :


Yes window picstyle / quality will be better ;)

scrax

Ok so we have to lock up-down arrow for changing metering mode when self-shoot continuous is selected (cause they conflict with number of pic selection).
But before i need a coffe break :D

EDIT: Done!
Also i found what to add to focus dialog: Focus Patterns! ;)

EDIT2: pushed to my fork last fixes with Custom Modes for x00D cameras ;)
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

For today i've just found how to save and restore also WB modes not only kelvin values, i've not added picstyles ( not sure if i want this to be saved...)

pushing now

So for now we are saving and restoring:
- Av
- Tv
- ISO
- Exp Comp (removed since is that feat is only for M mode)
- WB + Shift + Kelvin
- Drive Mode
- Metering Mode

Not sure about:
- Quality
- AF mode
- Flash Exp. Comp.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Greg

AWB is saved as Kelvin WB.

Something changed in the menu Drive mode? Your code on the 500D is slower. Uses a lot more CPU.



scrax

Quote from: Greg on December 11, 2012, 02:08:45 AM
AWB is saved as Kelvin WB.

Something changed in the menu Drive mode? Your code on the 500D is slower. Uses a lot more CPU.

I've just added the double buffer. Will try your tomorrow.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Greg

500D with double buffering works well.
The problem is probably with the Custom Modes, we need to reduce the number of "IF", unless someone knows a better way.

scrax

Quote from: Greg on December 11, 2012, 02:25:18 AM
500D with double buffering works well.
The problem is probably with the Custom Modes, we need to reduce the number of "IF", unless someone knows a better way.

Yes that part is terrible :)
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

nanomad

Quote from: scrax on December 11, 2012, 03:22:10 AM
Yes that part is terrible :)

I've got a trick up my sleeve, wait and you'll see ;)
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

scrax

Quote from: nanomad on December 11, 2012, 10:20:10 AM
I've got a trick up my sleeve, wait and you'll see ;)

I've tried to study more C yesterday,  to find a way to have something with all the value that can be used for all the  modes. Looked at array, struct and typedef. But I'm more confused than before :)
For example this:

typedef struct mcm
{
    int iso;
    int shutter;
    int aperture;
    int wb_mode;
    int kelvin;
    int wbs_gm;
    int wbs_ba;
} t_mcm;

t_mcm c1 = {,,,,,,,}
t_mcm c2 = {,,,,,,,}
t_mcm c3 = {,,,,,,,}
t_mcm c4 = {,,,,,,,}
t_mcm c5 = {,,,,,,,}

I'm not sure it's correct and in the end the problem is still here. I need a way to write a generic save and load code with a part the changes based on the c mode selected.
This is my idea, but don't know how to make it in C:

mcm_current = Custom Mode setting //(0 is off and then fron 1 to 5 there are C.modes)

static void mcm_save()
{
    if ( mcm_current == 0 ) return;
    mcm"$mcm_current" = lens_info.raw_iso;
    mcm"$mcm_current" = lens_info.raw_shutter;
    mcm"$mcm_current" = lens_info.raw_aperture;
}

This: "$mcm_current" should be expanded to the mcm_current value.

Also actually it's saving all the values in ML config file, but to make the code more simpler (maybe), I've started looking at how script are generated. My idea is to save in ML/SETTINGS/ one file for each C mode so they could be managed and shared between card.
That way based on current C-mode we set the file name, and then we can use just one instead of 5 block for saving and loading C modes
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

nanomad

Ok, here's the raw idea: use a separate config file for C-modes

So, we have something like

CONFIG_INT("mcm.active", mcm_active, 0);

In the standard MAGIC.CFG

Then we can write a simple MCM file parser like alex did for hidden menu items.

If we keep your struct, we can use an array of size MCM_MAX_MODES to store them "in memory"
t_mcm cmodes[MCM_MAX_MODES] which gets initialized by the MCM parser at boot. Then we can simply select the active MCM mode like this:

cmodes[mcm_active]

Bouns point:
add a char[20] member to struct mcm and call it name (defaults to empty string) for easier selection
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

scrax

Quote from: nanomad on December 11, 2012, 01:43:13 PM
Ok, here's the raw idea: use a separate config file for C-modes

So, we have something like

CONFIG_INT("mcm.active", mcm_active, 0);

In the standard MAGIC.CFG

Then we can write a simple MCM file parser like alex did for hidden menu items.

If we keep your struct, we can use an array of size MCM_MAX_MODES to store them "in memory"
t_mcm cmodes[MCM_MAX_MODES] which gets initialized by the MCM parser at boot. Then we can simply select the active MCM mode like this:

cmodes[mcm_active]

Bouns point:
add a char[20] member to struct mcm and call it name (defaults to empty string) for easier selection

I think i get what you mean, wow :D

This what I got:

- First find, understand and adapt the file parser for hidden menu
- Then remove all the CONFIG_INT and move them to the new files with the parser (mcm.active (called actually mcm.current) we keep just this in ML settings)
- MCM_MAX_MODES need to be #define MCM_MAX_MODES 5 in mcm.h (or shoot.h) for example
- find a way to save/load setting to the actual mcm mode active file (isn't this the same problem like before)

The modifications g3gg0 made to trap focus recently gave me some hints, and now I'll take a look to the file parser, maybe it can help me understand better all...

thank's nanomad for your help.



Here found something to start:


//void config_menu_save_hidden_items()
void mcm_save_shoot_setting()
{
// we should stop if it's off
   if ( mcm_active == 0 ) return;  //  if (!menu_hidden_dirty) return;
// this is max memory siz? Can be keept like this?
    #define MAX_SIZE 10240   
// here we allocate the memory space for the msg, right? should we change it's name to mcm_msg maybe?
    char* mcm_msg = alloc_dma_memory(MAX_SIZE);
// ve set the first value of the array msg, so this msg above is an array of char (characters we want to save on file)?
    mcm_msg[0] = '\0'; 

//  with those lines we go down thru menu to check if they are hidden (this part is not needed or should be changed)
/*   struct menu * menu = menus; 
    for( ; menu ; menu = menu->next )
    {
        struct menu_entry * entry = menu->children;
       
        int i;
        for(i = 0 ; entry ; entry = entry->next, i++ )
        {
            if (!IS_VISIBLE(entry))
            {*/
//  this is the part that can put our settings to the file
                snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg) - 1, "%s\\%s\n", menu->name, entry->name);
//
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n", ISO, lens_info.iso);
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n",  Tv, lens_info.shutter);
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n",  Av, lens_info.aperture);
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n",  K , lens_info.kelvin);
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n",  WB, lens_info.wb_mode);
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n",  GM, lens_info.wbs_gm);
                snprintf(mcm_msg + strlen(mcm_msg), MAX_SIZE - strlen(mcm_msg) - 1, "%s\\%s\n",  BA, lens_info.wbs_ba);
/*           }
        }
    }*/
   
    FILE * file = FIO_CreateFileEx( CARD_DRIVE "ML/SETTINGS/C_MODE-%s.CFG", mcm_active );
   if( file == INVALID_PTR )
        return;
   
    FIO_WriteFile(file, mcm_msg, strlen(msg));

    FIO_CloseFile( file );
}



This is the part that I'm unsure, if this work the problem is solved, right?
    FILE * file = FIO_CreateFileEx( CARD_DRIVE "ML/SETTINGS/C_MODE-%s.CFG", mcm_active ); 

EDIT:

looking and how settings are saved for ML there are some differences but not a lot:


int
config_save_file(
    const char *        filename
)
{
    struct config_var * var = _config_vars_start;
    int count = 0;

    DebugMsg( DM_MAGIC, 3, "%s: saving to %s", __func__, filename );
   
    #define MAX_SIZE 10240
    char* msg = alloc_dma_memory(MAX_SIZE);
    msg[0] = '\0';
 
    snprintf( msg, MAX_SIZE,
        "# Magic Lantern %s (%s)\n"
        "# Built on %s by %s\n",
        build_version,
        build_id,
        build_date,
        build_user
    );

    struct tm now;
    LoadCalendarFromRTC( &now );

    snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg),
        "# Configuration saved on %04d/%02d/%02d %02d:%02d:%02d\n",
        now.tm_year + 1900,
        now.tm_mon + 1,
        now.tm_mday,
        now.tm_hour,
        now.tm_min,
        now.tm_sec
    );

    for( ; var < _config_vars_end ; var++ )
    {
        if( var->type == 0 )
            snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg) - 1,
                "%s = %d\r\n",
                var->name,
                *(unsigned*) var->value
            );
        else
            snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg) - 1,
                "%s = %s\r\n",
                var->name,
                *(const char**) var->value
            );

        count++;
    }
   
    FILE * file = FIO_CreateFileEx( filename );
    if( file == INVALID_PTR )
        return -1;
   
    FIO_WriteFile(file, msg, strlen(msg));

    FIO_CloseFile( file );
    return count;
}



i'll try something today and post back.

EDIT: Fixed this (and AUTO ISO too):
Quote from: Greg on December 11, 2012, 02:08:45 AM
AWB is saved as Kelvin WB.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

Today i've moved all the custom modes out of FEATURE_DIALOG_OPTIONS and moved back to mcm.c all the code so to work better on it.
I've also reduced settings to Av,Tv,Iso until finished and for now also only 2 custom mode.

I've managed to create a C_MODE-1.CFG file in the SETTINGS folder but when saved camera hang, battery pull is needed, and the file is empty.

I suppose the problem be that in new mcm.c the variable file is not declared dereferenced (cause the * ? ).
I've put extern file; and compiler note suggested struct _file **  and i ended up with this that compiles but is wrong 'cause it hangs camera:


void mcm_save_shoot_setting()
{
    char* msg = alloc_dma_memory(MAX_SIZE); 
    snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg) - 1, "ISO = %s\n", lens_info.iso);
    snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg) - 1, " Tv = %s\n",  lens_info.shutter);
    snprintf(msg + strlen(msg), MAX_SIZE - strlen(msg) - 1, " Av = %s\n",  lens_info.aperture);
   
    extern struct _file ** file;
    if ( mcm_current == 0 )
    {
        FILE * file = FIO_CreateFileEx( CARD_DRIVE "ML/SETTINGS/C_MODE-0.CFG" );
    }
    else {
        FILE * file = FIO_CreateFileEx( CARD_DRIVE "ML/SETTINGS/C_MODE-1.CFG" );
    }
    if( file == INVALID_PTR )
        return;
   
    FIO_WriteFile(file, msg, strlen(msg));
   
    FIO_CloseFile( file );
}


I'm a bit lost...

336    if ( mcm_current == 0 )
337    {
338        FILE * file = file = FIO_CreateFileEx( CARD_DRIVE "ML/SETTINGS/C_MODE-0.CFG" );
339    }
340    else {
341        FILE * file = file = FIO_CreateFileEx( CARD_DRIVE "ML/SETTINGS/C_MODE-1.CFG" );
342    }
343    if( file == INVALID_PTR )
344        return;
345   
346   FIO_WriteFile(file, msg, strlen(msg));
347   
348    FIO_CloseFile( file );

this solve compiling problem but jus for a few lines before again
../../src/mcm.c:343:9: error: 'file' undeclared (first use in this function)

now i'll try another way... :)
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

File saved without crash :D
now time to find why  ;D

EDIT:
Uh... too early to be happy  >:(

this what i got inside the file:


ISO =
Tv = ∞
Av = 0‰è:±Ã˙ñóÕäπËØPá\Öw"a†¿âd ãF©)ø


lol

more to come later

EDIT II: Fixed the numbers :)

EDIT III: not yet sure if the data is loaded from the file, checking that now...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

hihi... worked... saved setting to file and loaded from it.

copy and paste power  ;D ;D 8)
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Greg


scrax

too early to tell, i've just one c mode for now, adding more now, later will post something to try


EDIT: Stuck again, after loading some value it just go on like there are none more but the file is full... so need to find out why now...

that is the part giving problem:


void set_shoot_by_cmode(char* name, char* entry_name)
{
    NotifyBox(2000, "%s -> %s", name, entry_name); msleep(2000);

    if (streq(name, "ISO")) lens_set_rawiso(entry_name);
    if (streq(name, "_Tv")) lens_set_rawshutter(entry_name);
    if (streq(name, "_Av")) lens_set_rawaperture(entry_name);
    if (streq(name, "KEL")) lens_set_kelvin(entry_name);
    if (streq(name, "W-B")) set_wbbal_mode(entry_name);
    if (streq(name, "G-M")) lens_set_wbs_gm(entry_name);
    if (streq(name, "B-A")) lens_set_wbs_ba(entry_name);
    if (streq(name, "D-M")) lens_set_drivemode(entry_name);
    if (streq(name, "M-M")) set_metering_mode(entry_name);
}

const char * mcm_filename;

static void mcm_load_shoot_settings()
{
    switch (mcm_current)
    {
        case 0:
            return;
        case 1:
            mcm_filename = CARD_DRIVE "ML/SETTINGS/C_MODE-1.txt" ;
            break;
        case 2:
            mcm_filename = CARD_DRIVE "ML/SETTINGS/C_MODE-2.txt" ;
            break;
        case 3:
            mcm_filename = CARD_DRIVE "ML/SETTINGS/C_MODE-3.txt" ;
            break;
        case 4:
            mcm_filename = CARD_DRIVE "ML/SETTINGS/C_MODE-4.txt" ;
            break;
        case 5:
            mcm_filename = CARD_DRIVE "ML/SETTINGS/C_MODE-5.txt" ;
            break;
    }
    int size = 0;
    char* buf = (char*)read_entire_file( mcm_filename, &size);
    if (!size) return;
    if (!buf) return;
    NotifyBox(2000, "size: %d ", size); msleep(2000);
    int prev = -1;
    int sep = 0;
    for (int i = 0; i < size; i++)
    {
        if (buf[i] == '\\') sep = i;
        else if (buf[i] == '\n')
        {
             NotifyBox(2000, "prev: %d, sep: %d, i %d ", prev, sep, i); msleep(2000);
            if (prev < sep-2 && sep < i-2)
            {
                buf[i] = 0;
                buf[sep] = 0;
                char* setting_name = &buf[prev+1];
                char* entry_name = &buf[sep+1];
                //~ NotifyBox(2000, "%s -> %s", menu_name, entry_name); msleep(2000);
                //hide_menu_by_name(menu_name, entry_name);
                set_shoot_by_cmode(setting_name, entry_name);
            }
            prev = i;
        }
    }
    free_dma_memory(buf);
}



And that is what inside a file:

ISO\6400
_TV\4000
_AV\226
KEL\10000
W-B\1
G-M\0
B-A\0
D-M\0
M-M\0


EDIT: Ok now it's just a matter of conflict between types i think...  ???
I can save and rostore only some settings like Av, Tv but not other like WB, ISO.... hum..also somehow i've bricked drive mode change once, had to reset camera settings to bring it back to work, I suppose it went set to the wrong value.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

I can't go on, the value shown on screen are right but what is set is wrong and all the thing don't work...

Here start problems:
https://bitbucket.org/600Dplus/magic-lantern-for-600d/src/6b7697ad26610f3c60ed896ee1f9b6e1ee146128/src/mcm.c?at=small_pull_req#cl-105

as you can se if I try with specific value like 152 for _TV it works, but entry_name even if is show right in the notify box is wrong when using lens_set_xx.

mcm.c  is all what I'm using for that now added mcm.o in makefile for 600D
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

nanomad

I'm not quite sure that function is correct...

all the _set_ something functions take an int as input and you are passing a char * (a string). That's no good....

Here's what you should do:

lens_set_rawiso(atoi(entry_name));

atoi should be already available, otherwise check config.c for an implementation
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

scrax

Quote from: nanomad on December 15, 2012, 02:40:54 PM

all the _set_ something functions take an int as input and you are passing a char * (a string). That's no good....

Yes but also whit int or int* didn't worked, thanks for atoi will try now Worked finally  :D
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

Quote from: Greg on December 12, 2012, 08:59:23 PM
Now run faster?  ;)

@Greg  try on your 500D:

Here you can download and try an autoexec for 500D only

Here instead, one test autoexec for 600D only



...that is my 666 post  :o  ;D


NOTE: Functions settings are now in Expo menu and C-mode files settings are saved in /ML/SETTINGS (they are for now saved as .txt, will change to cfg next commit)
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-