EDMAC (was Re: CHDK UI version 2.0 ?) - General Discussion and Assistance - CHDK Forum supplierdeeply

EDMAC (was Re: CHDK UI version 2.0 ?)

  • 32 Replies
  • 14983 Views
*

Offline Ant

  • *****
  • 509
EDMAC (was Re: CHDK UI version 2.0 ?)
« on: 23 / January / 2017, 16:30:17 »
Advertisements
I'm thinking about enabling (simple) modules to draw on the screen while inactive.

To accomplish this, I'm using a function pointer which has a setter function. The setter function is exported, a module can use it to set a callback function (and un-set it prior to unloading).

The function pointer is checked and executed if not NULL in gui_draw_debug_vals_osd(). I'm using the existing gui_debug_display_modes[] array (core/gui.c) with an additional setting ("plugin") to enable/disable this display callback.

Potential uses are
- displaying special information about something the core doesn't support (example: my s1is port provides extra information about the movie frames while recording)
- enabling background display for my memory browser mod, so I can watch it while using the Canon UI
- I plan to port the EDMAC viewer from ML, it seems to be more useful when one can adjust camera settings while watching it
- ... ?

Proof of concept seems to work.
And here it is. The patch is BIG because it has quite a bit of dependencies.
Actually, all this is needed for the included EDMAC viewer to function as intended.
The EDMAC viewer has an unpleasant "bug" which isn't actually a bug: it needs to read certain DIGIC registers directly, which can cause camera crash:
- when powersave mode kicks in
- during(!) shutdown (from rec mode, usually)
It only happens when its display routine is working, so anybody who would like to try it: please quit the module (with the MENU button) before leaving the cam unattended or shutting it down.
I suspect the DIGIC registers in question should not be read in certain occasions.

I'm using Canon semaphore functions to "protect" the callback function - this protection may not be actually needed.

 

About the module:
- it only exits when MENU is pressed, otherwise it will stay loaded
- if "Miscellaneous stuff" -> "Debug parameters" -> "Debug data display" is set to "Plugin", it will show its output outside ALT mode as the prop/param/task viewer does
- display update can be enabled/disabled in its normal mode with the SET button
- LEFT/RIGHT switches between overview and detailed view
- UP/DOWN moves the list in detailed mode
- "size" in detailed mode is in bytes (AFAIK), the 1080x239 representation is byte count / row x number of rows
- all numbers are hexadecimal, except the "size" in its 1080x239 representation
- it currently uses an incomplete internal list to get the camera's DIGIC version, new cameras not on the list will default to DIGIC II

The EDMAC viewer is based on the utility built into Magic Lantern (src/edmac.h src/edmac.c src/debug.c). It's possible that some of its data is misinterpreted, in case there are differences between their and our DIGIC configurations.

Many things are not mentioned, I can answer questions.

Do you have EDMAC viewer that is compatible with current CHDK version?

On M3 it makes camera stuck when I switch to play mode.
Keys do not work after leaving ALT mode when it stays loaded.
« Last Edit: 29 / January / 2017, 06:22:25 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #1 on: 23 / January / 2017, 20:07:33 »
Do you have EDMAC viewer that is compatible with current CHDK version?
This has not been further developed. It's also based on 3-year-old ML code which part is now outdated.
I assume the patch no longer applied cleanly? How does your patch look like?
Quote
On M3 it makes camera stuck when I switch to play mode.
Keys do not work after leaving ALT mode when it stays loaded.
Does the whole keyboard (including the ON/OFF button) die permanently? If so, that is because the PhySw task stopped working for some reason.

*

Offline Ant

  • *****
  • 509
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #2 on: 24 / January / 2017, 02:18:37 »
I assume the patch no longer applied cleanly? How does your patch look like?
I did not try to apply your patch.  I just modified the source code manually. So it doesn't look beautiful.

Quote
Does the whole keyboard (including the ON/OFF button) die permanently? If so, that is because the PhySw task stopped working for some reason.
No. Keyboard works normally, but I can't switch pages and modes of EDMAC viewer.
In playback mode only removing battery helps, so there is no romlog. Maybe this is because of direct reading the EDMAC registers or EDMAC connections.

