500d development - page 70 - DSLR Hack development - CHDK Forum  

500d development

  • 2487 Replies
  • 901296 Views
*

Offline utnuc

  • **
  • 55
Re: 500d development
« Reply #690 on: 14 / April / 2011, 22:23:30 »
Advertisements
OK, decided to tackle the "simple" task of adding crop mark files.  For some reason I can't get the menu to show the 2 additional crop mark files I added.  Here's the code I think that is suspect:
Code: [Select]
crop_display( void * priv, int x, int y, int selected )
{
int index = *(unsigned*)priv;
bmp_printf(
selected ? MENU_FONT_SEL : MENU_FONT,
x, y,
"CropM:%s%s",
(index == 1 ? crop_file_1 + 3 :
(index == 2 ? crop_file_2 + 3 :
(index == 3 ? crop_file_3 + 3 :
(index == 4 ? crop_file_4 + 3 :
(index == 5 ? crop_file_5 + 3 :
"OFF"
))))),
(cropmarks || !index) ? " " : "!" // ! means error
);
}


I have properly defined crop_file_4 and crop_file_5, but I only see the first 3 when I compile and look in the menu.  Is there another piece of code controlling menu items?  Thoughts anyone?  I can't find any clear documentation on the bmp_printf function... it is not native C, must be something defined elsewhere perhaps?

« Last Edit: 14 / April / 2011, 22:25:16 by utnuc »

*

Offline Coutts

  • *****
  • 538
  • www.flickr.com/couttsphotog
    • Flickr
Re: 500d development
« Reply #691 on: 15 / April / 2011, 01:07:11 »
^ post your code for your menus. make sure you're using the right toggle function. probably going to have to write your own like shutter speed / aperture / iso use.
Canon 5d
Canon 50mm f/1.8
Sigma 24mm f/1.8

Flickr

Re: 500d development
« Reply #692 on: 15 / April / 2011, 03:09:04 »
Coutts glad your working again but rest up man!

*

alins

Re: 500d development
« Reply #693 on: 15 / April / 2011, 16:52:21 »
OK, decided to tackle the "simple" task of adding crop mark files.  For some reason I can't get the menu to show the 2 additional crop mark files I added.  Here's the code I think that is suspect:
Code: [Select]
crop_display( void * priv, int x, int y, int selected )
{
int index = *(unsigned*)priv;
bmp_printf(
selected ? MENU_FONT_SEL : MENU_FONT,
x, y,
"CropM:%s%s",
(index == 1 ? crop_file_1 + 3 :
(index == 2 ? crop_file_2 + 3 :
(index == 3 ? crop_file_3 + 3 :
(index == 4 ? crop_file_4 + 3 :
(index == 5 ? crop_file_5 + 3 :
"OFF"
))))),
(cropmarks || !index) ? " " : "!" // ! means error
);
}


I have properly defined crop_file_4 and crop_file_5, but I only see the first 3 when I compile and look in the menu.  Is there another piece of code controlling menu items?  Thoughts anyone?  I can't find any clear documentation on the bmp_printf function... it is not native C, must be something defined elsewhere perhaps?



look into 550d implementation of cropmarks, that's what we want to have for 500d.

If i remember the 550d correctly, the way it works is like this:
1. loads the cropmarks into an array of some sort by looking into the cropmrk folder for any file with extension bmp (i think it just looks for any filename + extension that ends in bmp).
2. the menu then cycles trough the array for the user to pick the cropmark

this way if you add one more cropmark file you don't actually need to change the code to know about it.

i hope this makes sense.


*

Offline Coutts

  • *****
  • 538
  • www.flickr.com/couttsphotog
    • Flickr
Re: 500d development
« Reply #694 on: 15 / April / 2011, 20:17:07 »
I want the camera to use a config file on the card too, to save settings. I think that's implemented on the 550d, right?
Canon 5d
Canon 50mm f/1.8
Sigma 24mm f/1.8

Flickr

*

alins

Re: 500d development
« Reply #695 on: 15 / April / 2011, 20:21:01 »
i believe the config file will work in 500d also.

