monmodule ?

49 views
Skip to first unread message

Per Jakobsen

unread,
Mar 5, 2017, 6:14:08 AM3/5/17
to pixy_firmware_sdk
Hi

I'm trying to create a new module into Pixymon.
I've been browsing around in Wikis and Forums and found a few discussions, but not quite found description of how the MonModule concept is working.
Here's what I've found (please correct me where I'm incorrect):

Render modes:
In raw mode, only the Renderer module is active.
In cooked mode, all registered modules are active, starting with a call to the Renderer module (basically rendering the raw image, on which subsequent modules may overlay upon). I think the sequence of which the modules are defined in pixymon.pro determines the calling sequence.

MonModule:
render(): called by PixyMon to let the module render whatever needs to be shown.
command():
called by menus, added by the module itself.
paramChange(): called by the configuration page, added by the module itself.

Each registered MonModule will have it's render method called, potentially doing some rendering. If a render method returns true, subsequent modules are NOT called.

I'm not quite sure why a module should be able to prevent other modules from processing.
Perhaps a better approach would be to allow modules to be individually enable/disabled?

~Per

Per Jakobsen

unread,
Mar 5, 2017, 3:07:34 PM3/5/17
to pixy_firmware_sdk
Wrong it seems, renderer is not generating background image. It only generates image when Pixy sends data in certain modes (RAW mode, I guess).
So, each module expects data in a certain mode/format, and as soon as a module recognizes a mode, it renders and returns true, preventing render-calls for subsequent modules.

It appears that a good start for a new MonModules render method could be:
---
bool Ctracklinemodule::render(uint32_t fourcc, const void *args[])
{
    if (fourcc==FOURCC('C','M','V','2'))
    {
        m_renderer->renderBA81(*(uint8_t *)args[0],
                   *(uint16_t *)args[1], *(uint16_t *)args[2],
                   *(uint32_t *)args[3], (uint8_t *)args[4]);
        return true;
    }
    return false;
}
---
That at least renders the background image :)

~Per
Reply all
Reply to author
Forward
0 new messages