Help with development (Coding Doubts)

Started by Alex_Palomo, January 24, 2017, 04:35:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Walter Schulz

Well, that's not what I meant and I don't think this kind of information sharing (or not sharing) is the best way to get help.

Alex_Palomo

Here is part of the code:


#include <dryos.h>
#include <menu.h>
#include <bmp.h>
#include <lens.h>
#include <config.h>
#include <shoot.h>
#include <math.h>
#include <lvinfo.h>
#include <focus.h>
#include <property.h>
#include <module.h>

static int step_size = 1;
static float apertures_vector[] = {3.5, 4.0, 4.5, 5.0, 5.6, 6.3, 7.1, 8.0, 9.0, 10, 11, 13, 14, 16, 18, 20, 22};

static void dualBracketing()
{
//If lens.focus_distance is not at 250mm (closer focus/init position), then reset focus to init position.
if (lens_info.focus_dist > 25)
{
while (lens_info.focus_dist > 25) lens_focus(1, 3, 1, 1*10);
}
//Dual Bracketing loop
while (lens_info.focus_dist < lens_info.hyperfocal)
    {
for(int i = 0; i < 17; i++)
{
lens_set_rawaperture(apertures_vector[i]); //Set aperture
lens_take_picture(64,false); //Take a picture
/*msleep(100); //sleep for 100ms
if (!lv) force_liveview(); //start LiveViev if turned off*/
}
lens_focus(-1, step_size, 1, 1*10); //Establir quin és el step_size òptim-->Quantes fotos necessitem per calcular depth map?
       //step_size = 1 --> X photos
      //step_size = 2 --> X photos
     //step_size = 3 --> 6 photos
}
}

static int num_proba = 0;
static void proba()
{
lens_set_rawaperture(apertures_vector[num_proba]);
}

static struct menu_entry dualBr_menu[] =
{
    {
        .name = "Dual Bracketing",
.help = "Focus + Aperture Bracketing.",
.help2 = "Press Q to see the options.",
.depends_on = DEP_AUTOFOCUS,
.children =  (struct menu_entry[]) {
            {
                .name = "Start Bracketing",
.priv = dualBracketing,
        .select = run_in_separate_task,
                .help  = "For each step focus, does an aperture bracketing",
.help2 = "Press SET to start taking photos.",
            },
{
                .name = "Step Size",
                .priv = &step_size,
                .min = 1,
                .max = 5,
                .help  = "Size of the focus step",
                .help2 = "The smaller it is, the more pictures it take",
            },
{
                .name = "Proba",
.select = proba,
            },
{
                .name = "num_proba",
                .priv = &num_proba,
                .min = 0,
                .max = 16,
            },
MENU_EOL,
},
    },
};

static unsigned int dualBr_init()
{
menu_add("Shoot", dualBr_menu, COUNT(dualBr_menu));
    return 0;
}

static unsigned int dualBr_deinit()
{
    return 0;
}

MODULE_INFO_START()
    MODULE_INIT(dualBr_init)
    MODULE_DEINIT(dualBr_deinit)
MODULE_INFO_END()


Maybe I'm forgetting to put some code so that to get the module working.

a1ex

After compiling, your module load just fine here, without any changes.

Alex_Palomo

Do I have to add my module on Makefile.modules.default or anywhere?

a1ex

I've created a directory under modules/, pasted your code in a .c file, copied Makefile from ettr and changed the name. Running "make" created a template README.rst, which I didn't change. Then, "make install" to copy the module to the card. Loaded the module, it showed OK and a new menu entry appeared under Shoot.

Didn't touch Makefile.modules.default.

mk11174

I had this happen back in the days i played around, first start camera, unload the module, shut down camera, check card for duplicate modules by showing hidden files look for a version with a ~ in the module name, delete it if its there, also delete the cfg file related to your module if there  is one. Then restart camera and enable module, then restart camera again to see if it loads.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Alex_Palomo

Wow! Thank you a1ex and mk11174 it's so good to get feedback from you, I'm so greateful.

mk11174 I tried it but there isn't any hidden file starting with ~. It looks good for me.(Maybe I'm wrong)

I thing that the problem comes from the way I create the ML folder to be copied on the card. Here is how I proceed:

1.I write the following lines in the terminal:

cd test/magic-lantern
make -j2
cd platform
cd 600D*
make zip


2.After it ends compiling I copy the ML folder that has been created on the 600D platform, into the card.

3.Then insert de card on the camera and install ML.

4.Then open the MODULES menu and my module is not there. (The only way to get my module on MODULES menu is by modifying the Makefile.modules.default file)

Am I proceeding wrong? Why my module does not load without having to modify the Makefile.modules.default file?

Thanks for your time guys!

mk11174

If your not making the module from the actual module folder then it wont remake it as far as i remember, thats why you modify the default file so when you make it from the platform folder for your model it will remake it. So modify the default file, then run a make clean from the modules main folder to clean everything up first, then rmake your 600d from the platform and camera model folder, but i would also make clean that one to just to clean everything up.

Also delete ml folder and bin file from card to start fresh there to so you are only using modules from your compiled source.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Alex_Palomo

Yeah!!! It is working now! Many many thanks guys! You have been a great support :)

Alex_Palomo

Good afternoon, there is menu dependency for the Av mode? (Something like DEP_AV_MODE or similar)

Thank you:)

a1ex

Nope, but the list (from menu.h) is open. Or, you can use a MENU_WARN_NOT_WORKING.

Alex_Palomo