*

Offline srsa_4c

  • ******
  • 4451
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #3 on: 24 / January / 2017, 11:16:49 »
Keyboard works normally, but I can't switch pages and modes of EDMAC viewer.
I'm starting to remember. You can't interact with the module if you left ALT mode (that kind of operation has never been there, and this module would have been the only application requiring it).
You need to re-enter the module (as you started it, easier if you put it on the user menu), then press the MENU button to exit it.
Quote
In playback mode only removing battery helps, so there is no romlog.
I have no idea at the moment.
Quote
Maybe this is because of direct reading the EDMAC registers or EDMAC connections.
That might be possible, earlier cameras just crashed usually when the module was active during shutdown.
I have an idea how to avoid this: the semaphore of task_Bye should be evaluated (using GetSemaphoreValue) and EDMAC registers should only be read if that semaphore is not taken.


*

Offline srsa_4c

  • ******
  • 4451
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #4 on: 27 / January / 2017, 14:15:51 »
A somewhat reworked (but not complete or final) patch is attached. The D6 sigfinder has not been touched - stubs still need to be found manually.

The EDMAC info module has the same functionality (to be improved...). UP/DOWN now scrolls by page (and it's buggy)

Changes:
- The module's output will remain visible when leaving it with the ALT button. No "debug display" setting has to be changed in the CHDK menu.
- When the module is running in background, pressing the "debug shortcut" (RAW shortcut in ALT mode) will bring it back, when Miscellaneous stuff -> Debug parameters -> ALT+/- debug action is set to "Page".
- When the module is drawing its output, it disables power saving (one of the crash/lockup reasons).

edit:
To avoid crashing the camera, make sure the module's output is not visible (exit the module or bring up the CHDK menu) when powering down the camera.


edit2:
patch updated, should no longer crash
« Last Edit: 28 / January / 2017, 08:18:10 by srsa_4c »

*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #5 on: 28 / January / 2017, 06:32:09 »
FYI, you can get detailed EDMAC size information with this code (look for edmac_format_size):

https://bitbucket.org/hudson/magic-lantern/src/edmac/modules/edmac/

That branch contains the most recent EDMAC routines as well:

https://bitbucket.org/hudson/magic-lantern/src/edmac/src/edmac.c

From here, edmac_get_total_size may be interesting as well.

Also, the max number of connections is higher than 48 on recent models (the exact value is not known).

See also: EDMAC internals.

*

Offline srsa_4c

  • ******
  • 4451
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #6 on: 28 / January / 2017, 08:16:42 »
@a1ex

Thanks. The LCLK check has already helped a lot - the module no longer crashes/locks the camera when power saving.
The "SetHPTimerNextTick" fw function in ML source seems equal to our "SetHPTimerAfterTimeout" function (actual name, comes from the ixus30 firmware).

Updated the above attached source. It still has the old EDMAC routines, the new stuff has to be ported and adapted to D6. Volunteers welcome :)

*

Offline Ant

  • *****
  • 509
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #7 on: 28 / January / 2017, 09:08:28 »
How to get gray transparent background used in canon's "Hints & Tips"?


*

Offline srsa_4c

  • ******
  • 4451
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #8 on: 28 / January / 2017, 09:16:22 »
How to get gray transparent background used in canon's "Hints & Tips"?
In the module?
It's probably not possible with the current draw_pixel_std() routine (core/gui_draw.c), because the CHDK D6 palette is computed, rather than lookup-table based. The best you can do is: start the CHDK palette viewer, choose one of the semi-transparent colors and use its index as background color in the MAKE_COLOR macro.

*

Offline Ant

  • *****
  • 509
Re: EDMAC (was Re: CHDK UI version 2.0 ?)
« Reply #9 on: 28 / January / 2017, 09:26:24 »
The best you can do is: start the CHDK palette viewer, choose one of the semi-transparent colors
I did not found there gray and semi-transparent color.

 

Related Topics