paulscherrerinstitute / ecmccfg

Module to handle configuration scripts for EtherCATMotion Controller (ECMC)
GNU General Public License v3.0
7 stars 21 forks source link

error when using `Cfg.SetAxisDrvBrakeEnable` #215

Closed kivel closed 7 months ago

kivel commented 7 months ago

When the brake feature is enabled in the yaml-config, the startup fails with

ecmcConfigOrDie "Cfg.SetAxisDrvBrakeEnable(1, 1)"
ECMC command "Cfg.SetAxisDrvBrakeEnable(1, 1)" returned error: ERROR_DRV_BRAKE_ENTRY_NULL (0x14607)

This indicates that the brake will be enabled, without an proper assignment of an output.

The problem stems from the order in which the commands are rendered. If the brake key is found, the first command is the "enable", followed by the output assignment. Swapping the two line should fix the issue. https://github.com/paulscherrerinstitute/ecmccfg/blob/a708ef0a1fbaecc3eee654b88fdf8191a516709e/scripts/jinja2/templates/drive.jinja2#L63-L72