Skip to main content
  1. Posts/

Adding TurnOn - TurnOff action

· David Steeman · Electronics, VSCP

My Mespelare firmware doesn’t support Control, TurnOn/TurnOff actions. Since I needed it for my kids bed buttons/lights, I added it to the Mespelare firmware.

File versions
#

From the comments in main.c you can see that I made a new version of the firmware, v1.20. I also modified the MDF and vscp_node_defines and created new versions of these files.

*  Mespelare_v1.20: (based on Mespelare_v1.19) - production dd. 27 Jan 2016
*      - Implement Class1.Control, TurnOn / TurnOff events
*      - MDF mesp20.xml, vscp_node_defines_15 - added Actions ACTION_ON_USING_PULSE and ACTION_OFF_USING_PULSE

Code hooks
#

The new code hooks into the DoDM() function. In the switch / case statement where we process the actions, we add 2 new actions:

            case ACTION_ON_USING_PULSE:			// Enable outputs
                doActionOn( dmflags, readEEPROM( VSCP_EEPROM_END + REG_DESCISION_MATRIX + ( 8 * i ) + VSCP_DM_POS_ACTIONPARAM  ), ACTION_ON_USING_PULSE );
                break;
            case ACTION_OFF_USING_PULSE:			// Enable outputs
                doActionOff( dmflags, readEEPROM( VSCP_EEPROM_END + REG_DESCISION_MATRIX + ( 8 * i ) + VSCP_DM_POS_ACTIONPARAM  ), ACTION_OFF_USING_PULSE );
                break;

These 2 new actions are defined in the MDF