|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The Hitec programmer's record on the card: HITEC.TXT in the folder BENCH/HITEC/CONF, the values before a write (hitec_card.h). More...
#include <stdatomic.h>#include <stdbool.h>#include <stdio.h>#include <unistd.h>#include "esp_log.h"#include "card_tree.h"#include "hitec_card.h"#include "hitec_panel.h"#include "panel.h"#include "storage.h"Macros | |
| #define | HITEC_FILE_NAME HITEC_CARD_RECORD ".TXT" |
| The record's name, HITEC.TXT. | |
| #define | HITEC_FILE_NEW HITEC_CARD_RECORD ".NEW" |
| The record's name while it is written, HITEC.NEW. | |
Functions | |
| static void | paths (void) |
| The paths of the record and of its new text. | |
| void | hitec_record_write (void) |
| Write the text the render loop handed over (panel.h). | |
| static bool | record_read (const char *path, size_t *len) |
path into s_hitec_file. | |
| void | hitec_record_load (void) |
| Read the record from the card at the start (panel.h). | |
Variables | |
| static const char * | TAG = "hitec" |
| The log tag. | |
| char | s_hitec_file [HITEC_CARD_TEXT_MAX] |
| The record's text (panel.h). | |
| size_t | s_hitec_file_len |
| The bytes of s_hitec_file to write (panel.h). | |
| unsigned | s_hitec_file_mount |
| The mount the text is written to (panel.h). | |
| atomic_uint | s_hitec_file_sent |
| Texts handed over (panel.h). | |
| atomic_uint | s_hitec_file_done |
| Texts written or given up on (panel.h). | |
| atomic_bool | s_hitec_file_ok |
| Whether the card took the last text whole (panel.h). | |
| static char | s_path [96] |
| The record's path, the logger's and the start's. | |
| static char | s_path_new [96] |
| The path of its new text. | |
The Hitec programmer's record on the card: HITEC.TXT in the folder BENCH/HITEC/CONF, the values before a write (hitec_card.h).
Hitec is a name or trademark of its owner; it is used here only to say which servos this module works with.
The render loop fills s_hitec_file and counts s_hitec_file_sent up; the logger task writes it (hitec_record_write()), says in s_hitec_file_ok whether the card took it whole, and counts s_hitec_file_done up. One text at a time: the render loop fills the buffer only while the two counts are equal.
The text goes to HITEC.NEW and takes the name HITEC.TXT once the card holds it whole, so that a write the card or the supply ends leaves one of the two whole: HITEC.TXT as it was, or HITEC.NEW complete. FAT has no rename over a file, so HITEC.TXT is removed between the two; hitec_record_load() takes a whole HITEC.NEW before HITEC.TXT.
The record is read once, at the start, before the tasks run. A card put in later is not read for a record.
SPDX-License-Identifier: MIT
| void hitec_record_load | ( | void | ) |
| void hitec_record_write | ( | void | ) |
|
static |
path into s_hitec_file.
| path | The file. |
| len | Receives its length; 0 for a file that does not read. |
| char s_hitec_file[HITEC_CARD_TEXT_MAX] |
The record's text (panel.h).
The record's text, as hitec_card_text() writes it.
The record's text (panel.h).
| atomic_uint s_hitec_file_done |
| size_t s_hitec_file_len |
| unsigned s_hitec_file_mount |
The mount the text is written to (panel.h).
The mount the text is written to (storage_mount_count()).
The mount the text is written to (panel.h).
| atomic_bool s_hitec_file_ok |