2#include "../ptp_defs.h"
4#include <flexptp_options.h>
26#error "No CMD_FUNCTION macro has been defined, cannot register CLI functions!"
36static int cmd_handles[DS_CMDH_N];
38static CMD_FUNCTION(tune) {
45static CMD_FUNCTION(skew_offset) {
47 if (!strcmp(
"last", ppArgs[0])) {
50 skew0 = atof(ppArgs[0]);
57static CMD_FUNCTION(time_offset) {
59 if (!strcmp(
"last", ppArgs[0])) {
62 dt0 = atof(ppArgs[0]);
69static void register_cli_cmds() {
70 cmd_handles[DS_CMDH_TUNE] =
CLI_REG_CMD(
"ptp servo tune <tuning>\t\t\tSet relative tuning effective in next cycle", 3, 1, tune);
71 cmd_handles[DS_CMDH_SET_SKEW0] =
CLI_REG_CMD(
"ptp servo skew0 [skew|last]\t\t\tSet or get skew offset (ppb)", 3, 0, skew_offset);
72 cmd_handles[DS_CMDH_SET_DT0] =
CLI_REG_CMD(
"ptp servo dt0 [dt|last]\t\t\tSet or get time offset (ns)", 3, 0, time_offset);
76static void remove_cli_cmds() {
77 for (uint8_t i = 0; i < DS_CMDH_N; i++) {
94#if defined(CLI_REG_CMD) && defined(CLI_REMOVE_CMD)
108 double tuning_ppb = 0.0;
112 goto retain_cycle_data;
117 double skew_rel = skew -
skew0;
float debug_servo_run(int32_t dt, PtpServoAuxInput *pAux)
static double tuning_next_ppb
static int32_t offset_prev
void debug_servo_deinit()
static bool tuning_next_cycle_valid
#define CLI_REG_CMD(cmd_hintline, n_cmd, n_min_arg, cb)
#define PTP_COLOR_BYELLOW
Bright yellow.
#define PTP_COLOR_BGREEN
Bright green.
#define PTP_COLOR_BRED
Bright red.
#define PTP_COLOR_RESET
Reset colors.