Skip to main content
Version: 1.0.15

ecnet::NetworkConfig

User-facing configuration for an EcNetwork. More...

#include <network_config.hpp>

Public Functions

Name
NetworkConfigdefaults()
Network defaults (DC-sync PI kp_div=3, ki_div=20).

Public Attributes

Name
intwatchdog_low_wkc_cycles
ecmaster::Timeoutstimeouts
Backend protocol timeouts / retries (microseconds).
ShutdownConfigshutdown
RtConfigrt
intop_entry_cooldown_cycles
std::function< void(const BusFault &)>on_bus_fault
Optional bus-fault notification.
constexpr std::int32_tkDcSyncBusyWaitAuto
std::vector< std::shared_ptr< ecdev::IProfileFactory > >extra_profile_factories
App-supplied device classes, considered ahead of the self-registered built-ins when classifying each ENI slave (see ecdev::ProfileRegistry::select).
EniConfigeni
DebugConfigdebug
DcConfigdc
BusConfigbus

Detailed Description

struct ecnet::NetworkConfig;

User-facing configuration for an EcNetwork.

Bus timing, DC, RT scheduling, and shutdown policy live here; drive-specific PDO/FSM options live on CiA402Config / vendor configs.

Deployment RT overrides: scripts/rt/README.md.

Public Functions Documentation

function defaults

static NetworkConfig defaults()

Network defaults (DC-sync PI kp_div=3, ki_div=20).

The cyclic period is left unset (bus.cycle_ns == 0) and the sync mode is decided by the ENI in EcNetwork::loadAndValidateEni; the PI tuning here is inert when the ENI resolves to the SM event. There is no app-layer DC-vs-SM choice.

Host-side params are read here from the per-host LXMASTER_* environment (published by /etc/profile.d/lxmaster-config.sh; see scripts/rt/README.md), so the effective precedence is built-in default < ENV. The set covers the DC-sync PI knobs (kp_div, ki_div, dc_sync_busy_wait_ns, dc_lock_warmup_cycles, ec_sync_to_dc), the OP-entry DC gate (dc_diff_op_gate_max_ns / _stable_cycles / _timeout_cycles) and op_entry_cooldown_cycles, the RT scheduling identity (rt.cpu_affinity, rt.rt_priority, rt.enable_rt_scheduling), the EtherCAT interface name (LXMASTER_RT_IFACE -> bus.ifname), and the backend protocol timeouts/retries (LXMASTER_TIMEOUT_*/LXMASTER_RETRIES->timeouts.*). Missing vars warn once and keep the built-in default (RT_ENABLE and the timeout knobs are silent opt-outs).

Public Attributes Documentation

variable watchdog_low_wkc_cycles

int watchdog_low_wkc_cycles {100};

variable timeouts

ecmaster::Timeouts timeouts;

Backend protocol timeouts / retries (microseconds).

Defaults from the backend baseline; overridable via LXMASTER_TIMEOUT_* / LXMASTER_RETRIES. Pushed to the backend before init() (honored on a best-effort basis depending on the active backend).

variable shutdown

ShutdownConfig shutdown;

variable rt

RtConfig rt;

variable op_entry_cooldown_cycles

int op_entry_cooldown_cycles {8};

variable on_bus_fault

std::function< void(const BusFault &)> on_bus_fault;

Optional bus-fault notification.

Invoked exactly once when the cycle-health watchdog trips (a slave dropped out / cable unplugged / frames corrupted), carrying a structured [BusFault](/lxmaster/api/classes/BusFault) that pinpoints the break (upstream slave + ESC port) and lists the slaves that went silent.

Delivery: called on a detached helper thread (NOT the RT cyclic thread), so the handler may do non-RT work and may safely call [EcNetwork::stop()](/lxmaster/api/classes/EcNetwork#function-stop). Because it runs detached, anything the handler captures by reference must outlive the network. Leave empty to opt out; lxmaster still renders the fault in lastError() / reportDeviceStatus().

variable kDcSyncBusyWaitAuto

static constexpr std::int32_t kDcSyncBusyWaitAuto = ecnet::kDcSyncBusyWaitAuto;

variable extra_profile_factories

std::vector< std::shared_ptr< ecdev::IProfileFactory > > extra_profile_factories;

App-supplied device classes, considered ahead of the self-registered built-ins when classifying each ENI slave (see ecdev::ProfileRegistry::select).

Use this to bind a device identity for a single run without static registration – e.g. cfg.extra_profile_factories.push_back(ecdev::makeIdentityProfileFactory({vendor, product}, makeMyProfile, "my-device"));. shared_ptr keeps [NetworkConfig](/lxmaster/api/classes/NetworkConfig) copyable. The durable path for a new device is still a self-registering file (LXMASTER_REGISTER_DEVICE).

variable eni

EniConfig eni;

variable debug

DebugConfig debug;

variable dc

DcConfig dc;

variable bus

BusConfig bus;

Updated on 2026-07-06 at 04:47:20 +0000