9#include <flexptp_options.h>
35static int CB_params(
const CliToken_Type *ppArgs, uint8_t argc) {
48static int CB_logInternals(
const CliToken_Type *ppArgs, uint8_t argc) {
50 int en =
ONOFF(ppArgs[0]);
53 MSG(
"\nSyncIntv. [ns] | dt [ns] | gamma [ppb]\n\n");
70static void pid_ctrl_register_cli_commands() {
71 sCliCmdIdx.params =
CLI_REG_CMD(
"ptp servo params [Kp Kd] \t\t\tSet or query K_p and K_d servo parameters", 3, 0, CB_params);
72 sCliCmdIdx.internals =
CLI_REG_CMD(
"ptp servo log internals {on|off} \t\t\tEnable or disable logging of servo internals", 4, 1, CB_logInternals);
75static void pid_ctrl_remove_cli_commands() {
76 cli_remove_command(sCliCmdIdx.params);
77 cli_remove_command(sCliCmdIdx.internals);
86 pid_ctrl_register_cli_commands();
92 pid_ctrl_remove_cli_commands();
#define CLI_REG_CMD(cmd_hintline, n_cmd, n_min_arg, cb)
static double rd_prev_ppb
relative frequency error measured in previous iteration
static float P_FACTOR
Proportional factor.
static bool logInternals
Decides if servo's internal operation shoud be reported or not.
static float D_FACTOR
Differentiating factor.
static bool firstRun
Indicates if first run did not occur yet.
static double integrator_value
value stored in the integrator
float pid_ctrl_run(int32_t dt, PtpServoAuxInput *pAux)
static float I_FACTOR
Integrating factor.