OpenEtherCATsociety / SOES

Simple Open Source EtherCAT Slave
Other
578 stars 249 forks source link

Feature/soes defaultvalues #61

Closed nakarlsson closed 5 years ago

nakarlsson commented 5 years ago

Proposal on OD and defaults.

  1. We keep value uint32, to support >4byte datatypes they should always have a data instance in the OD and the user should use the default hook to initialize them,
  2. The init default was erroneous placed at INIT->PREOP transition, and would always overwrite modified values if the slave enters INIT. If the user wants that behavior, he can use the pre/post state hooks and enforce the init from there.

snippet

void init_default(void) { Obj.datatyptest.real64_ro = 12345.67890; Obj.datatyptest.real64_rw = 67890.12345; Obj.datatyptest.int64_rw = UINT64_MAX; Obj.datatyptest.int64_ro = INT64_MAX; ... static esc_cfg_t config = { .set_defaults_hook = init_default,