56 const std::map<int, std::string> ips =
boardIpMap(cfg);
65 std::vector<std::string> claimants;
66 for (
const auto& [name, role] : cfg.actuator_roles)
67 if (role.controller_role == assignment)
68 claimants.push_back(name);
70 if (claimants.empty()) {
71 res.issues.push_back(std::string(
"no [actuator_roles] entry is assigned \"") +
72 assignment +
"\" — no actuator serves this PWM output");
75 if (claimants.size() > 1) {
77 for (
size_t i = 0; i < claimants.size(); ++i)
78 joined += (i ?
", " :
"") + (
"\"" + claimants[i] +
"\"");
80 std::string(
"more than one [actuator_roles] entry is assigned \"") + assignment +
85 const auto& name = claimants.front();
86 const auto& role = cfg.actuator_roles.at(name);
87 if (role.channel < 1) {
88 res.issues.push_back(
"\"" + name +
"\" is assigned \"" + assignment +
89 "\" but declares no valid channel");
92 const auto ip_it = ips.find(role.board_id);
93 if (ip_it == ips.end()) {
94 res.issues.push_back(
"\"" + name +
"\" is assigned \"" + assignment +
95 "\" but is on board_id " + std::to_string(role.board_id) +
96 ", which no [boards.*] section declares an ip for");
99 target.channel =
static_cast<uint8_t
>(role.channel);
100 target.board_ip = ip_it->second;
101 target.actuator_name = name;
105 res.fuel = resolve(
"pwm_fuel");
106 res.ox = resolve(
"pwm_ox");