|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
One pane of the file manager: a folder of the card, the page of its entries on show, and the row selected. More...
Go to the source code of this file.
Data Structures | |
| struct | fm_entry_t |
| One entry of a page. More... | |
| struct | fm_tree_t |
| One pane. The fields are the pane's; read them, change them through the functions. More... | |
Macros | |
| #define | FM_PAGE_MAX 48 |
| Rows of one page, as LOGS' page (LOG_VIEWER_MAX_FILES). | |
Enumerations | |
| enum | fm_go_t { FM_GO_FIRST = 0 , FM_GO_NEXT , FM_GO_PREV , FM_GO_LAST , FM_GO_SAME } |
| Which page fm_tree_page() reads. More... | |
Functions | |
| void | fm_tree_init (fm_tree_t *tree, const char *dir) |
Start a pane in folder dir, with nothing read yet. | |
| fm_err_t | fm_tree_page (fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, fm_go_t go) |
| Read a page of the pane's folder. | |
| fm_err_t | fm_tree_enter (fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, int row) |
Enter the folder on row row and read its first page. | |
| fm_err_t | fm_tree_up (fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench) |
| Go to the folder above and read its first page, with the folder come from selected when it is on that page. | |
| fm_err_t | fm_tree_select (fm_tree_t *tree, int row) |
Select row row, or nothing for -1. | |
| const fm_entry_t * | fm_tree_selected (const fm_tree_t *tree) |
| The selected entry. | |
| bool | fm_tree_has_prev (const fm_tree_t *tree) |
| Whether a page stands before the one on show. | |
| bool | fm_tree_has_next (const fm_tree_t *tree) |
| Whether a page stands after the one on show. | |
| int | fm_tree_rank (const void *a, const void *b) |
| The pane's order of two entries: folders first, then names with case folded, then their bytes. Strict: zero only for one name. | |
One pane of the file manager: a folder of the card, the page of its entries on show, and the row selected.
A page is up to FM_PAGE_MAX entries in the pane's order: folders first, then names with case folded, ascending; two names that differ only in case, which FAT (File Allocation Table) does not hold, follow by their bytes. ".." is not a row. A page is read by one walk of the folder and kept by fm_select.h while the walk runs, so a folder of 999 files costs one walk per page and the memory of one page. NEXT and PREV are named by the entry at the page's edge, not by a number: a page reads on from the one before it after a file came or went.
A name over FM_LIST_NAME_MAX bytes is not listed: the panel's walk cannot hand it over whole, and a cut name opens nothing. The pane counts them, and the entries the walk leaves out (names starting with "."), as unlisted, so the screen can say so.
Every entry carries what the rules say of it (fm_rules.h) when the page was read: its kind, its place and whether the logger writes it. A job asks the rules again when it starts: a page is a picture of the folder, not a promise.
A page is read from one mount (fm_io.h). A walk that found the card gone and another one mounted is walked again once, on the card in the slot; mount says which card the page is of, and a caller that sees it change knows the card was swapped.
Pure C, no ESP-IDF (Espressif Internet-of-Things Development Framework).
SPDX-License-Identifier: MIT
| enum fm_go_t |
Which page fm_tree_page() reads.
| fm_err_t fm_tree_enter | ( | fm_tree_t * | tree, |
| const fm_io_t * | io, | ||
| const fm_bench_t * | bench, | ||
| int | row ) |
Enter the folder on row row and read its first page.
On a failure the pane stays in its folder and reads its page again.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| row | a row of the page |
| bool fm_tree_has_next | ( | const fm_tree_t * | tree | ) |
Whether a page stands after the one on show.
| tree | the pane |
| bool fm_tree_has_prev | ( | const fm_tree_t * | tree | ) |
Whether a page stands before the one on show.
| tree | the pane |
| void fm_tree_init | ( | fm_tree_t * | tree, |
| const char * | dir ) |
Start a pane in folder dir, with nothing read yet.
| tree | the pane |
| dir | the folder, a path from the root; NULL is the root. A path fm_path_check() refuses is the root. |
| fm_err_t fm_tree_page | ( | fm_tree_t * | tree, |
| const fm_io_t * | io, | ||
| const fm_bench_t * | bench, | ||
| fm_go_t | go ) |
Read a page of the pane's folder.
The selection stays on its name when the name is on the new page, and is cleared otherwise. A page past the folder's end, which a file deleted at the edge leaves, is the last page.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| go | which page |
| int fm_tree_rank | ( | const void * | a, |
| const void * | b ) |
The pane's order of two entries: folders first, then names with case folded, then their bytes. Strict: zero only for one name.
| a | an fm_entry_t |
| b | an fm_entry_t |
a stands above b Select row row, or nothing for -1.
| tree | the pane |
| row | a row of the page, or -1 |
| const fm_entry_t * fm_tree_selected | ( | const fm_tree_t * | tree | ) |
The selected entry.
| tree | the pane |
| fm_err_t fm_tree_up | ( | fm_tree_t * | tree, |
| const fm_io_t * | io, | ||
| const fm_bench_t * | bench ) |
Go to the folder above and read its first page, with the folder come from selected when it is on that page.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |