|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The write side of the programmer for servos by Hitec: the draft and its edits, the soft rules and their confirmations, the write switch, the writes, and the record of a write. See hitec_prog.h. More...
Functions | |
| static hitec_prog_msg_id_t | say (hitec_prog_t *p, hitec_prog_msg_id_t id, unsigned arg) |
Say message id with one argument. | |
| const hitec_image_t * | hitec_prog_draft (const hitec_prog_t *p) |
| The draft: the servo read with the edits; NULL with no servo read. | |
| bool | hitec_prog_can_edit (const hitec_prog_t *p) |
| Whether an edit is taken now: the port held and idle, the servo in programming mode and read, the port not stopped. | |
| bool | hitec_prog_editable (const hitec_prog_t *p, uint8_t id) |
Whether parameter id of the servo's layout takes an edit. | |
| bool | hitec_prog_differs (const hitec_prog_t *p, const hitec_image_t *img, uint8_t id) |
Whether parameter id differs in img from the servo read: in its decoded value or in its stored value. | |
| static unsigned | differing (const hitec_prog_t *p, const hitec_image_t *img) |
The parameters in which img differs from the servo read. | |
| unsigned | hitec_prog_changes (const hitec_prog_t *p) |
| The writable parameters in which the draft differs from the servo read. | |
| bool | hitec_prog_sum_bad (const hitec_prog_t *p) |
| Whether the classic servo read has cells 0x00 to 0x1C that do not sum to 0. | |
| bool | hitec_prog_first_done (const hitec_prog_t *p) |
| Whether the first write of this CONNECT has gone out. | |
| bool | hitec_prog_write_progress (const hitec_prog_t *p, unsigned *done, unsigned *total, uint8_t *kind) |
| The progress of the running write. | |
| static int32_t | mag (int32_t v) |
The absolute value of v. | |
| uint16_t | hitec_prog_rules (const hitec_prog_t *p, uint8_t id, int32_t value) |
The soft rules value of parameter id breaks against the servo read. | |
| static bool | covered (const hitec_prog_t *p, uint8_t id, int32_t value) |
Whether a confirmation covers value of id: the value confirmed, or one on its side of the servo's value and no further from it. | |
| static hitec_prog_msg_id_t | edit_gate (const hitec_prog_t *p) |
| Why an edit is not taken now. | |
| static hitec_prog_edit_t | trial (hitec_prog_t *p, uint8_t id, int32_t value, hitec_image_t *out) |
Take value of id into a copy of the draft. | |
| hitec_prog_edit_t | hitec_prog_edit (hitec_prog_t *p, uint8_t id, int32_t value) |
Edit the draft: value in the unit of parameter id. | |
| uint16_t | hitec_prog_pending (const hitec_prog_t *p, uint8_t *id, int32_t *value) |
| The edit that waits for a confirmation. | |
| hitec_prog_edit_t | hitec_prog_confirm (hitec_prog_t *p) |
| Take the edit that waits: its rules are confirmed for its value. | |
| void | hitec_prog_cancel (hitec_prog_t *p) |
| Drop the edit that waits; the draft stays as it was. | |
| static void | unconfirm (hitec_prog_t *p) |
| Every confirmation ends, and the edit that waits. | |
| void | hitec_prog_discard (hitec_prog_t *p) |
| DISCARD EDITS: the draft is the servo read again, and every confirmation ends. | |
| hitec_prog_msg_id_t | hitec_prog_write_enable (hitec_prog_t *p, bool on) |
| ENABLE WRITE TO SERVO. | |
| bool | hitec_prog_write_on (const hitec_prog_t *p) |
| Whether ENABLE WRITE TO SERVO is on. | |
| hitec_prog_msg_id_t | hitec_prog_write_gate (const hitec_prog_t *p, uint8_t kind) |
Why a write of kind is not taken now, the switch included. | |
| static void | file_due (hitec_prog_t *p) |
| The record's text is due on the card. | |
| static void | rec_clear (hitec_prog_t *p) |
| The record ends: the write it stood for is verified, or nothing of it was sent. | |
| static void | not_sent (hitec_prog_t *p, hitec_ses_t r) |
| A write that ended before a step reached the servo: the record goes with it, a RESTORE's excepted, and the switch goes off. | |
| static void | go (hitec_prog_t *p) |
| The write goes out: its plan, step by step. | |
| static hitec_prog_msg_id_t | start (hitec_prog_t *p, uint8_t kind, const hitec_image_t *target) |
Start a write of kind to target. | |
| hitec_prog_msg_id_t | hitec_prog_write (hitec_prog_t *p) |
| WRITE n VALUES: the draft to the servo, then its read-back. | |
| hitec_prog_msg_id_t | hitec_prog_repair (hitec_prog_t *p) |
| REPAIR: the classic balance 0x1C alone, then the read-back. | |
| static bool | compared (uint8_t series, uint8_t addr) |
| The addresses a write and the record compare: what a plan writes, without the classic balance. | |
| static unsigned | at (const hitec_image_t *img, uint8_t addr) |
The value at addr of img in its series' width. | |
| bool | hitec_prog_restore_image (const hitec_prog_t *p, hitec_image_t *out) |
| The image RESTORE writes: the servo read with the record's values before the write. | |
| hitec_prog_msg_id_t | hitec_prog_restore (hitec_prog_t *p) |
| RESTORE: the values before the recorded write back to the servo, as a write; the record stays until it ends verified. | |
| static unsigned | diff_count (const hitec_prog_t *p) |
| How many addresses the read-back found different. | |
| void | hpw_write_done (hitec_prog_t *p, hitec_ses_t r) |
A write operation ended with r. | |
| bool | hitec_prog_record (const hitec_prog_t *p) |
| Whether a record of a write stands. | |
| hitec_prog_rec_t | hitec_prog_record_verdict (const hitec_prog_t *p) |
| What the last servo read holds of the record. | |
| static hitec_prog_rec_t | verdict (const hitec_prog_t *p) |
| What the servo read holds of the record. | |
| static void | rec_compare (hitec_prog_t *p) |
| Compare the servo read with the record and say what it holds. | |
| hitec_prog_msg_id_t | hitec_prog_forget (hitec_prog_t *p) |
| FORGET: discard the record without a write. | |
| bool | hitec_prog_file_due (const hitec_prog_t *p) |
| Whether the record's text is to go to the card. | |
| size_t | hitec_prog_file_take (hitec_prog_t *p, char *out, size_t n) |
The record's text for the card: fill out and return its length; 0 while none is due, no card is mounted or n is under HITEC_CARD_TEXT_MAX. | |
| void | hitec_prog_file_done (hitec_prog_t *p, bool ok) |
| How the card took the text hitec_prog_file_take() gave. | |
| bool | hitec_prog_file_load (hitec_prog_t *p, const char *text, size_t len) |
| The record's text as the card held it at the start. | |
| void | hpw_connect (hitec_prog_t *p) |
| A CONNECT starts: the switch off, the edits and the confirmations gone; the record stays. | |
| void | hpw_off (hitec_prog_t *p) |
| The write switch goes off: a LEAVE, a lost link, a stop. | |
| void | hpw_read_done (hitec_prog_t *p, bool had, const hitec_image_t *was) |
| A full read ended well: the draft is the servo again, the switch goes off when the servo changed, and a record stands against it. | |
| void | hpw_tick (hitec_prog_t *p) |
| Every feed: a stop switches the switch off, and a write that waits for the card gives up after HITEC_PROG_CARD_MS. | |
| bool | hpw_abort (hitec_prog_t *p) |
| ABORT of a write that waits for the card: nothing was written. | |
The write side of the programmer for servos by Hitec: the draft and its edits, the soft rules and their confirmations, the write switch, the writes, and the record of a write. See hitec_prog.h.
Hitec is a name or trademark of its owner; it is used here only to say which servos this module works with.
SPDX-License-Identifier: MIT
|
static |
The value at addr of img in its series' width.
| img | The image. |
| addr | The address. |
|
static |
The addresses a write and the record compare: what a plan writes, without the classic balance.
| series | hitec_family_t. |
| addr | The address. |
|
static |
Whether a confirmation covers value of id: the value confirmed, or one on its side of the servo's value and no further from it.
| p | The programmer. |
| id | hitec_param_t. |
| value | The value. |
|
static |
How many addresses the read-back found different.
| p | The programmer. |
|
static |
The parameters in which img differs from the servo read.
| p | The programmer. |
| img | The image. |
|
static |
Why an edit is not taken now.
| p | The programmer. |
|
static |
The record's text is due on the card.
| p | The programmer. |
|
static |
The write goes out: its plan, step by step.
| p | The programmer. |
| bool hitec_prog_can_edit | ( | const hitec_prog_t * | p | ) |
Whether an edit is taken now: the port held and idle, the servo in programming mode and read, the port not stopped.
| p | The programmer. |
| void hitec_prog_cancel | ( | hitec_prog_t * | p | ) |
Drop the edit that waits; the draft stays as it was.
| p | The programmer. |
| unsigned hitec_prog_changes | ( | const hitec_prog_t * | p | ) |
The writable parameters in which the draft differs from the servo read.
| p | The programmer. |
| hitec_prog_edit_t hitec_prog_confirm | ( | hitec_prog_t * | p | ) |
Take the edit that waits: its rules are confirmed for its value.
| p | The programmer. |
| bool hitec_prog_differs | ( | const hitec_prog_t * | p, |
| const hitec_image_t * | img, | ||
| uint8_t | id ) |
Whether parameter id differs in img from the servo read: in its decoded value or in its stored value.
| p | The programmer. |
| img | The image; the draft for NULL. |
| id | hitec_param_t. |
| void hitec_prog_discard | ( | hitec_prog_t * | p | ) |
DISCARD EDITS: the draft is the servo read again, and every confirmation ends.
| p | The programmer. |
| const hitec_image_t * hitec_prog_draft | ( | const hitec_prog_t * | p | ) |
The draft: the servo read with the edits; NULL with no servo read.
| p | The programmer. |
| hitec_prog_edit_t hitec_prog_edit | ( | hitec_prog_t * | p, |
| uint8_t | id, | ||
| int32_t | value ) |
Edit the draft: value in the unit of parameter id.
A value equal to the draft's changes nothing. A value hitec_param_set() refuses is refused (HITEC_PROG_MSG_EDIT_REFUSED, arg its hitec_set_t). A value that breaks a soft rule not confirmed for it waits: hitec_prog_pending() names it, hitec_prog_confirm() takes it, hitec_prog_cancel() drops it.
| p | The programmer. |
| id | hitec_param_t. |
| value | The value. |
| bool hitec_prog_editable | ( | const hitec_prog_t * | p, |
| uint8_t | id ) |
Whether parameter id of the servo's layout takes an edit.
| p | The programmer. |
| id | hitec_param_t. |
| void hitec_prog_file_done | ( | hitec_prog_t * | p, |
| bool | ok ) |
How the card took the text hitec_prog_file_take() gave.
Only the answer to the text that holds the record of the write waiting in HITEC_PROG_RECORDING releases that write, or ends it when the card refused the text. The answer to a text taken before that write began, the record of an aborted or timed-out write or the text that clears a record, only frees the card for the next text.
| p | The programmer. |
| ok | true when the card holds it whole. |
| bool hitec_prog_file_due | ( | const hitec_prog_t * | p | ) |
Whether the record's text is to go to the card.
| p | The programmer. |
| bool hitec_prog_file_load | ( | hitec_prog_t * | p, |
| const char * | text, | ||
| size_t | len ) |
The record's text as the card held it at the start.
| p | The programmer. |
| text | The text. |
| len | Its length in bytes. |
| size_t hitec_prog_file_take | ( | hitec_prog_t * | p, |
| char * | out, | ||
| size_t | n ) |
The record's text for the card: fill out and return its length; 0 while none is due, no card is mounted or n is under HITEC_CARD_TEXT_MAX.
| p | The programmer. |
| out | Receives the text. |
| n | Bytes at out. |
| bool hitec_prog_first_done | ( | const hitec_prog_t * | p | ) |
Whether the first write of this CONNECT has gone out.
| p | The programmer. |
| hitec_prog_msg_id_t hitec_prog_forget | ( | hitec_prog_t * | p | ) |
FORGET: discard the record without a write.
| p | The programmer. |
| uint16_t hitec_prog_pending | ( | const hitec_prog_t * | p, |
| uint8_t * | id, | ||
| int32_t * | value ) |
The edit that waits for a confirmation.
| p | The programmer. |
| id | Receives its hitec_param_t; may be NULL. |
| value | Receives its value; may be NULL. |
| bool hitec_prog_record | ( | const hitec_prog_t * | p | ) |
Whether a record of a write stands.
| p | The programmer. |
| hitec_prog_rec_t hitec_prog_record_verdict | ( | const hitec_prog_t * | p | ) |
What the last servo read holds of the record.
| p | The programmer. |
| hitec_prog_msg_id_t hitec_prog_repair | ( | hitec_prog_t * | p | ) |
REPAIR: the classic balance 0x1C alone, then the read-back.
| p | The programmer. |
| hitec_prog_msg_id_t hitec_prog_restore | ( | hitec_prog_t * | p | ) |
RESTORE: the values before the recorded write back to the servo, as a write; the record stays until it ends verified.
Taken once the servo read is compared and is not another servo.
| p | The programmer. |
| bool hitec_prog_restore_image | ( | const hitec_prog_t * | p, |
| hitec_image_t * | out ) |
The image RESTORE writes: the servo read with the record's values before the write.
| p | The programmer. |
| out | Receives it. |
| uint16_t hitec_prog_rules | ( | const hitec_prog_t * | p, |
| uint8_t | id, | ||
| int32_t | value ) |
The soft rules value of parameter id breaks against the servo read.
| p | The programmer. |
| id | hitec_param_t. |
| value | The value. |
| bool hitec_prog_sum_bad | ( | const hitec_prog_t * | p | ) |
Whether the classic servo read has cells 0x00 to 0x1C that do not sum to 0.
| p | The programmer. |
| hitec_prog_msg_id_t hitec_prog_write | ( | hitec_prog_t * | p | ) |
WRITE n VALUES: the draft to the servo, then its read-back.
| p | The programmer. |
| hitec_prog_msg_id_t hitec_prog_write_enable | ( | hitec_prog_t * | p, |
| bool | on ) |
ENABLE WRITE TO SERVO.
Off is always taken. On needs the state hitec_prog_can_edit() needs, a SAFE bench and no STOP latched.
| p | The programmer. |
| on | The switch. |
| hitec_prog_msg_id_t hitec_prog_write_gate | ( | const hitec_prog_t * | p, |
| uint8_t | kind ) |
Why a write of kind is not taken now, the switch included.
| p | The programmer. |
| kind | hitec_prog_wr_t. |
| bool hitec_prog_write_on | ( | const hitec_prog_t * | p | ) |
Whether ENABLE WRITE TO SERVO is on.
| p | The programmer. |
| bool hitec_prog_write_progress | ( | const hitec_prog_t * | p, |
| unsigned * | done, | ||
| unsigned * | total, | ||
| uint8_t * | kind ) |
The progress of the running write.
| p | The programmer. |
| done | Receives the plan's steps done. |
| total | Receives its steps. |
| kind | Receives the hitec_step_kind_t of the step out; 0xFF in the read-back. |
| bool hpw_abort | ( | hitec_prog_t * | p | ) |
ABORT of a write that waits for the card: nothing was written.
| p | The programmer. |
| void hpw_connect | ( | hitec_prog_t * | p | ) |
A CONNECT starts: the switch off, the edits and the confirmations gone; the record stays.
| p | The programmer. |
| void hpw_off | ( | hitec_prog_t * | p | ) |
The write switch goes off: a LEAVE, a lost link, a stop.
| p | The programmer. |
| void hpw_read_done | ( | hitec_prog_t * | p, |
| bool | had, | ||
| const hitec_image_t * | was ) |
A full read ended well: the draft is the servo again, the switch goes off when the servo changed, and a record stands against it.
| p | The programmer. |
| had | A servo was read before. |
| was | What that read found; NULL with none. |
| void hpw_tick | ( | hitec_prog_t * | p | ) |
Every feed: a stop switches the switch off, and a write that waits for the card gives up after HITEC_PROG_CARD_MS.
| p | The programmer. |
| void hpw_write_done | ( | hitec_prog_t * | p, |
| hitec_ses_t | r ) |
A write operation ended with r.
| p | The programmer. |
| r | Its result. |
|
static |
The absolute value of v.
| v | The value. |
|
static |
A write that ended before a step reached the servo: the record goes with it, a RESTORE's excepted, and the switch goes off.
| p | The programmer. |
| r | The session's result. |
|
static |
The record ends: the write it stood for is verified, or nothing of it was sent.
| p | The programmer. |
|
static |
Compare the servo read with the record and say what it holds.
| p | The programmer. |
|
static |
Say message id with one argument.
| p | The programmer. |
| id | hitec_prog_msg_id_t. |
| arg | Its argument. |
id.
|
static |
Start a write of kind to target.
| p | The programmer. |
| kind | hitec_prog_wr_t. |
| target | What the servo is to hold. |
|
static |
Take value of id into a copy of the draft.
| p | The programmer. |
| id | hitec_param_t. |
| value | The value. |
| out | Receives the draft with the edit. |
|
static |
Every confirmation ends, and the edit that waits.
| p | The programmer. |
|
static |
What the servo read holds of the record.
Another series, another port or another D series model is another servo, and so is an address that holds neither the value before the write nor the value the write was to leave.
| p | The programmer. |