Re: 500d development
« Reply #696 on: 15 / April / 2011, 21:12:09 »
Here is a short video messing around with QScales. I'm so glad there is still people interested in developing this. My opinion is that this software is increasing the value of my camera, maybe not dollars wise, but diffidently in use! Thanks so much for all the hard work going into this project!

http://www.youtube.com/watch?v=9BP_a7yW46E#

*

Offline utnuc

  • **
  • 55
Re: 500d development
« Reply #697 on: 15 / April / 2011, 22:21:17 »
OK, decided to tackle the "simple" task of adding crop mark files.  For some reason I can't get the menu to show the 2 additional crop mark files I added.  Here's the code I think that is suspect:
Code: [Select]
crop_display( void * priv, int x, int y, int selected )
{
int index = *(unsigned*)priv;
bmp_printf(
selected ? MENU_FONT_SEL : MENU_FONT,
x, y,
"CropM:%s%s",
(index == 1 ? crop_file_1 + 3 :
(index == 2 ? crop_file_2 + 3 :
(index == 3 ? crop_file_3 + 3 :
(index == 4 ? crop_file_4 + 3 :
(index == 5 ? crop_file_5 + 3 :
"OFF"
))))),
(cropmarks || !index) ? " " : "!" // ! means error
);
}


I have properly defined crop_file_4 and crop_file_5, but I only see the first 3 when I compile and look in the menu.  Is there another piece of code controlling menu items?  Thoughts anyone?  I can't find any clear documentation on the bmp_printf function... it is not native C, must be something defined elsewhere perhaps?



look into 550d implementation of cropmarks, that's what we want to have for 500d.

If i remember the 550d correctly, the way it works is like this:
1. loads the cropmarks into an array of some sort by looking into the cropmrk folder for any file with extension bmp (i think it just looks for any filename + extension that ends in bmp).
2. the menu then cycles trough the array for the user to pick the cropmark

this way if you add one more cropmark file you don't actually need to change the code to know about it.

i hope this makes sense.

This does make sense.  Lemme look through the 550D codebase.  Thanks for the tips.


*

Offline Jamez

  • **
  • 91
Re: 500d development
« Reply #698 on: 16 / April / 2011, 12:32:17 »

There are still 5 stubs values that need to be found:

