Menu

QP Nano Arduino QF_MAX_ACTIVE

Coder
2017-09-13
2017-09-13
  • Coder

    Coder - 2017-09-13

    I've increased the number of AOs in my model from 8 to 17 and now Q_onAssert fires with a codes 100 and 410. What do I do? I'm relatively inexperienced, so please be verbose.

     
  • Quantum Leaps

    Quantum Leaps - 2017-09-13

    QP-nano supports up to 8 active objects, that's why it asserts when you try 17.

    Please note that you can have any number of hierarchical state machines, but used as components of active objects (see the "Orthogonal Component" design pattern).

    --MMS

     
  • Coder

    Coder - 2017-09-13

    Thanks for the quick reply. Would you consider upgrading QP nano arduino to handle more AOs?

     
  • Quantum Leaps

    Quantum Leaps - 2017-09-13

    Currently, there are no plans to "beef up" the little QP-nano. It is intentionally small and for low-end 8-bitters (like AVRmega in Arduino). The 8 priority levels correspond to the 8-bit word size of these machines and this is optimal for quick scheduling. And 8-levels of priority are really plenty, even for bigger applications...

    But as I recommended before, please take a look at the "Orthogonal Component" design pattern. Most often than not, this is exactly what's needed when people run into active object limit. For example, this pattern applies when you have a group of identical "channels", or other components.

    --MMS

     
  • Coder

    Coder - 2017-09-13

    I started my application using the the DPP example. When I expand the number of Philosophers I run into the limit. How do I change the Philosopher AO array elements to Orthogonal Components using QM?

     
  • Quantum Leaps

    Quantum Leaps - 2017-09-13

    The "Orthogonal Component" example for QP-nano is provided in the standard QP-nano distribution. You need to download it and install on your machine. The example is located in the directory:

    qpn\examples\win32-qv\comp

    There is also another example, the "Fly 'n' Shoot" game, where the exploding "mines" are implemented as "Orthogonal Components" of the Tunnel active object. That example is located in the directory:

    qpn\examples\arm-cm\game_efm32-slstk3401a

    --MMS

     

    Last edit: Quantum Leaps 2017-09-13
  • Coder

    Coder - 2017-09-13

    Thanks Miro,
    For anyone following along, in the Fly n Shoot example, the mines are described on page 29.

     
  • Coder

    Coder - 2017-09-13

    I'm trying to copy the tunnel and mine1 objects into my dpp project to create the orthogonal components I need. There are many unfamilliar moving parts. Could you describe how to use the Free Attribute "AO_Tunnel", the Free Operations "Mine1_ctor", and "Tunnel_ctor"?

    How do these attributes relate to the way these objects are created in dpp?

     
  • Coder

    Coder - 2017-09-14

    When the following QHSM_INIT code from the game runs, my sketch restarts. Commenting it out allows the other AOs to work. Any ideas why?

    static QState Tunnel_initial(Tunnel * const me) {
        /* ${AOs::Tunnel::SM::initial} */
        //uint8_t n;
        //for (n = 0; n < N_PROGRAM; ++n) {
        //    QHSM_INIT(me->mine1_pool[n]); /* initial tran. for Mine1 */
        //}
        return Q_TRAN(&Tunnel_controllerOn);
    }
    
     

    Last edit: Coder 2017-09-14
  • Coder

    Coder - 2017-09-14

    It only took four hours to figure this out. Before QHSM_INIT runs, the:
    QHsm_ctor(&me->super, Q_STATE_CAST(&Mine1_initial));
    must run. I copied a set of free operations "Mine1_ctor" and "Tunnel_ctor" from the game example that were to do the ctor. They in turn must be run from the setup(). I had origionally modified from dpp example:
    QActive_ctor(&AO_Tunnel.super, Q_STATE_CAST(&Tunnel_initial));
    This didn't run the free operation. Replacing it with the function call below worked:
    Tunnel_ctor();
    I didn't see that I needed to do this because in the Shoot and Fly game example, the QM file doesn't list the main.c file where this is found. I haven't discovered how to make the Shoot N Fly QM model list the main.c file in the .directory folder.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.