rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
servo_cmd.c File Reference

The SERVO screen's command and the link's reports on it: the state an acknowledged frame rate is shown in, and the rules a kept command and a pause follow (servo_cmd.h). More...

#include "servo_cmd.h"
#include <stddef.h>
#include "link_pages.h"

Functions

servo_rate_state_t servo_rate_in_force (uint16_t minor)
 The state an acknowledged rate is shown in, by the IOmcu's protocol minor minor: SERVO_RATE_IN_FORCE from LINK_MINOR_SERVO_TARGET_RATE (4.19), where the rate reaches the PWM TARGET alone, and SERVO_RATE_IN_FORCE_SURFACES below it.
uint16_t servo_cmd_pause_root (const servo_cmd_t *c)
 The pause a HOLD c ends when the panel lets it go: the pause its chain rests on (from_pause) when it was posted before an earlier pause's resume was acknowledged, and otherwise its own.
bool servo_cmd_stale (servo_pause_end_t *e, const servo_cmd_t *c)
 Whether the drive command c (a position, a centre, a sweep or a hold) was asked during the pause e records as let go of, so is stale and is not to be sent: the screen has ended that pause, and the command would hold or move the servo somewhere it no longer shows.
bool servo_cmd_survives_link_loss (const servo_cmd_t *c)
 Whether a command kept to be said again may still be said after the link has gone and come back.

Detailed Description

The SERVO screen's command and the link's reports on it: the state an acknowledged frame rate is shown in, and the rules a kept command and a pause follow (servo_cmd.h).

SPDX-License-Identifier: MIT

Function Documentation

◆ servo_cmd_pause_root()

uint16_t servo_cmd_pause_root ( const servo_cmd_t * c)

The pause a HOLD c ends when the panel lets it go: the pause its chain rests on (from_pause) when it was posted before an earlier pause's resume was acknowledged, and otherwise its own.

What the panel records for servo_cmd_stale() and hands to servo_screen_released().

Parameters
cThe command to test. NULL is refused.
Returns
The pause sequence number the command rests on, from_pause when it is set and pause_seq otherwise. 0 for NULL.

◆ servo_cmd_stale()

bool servo_cmd_stale ( servo_pause_end_t * e,
const servo_cmd_t * c )

Whether the drive command c (a position, a centre, a sweep or a hold) was asked during the pause e records as let go of, so is stale and is not to be sent: the screen has ended that pause, and the command would hold or move the servo somewhere it no longer shows.

The screen asks nothing more of a pause it has left, and commands keep their order, so the first drive command from after the pause retires e; a pause number reused after 65535 more is then not mistaken for it.

Parameters
eThe pause record. Cleared (on = false) when c is a drive command that is not stale. Not changed when c is stale or is not a drive command.
cThe command to test.
Returns
true when c is stale and must not be sent, false otherwise, including when e or c is NULL or e is off.

◆ servo_cmd_survives_link_loss()

bool servo_cmd_survives_link_loss ( const servo_cmd_t * c)

Whether a command kept to be said again may still be said after the link has gone and come back.

A sweep or a hold may not: both end with the link, on the screen and at the far end, and said again they would start motion nobody asked for. A position is what the screen still shows.

Parameters
cThe command to test. NULL is refused.
Returns
true for any kind other than a sweep or a hold, including NONE; false for a sweep, a hold and NULL.

◆ servo_rate_in_force()

servo_rate_state_t servo_rate_in_force ( uint16_t minor)

The state an acknowledged rate is shown in, by the IOmcu's protocol minor minor: SERVO_RATE_IN_FORCE from LINK_MINOR_SERVO_TARGET_RATE (4.19), where the rate reaches the PWM TARGET alone, and SERVO_RATE_IN_FORCE_SURFACES below it.

Parameters
minorIOmcu protocol minor version, as acknowledged.
Returns
SERVO_RATE_IN_FORCE for minor at 4.19 or above, SERVO_RATE_IN_FORCE_SURFACES below it. No other state is returned.