NSTUB( 0xFF020760, GUI_CONTROL
NSTUB( 0xFF31CFCC, ChangeColorPalette
NSTUB( 0xFF2CFA54, MirrorDisplay )
NSTUB( 0xFF2CFAB4, NormalDisplay )
NSTUB( 0xFF2CE1F0, redraw_maybe )

that's from the 550d's stubs file, so I'm going to try to find those now. After that we need to confirm that all of the properties and constants are correct, before proceeding any further.
Just wondering if you managed to find these Coutts?
I think if these were found it would be more stable.

PS Dont turn on the Digtal Filters
« Last Edit: 16 / April / 2011, 12:34:12 by Jamez »
Canon Kiss x3 Owner running...
Magic Lantern for 500D/T1i/Kiss X3
Canon EOS 500D/T1i - Magic Lantern Firmware Wiki

*

Offline Coutts

  • *****
  • 538
  • www.flickr.com/couttsphotog
    • Flickr
Re: 500d development
« Reply #699 on: 16 / April / 2011, 15:13:59 »

There are still 5 stubs values that need to be found:

NSTUB( 0xFF020760, GUI_CONTROL
NSTUB( 0xFF31CFCC, ChangeColorPalette
NSTUB( 0xFF2CFA54, MirrorDisplay )
NSTUB( 0xFF2CFAB4, NormalDisplay )
NSTUB( 0xFF2CE1F0, redraw_maybe )

that's from the 550d's stubs file, so I'm going to try to find those now. After that we need to confirm that all of the properties and constants are correct, before proceeding any further.
Just wondering if you managed to find these Coutts?
I think if these were found it would be more stable.

PS Dont turn on the Digtal Filters

I talked to alex, mirror display and normal display were part of the april fools joke so no need to worry about those. i found changecolorpalette pretty easily, i don't think it's being used right now so that won't change stability at all.

redraw_maybe tells the camera to redraw all of it's canon gui elements, and gui_control is some event I think. I couldn't find either of these 2...


I'm trying to tackle ALO/HTP right now. i'll give everyone a rundown on how custom functions in ML work:

custom functions are grouped into 4 groups (you can see this grouping from your  custom function menu). the custom functions property has 4 buf's in the code. it's an array, it does something like this:

cfn[1] = buf[1];
cfn[2] = buf[2];
cfn[3] = buf[3] & 0xFF;

i don't know what that 0xFF thing does, but anyways.. there's a print statement commented out that's used for testing purposes, it prints the value of each "cfn group". each cfn "group" has a value of all the custom functions in it. EX: in the 500d, group 2 (cfn[1])'s value when everything in group 2 is turned off except for HTP being on, it's value is 10000. when you turn ALo from std (default value, 0) to low, the value of cfn[1] becomes 1010000 (add 1000000).

well MLU works fine, because everything in that group (cfn[2]) is either 100, 10, etc. so alex (or whoever wrote this function, [admin: avoid swearing please] genius) uses bitwise operations. so setting MLU on:

Code: [Select]
void set_mlu(int enable)
{
        if (enable) cfn[2] |= 0x100;
        else cfn[2] &= ~0x100;
        prop_request_change(PROP_CFN, cfn, 0xE);
}


says, if you pass a 1 to set_mlu, then the variable enable has a value, so:

if enable has a value, set cfn[2] to the result of a bitwise or operation of 0x100.
else, set cfn[2] to the result of a bitwise and operation with the inverse of 0x100
request prop change for prop_cfn..blah blah.

so a bitwise or operation:
this takes the value of 2 binary values and compares, if either bits are 1, then the result is 1, otherwise it's zero. example: turn MLU on, the original value of cfn[2] is 0. so the operation looks like this:

000 <-- old value
100 <-- new value
----
100 <-- result


then turning it off, a bitwise and operation takes each pair of bits and compares them, if they both are 1 then the result is 1, otherwise it's zero. well remember that tilde says to invert the bits of that 0x100. so turning MLU off it looks like:

100 <-- old value
011 <-- inverted 100
----
000 <-- result - MLU is turned off


so this works fine and dandy when you're only dealing with 1 and 0s, like the MLU function where MLU is 100 and the other custom functions in that group are 1000 or 10000, etc. SO THE PROBLEM WITH ALO IS, alo doesn't just use 1s and 0s, it uses 2s and 3s:

cfn[1] values:
ALO standard (default value) - 0
ALO low - 1000000
ALO high - 2000000
ALO off - 3000000

so we can't use these ingenious bitwise operations.. so the only solution i've come up with is include every custom function in group 2 in the ML menu, and just say from now on you adjust those from the ML menu (changing the custom function menu won't work right), and a huge if statement to cover every possible setting combination of htp/alo/high iso noise reduction/long exp noise reduction will have to be used to handle this. idk though, it's gonna be a HUGE if statement and probably going to slow ML down, as it'll always be checking this if statement in the shoot_task's while statement that runs as long as the camera is running.


so this is what I spent all day yesterday working on and figuring out. It took me literally all day to understand how the bitwise operations and stuff work. this is where I'm stuck now. We need a better way to handle this. in the 550d, Alex found the property location for ALO, to avoid this mess of the 2s and 3s and not being able to use simple bitwise operations. well, i tried finding the ALO functions in the 500d dump yesterday, NO LUCK.. so frustrating. prop_spy isn't working either for some reason, I think we need to verify our debug.c code with the 5d and 550d to make sure our prop_spy code isn't different.

we need to verify our properties are correct.. but without prop spy idk what to do.
« Last Edit: 16 / April / 2011, 15:19:15 by Coutts »
Canon 5d
Canon 50mm f/1.8
Sigma 24mm f/1.8

Flickr

 

Related Topics