philmoz,
Try this:
- export conf
- add this line to module_inspector.c near the top of gui_module_draw
draw_txt_string(0, 1, conf.reader_file, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
- run CHDK, and open a file in the text reader
- run the module inspector, it should show the file name just opened in the reader
I'll check this. It should work and it worked at early stages of module system (until I isolate conf with binds)
At the moment the export list has specific exports for some of the camera.h values like CAM_BLACK_LEVEL, CAM_WHITE_LEVEL, CAM_RAW_ROWS etc. It also has internal variables to store these values so the modules can have something to link to.
Instead it might be cleaner to encapsulate these values into a 'camera_info' structure and just export that.
This could also be used for the palette colors and probably other things.
Nice idea. It will logically group some items. And I like it. But I'd like to discuss first, because some nuances exists.
Current implementation have two goal:
- Minimize required changes in modules.
As you can see we change nothing in modules, while palettes are completely isolated. Now makeexport detect declarations in first section of module_export.c and make corresponded undefs/declarations in module_export.h to replace defines with new symbol. So while module use same symbols they are no defines anymore but imported variables. This also have benefit of unification with core. We use same symbols as in the core.
- All required safety checks are done by module_system.
I should no worry about _cam_info, _palette version. Are there required symbol exists in this core or not. Every checks will be done by module loader. Module will work ok on any CHDK version which is compatible.
For struct - I will need to set and check version (to avoid call unexisted sym), I should know starting from which version all required symbols are exists (to give possibility run module on previous CHDK which in really are compatible).
One more nuance - converting to struct could affect slightly on size. Because we not use just address of variable but address+offsets. So no result benefit probably will be reached. This item is subject of investigate.
Also IMO exporting of defines is quite simple now:
- Declare initialized global variable in "section 2" following to pattern.
- Add this variable into export list ("section 3")
- that's all. Ensure that module_load.c is last included file in the module and change nothing more.
Are 144 saved bytes (for now, and ~300 bytes if most of current camera defines will be exported) in export symbol table is good goal for such changes?