STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
PWMTargets.hpp File Reference

Resolve which hardware the controller PWMs, from config alone. More...

#include <map>
#include <string>
#include <vector>
#include "config/Config.hpp"
#include "control/ControllerService.hpp"
Include dependency graph for PWMTargets.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fsw::control::PWMResolution

Namespaces

namespace  fsw
 Motorized ball valve position: raw ADC counts -> % open.
namespace  fsw::control

Functions

std::map< int, std::string > fsw::control::boardIpMap (const fsw::config::Config &cfg)
 board_id → IP from [boards.
PWMResolution fsw::control::resolvePWMTargets (const fsw::config::Config &cfg)

Detailed Description

Resolve which hardware the controller PWMs, from config alone.

An [actuator_roles] entry whose optional 4th element is "pwm_fuel" or "pwm_ox" is assigned to controller_service. That entry carries (channel, board_id), and [boards.*] maps board_id to an IP. This is the only statement of what the controller drives — the process has no independent notion of a "fuel board" — and it is the same fact ActuatorCommander reads to stop commanding those actuators during a burn, so the two cannot disagree about who owns a valve.

Every step here used to have a fallback in controller_main.cpp: a missing role became CH3/CH8 on board 12, an undeclared board became "192.168.2.<board_id>", an empty board table became a synthesized 11-14, and two roles on two boards silently shared the first one's IP. All of them were this process asserting a rig layout only config knows, and all of them failed silent-wrong — PWM onto whatever hardware happened to sit on the guessed channel, behind a warning nobody reads. There are deliberately no fallbacks here: an unresolved target is reported, and the caller disables the fire gate.

Split out of controller_main.cpp so it can be tested without standing up a service.

Definition in file PWMTargets.hpp.