|
| static bool | elapsed (uint32_t now, uint32_t then, uint32_t ms) |
| | Tell whether a millisecond span has elapsed.
|
| void | servo_sync_defaults (servo_sync_cfg_t *cfg, uint16_t centre_us) |
| | Defaults for a sync search.
|
| static uint16_t | pulse_us (int32_t us) |
| | A command within the pulse widths a servo takes.
|
| static int32_t | point_us (const servo_sync_t *sy, uint8_t i) |
| | Where in its window the scan's i-th point sits.
|
| static void | aim (servo_sync_t *sy) |
| | Where the servos should be for the stage being measured.
|
| void | servo_sync_init (servo_sync_t *sy, const servo_sync_cfg_t *cfg) |
| | Start a sync search at the centre stage.
|
| static void | finish (servo_sync_t *sy, servo_sync_state_t state, servo_sync_fault_t fault) |
| | End the search with the servos back at centre.
|
| static void | next_stage (servo_sync_t *sy) |
| | Start the next stage, or finish if that was the last.
|
| static void | close_round (servo_sync_t *sy) |
| | A whole round of points has been measured; narrow, or take the answer.
|
| void | servo_sync_step (servo_sync_t *sy, float total_a, uint32_t now_ms, uint16_t *cmd_a, uint16_t *cmd_b) |
| | Advance the search with one reading of the pair's total current.
|
| float | servo_sync_progress (const servo_sync_t *sy) |
| | 0..1 across all three stages.
|
Search that synchronises two servos on one surface by total current.
SPDX-License-Identifier: MIT
| void servo_sync_step |
( |
servo_sync_t * | sy, |
|
|
float | total_a, |
|
|
uint32_t | now_ms, |
|
|
uint16_t * | cmd_a, |
|
|
uint16_t * | cmd_b ) |
Advance the search with one reading of the pair's total current.
Total, not per servo: the quantity minimised is what the two draw together, so one sensor across both outputs is enough.
Writes the two pulse widths to command through cmd_a and cmd_b.
- Parameters
-
| sy | Search state. |
| total_a | Total current of the pair, A. |
| now_ms | Time of the reading, ms. |
| cmd_a | Out: pulse width for servo A, us. NULL to skip. |
| cmd_b | Out: pulse width for servo B, us. NULL to skip. |