new branch - CHDK : Elf Edition - Developers wanted - page 15 - General Discussion and Assistance - CHDK Forum

new branch - CHDK : Elf Edition - Developers wanted

  • 316 Replies
  • 131382 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #140 on: 28 / December / 2011, 23:28:20 »
Advertisements
I've made three updates to the reyalp-flt branch for review
- module load changes to handle arrays and structs (patch1509_fltv6.txt from above).
- add camera_info structure to replace usage of camera.h #defines for portability (still some work to do with this)
- cleanup of the code that handles the CHDK 'gui' modes

If there are no problems with any of these then they can be moved to the main trunk.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #141 on: 29 / December / 2011, 01:20:33 »
It occurred to me that using a data structure might also be an alternate way to handle imports from the module. For raw_merge.c you have the librawop struct defined in the core code and filled manually from the import list in the module. If you move the struct into the module and have a pointer to it in the core code then you only need to import one item (the struct pointer).
Sounds reasonable. With API version check it is safe now. I prepare changes

Quote
You might also include the ModuleInfo stuff at the start of the struct as well - essentially a semi object oriented module approach / API.
Module info is detected by elf2flt as specific object. Pointer to it is in flat header. This allow to easy get complete information about any module. This is used by: module_loader(versions checks), module_menu(names/flags), fltdump. So it should be kept as separated specific object.

I've made three updates to the reyalp-flt branch for review
- module load changes to handle arrays and structs (patch1509_fltv6.txt from above).
- add camera_info structure to replace usage of camera.h #defines for portability (still some work to do with this)
I see no problem with camera_info on first look. But please wait a little. I would like prepare API version checks and post it to realp-flt before merge to main trunk.
This change also broke some modules compatibility.

Quote
- cleanup of the code that handles the CHDK 'gui' modes
Gui unification have a sense, although increase complexity of simple modes.

Some comments:
1) I think that mix setter with getter is always not good. This is surely bad style in C++/Java.
modinspect_old_guimode = gui_set_mode(&GUI_MODE_MODULE_INSPECTOR);
I do understand why you implement in this way, but maybe better implement get_get_mode_enum for enum comparisons?

2) I'm not sure isn't changing order of GUI_MODE_MBOX and GUI_MODE_OSD in gui.h broke logic of     ixus310_elph500hs/kbd.c

3) Are changes in luascript.c (several functions registration removing) accident?

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #142 on: 29 / December / 2011, 03:28:03 »
Quote
You might also include the ModuleInfo stuff at the start of the struct as well - essentially a semi object oriented module approach / API.
Module info is detected by elf2flt as specific object. Pointer to it is in flat header. This allow to easy get complete information about any module. This is used by: module_loader(versions checks), module_menu(names/flags), fltdump. So it should be kept as separated specific object.

I was thinking something like this for the definitions
Code: [Select]
struct ModuleInfo { ... }
struct module_api
{
    struct ModuleInfo header;
    int (*module_run)(int, int, int*);
    int (*module_loader)(void**);
    int (*module_unloader)(void);

    // followed by module specific functions
}

Would this be too complex to handle in the elf2flt.c code?

Quote
Some comments:
1) I think that mix setter with getter is always not good. This is surely bad style in C++/Java.
modinspect_old_guimode = gui_set_mode(&GUI_MODE_MODULE_INSPECTOR);
I do understand why you implement in this way, but maybe better implement get_get_mode_enum for enum comparisons?

The only usage pattern for this was:
Code: [Select]
old_mode = get old mode;
gui_set_mode(new_mode);

To me it makes more sense to combine these into one function rather than two.
Perhaps not strictly good OO practice; but relatively easy to understand.

Quote
2) I'm not sure isn't changing order of GUI_MODE_MBOX and GUI_MODE_OSD in gui.h broke logic of     ixus310_elph500hs/kbd.c

The IXUS 310 code needs re-work anyway - I was thinking of using the flags variable you added to gui_handler to remove the mode id dependencies.

Quote
3) Are changes in luascript.c (several functions registration removing) accident?

The entries were duplicated when I merged the main trunk into reyalp-flt. This is just removing the extras.

Phil
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #143 on: 29 / December / 2011, 04:45:51 »
Code: [Select]
struct ModuleInfo { ... }
struct module_api
{
    struct ModuleInfo header;
    int (*module_run)(int, int, int*);
    int (*module_loader)(void**);
    int (*module_unloader)(void);

    // followed by module specific functions
}

Would this be too complex to handle in the elf2flt.c code?

I prefer to keep this base functions separated to through modules compatibility.

This is not difficult to combine them into one structure, but it is difficult to safe parse this values by elf2flt to header and in same time this parameters are used by loader in different times so they should be in header to easy access.

flat header already _is_ some kind of module_api :)

Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #144 on: 29 / December / 2011, 05:27:04 »
I have one more notes about _camera_info.
Currently camera_info.ts_button_border is used almost everywhere. Even simplest games use it.

So if camera_info will changed in incompatible way in some reason - all modules will not work.
My proposition is separate this value back from struct to global variable. Just like other screen-related values (screen_width, etc )

UPDATE: This also will allow to avoid camera_info api_version in absolutely all modules.
« Last Edit: 29 / December / 2011, 05:31:02 by tsvstar »

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #145 on: 29 / December / 2011, 05:38:50 »
I have one more notes about _camera_info.
Currently camera_info.ts_button_border is used almost everywhere. Even simplest games use it.

So if camera_info will changed in incompatible way in some reason - all modules will not work.
My proposition is separate this value back from struct to global variable. Just like other screen-related values (screen_width, etc )

UPDATE: This also will allow to avoid camera_info api_version in absolutely all modules.

I would argue that all of these things, including things like screen_width and screen_height, should all go into the camera_info structure.

Common elements can be grouped at the start, with instructions not to change the placement/order.

Once this has stabilised it is unlikely to change very often, and at the moment changes are not really an issue since we are working in the 'unstable' environment.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #146 on: 29 / December / 2011, 05:47:45 »
Anyway I'd like at least separate such values to different structure. _cam_screen for example

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #147 on: 29 / December / 2011, 17:17:30 »
Anyway I'd like at least separate such values to different structure. _cam_screen for example

I don't have a problem with grouping them by functional area - in which case I'll rename camera_info to camera_sensor.

Phil.

Update- I've renamed camera_info to camera_sensor and added camera_screen for the bitmap values. I also cleanup up the vid_get_bitmap_? functions since they aren't really needed. The values are constant for each camera so I moved them to camera.h / platform_camera.h.
« Last Edit: 30 / December / 2011, 01:40:24 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #148 on: 30 / December / 2011, 01:24:10 »
Something goes wrong.
1. Edge overlay is displayed with significant vertical offset on my S95 on all revisions: 1509, 1513, 1514.
2. Also sudden shutdowns happens often on start both in 1509 and 1514.
3. Memview module shutdown in a second after start.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: new branch - CHDK : Elf Edition - Developers wanted
« Reply #149 on: 30 / December / 2011, 01:47:22 »
Something goes wrong.
1. Edge overlay is displayed with significant vertical offset on my S95 on all revisions: 1509, 1513, 1514.
2. Also sudden shutdowns happens often on start both in 1509 and 1514.
3. Memview module shutdown in a second after start.

I haven't had any of those problems on the G12 or SX40HS (don't have the others with me at the moment).

Did you do a clean build?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal