|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
FILES: the SD (Secure Digital) card in two panes, commander style, and the operations on its files and folders. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "card_state.h"#include "fm_req.h"#include "fm_rules.h"#include "fm_tree.h"#include "ui_screen.h"Go to the source code of this file.
Data Structures | |
| struct | files_io_t |
| The card's task as the screen reaches it. Every function may be called on the task that renders; none of them waits for the card. More... | |
Enumerations | |
| enum | files_view_t { FILES_VIEW_PANES = 0 , FILES_VIEW_DELETE , FILES_VIEW_INFO , FILES_VIEW_NEW , FILES_VIEW_NAME , FILES_VIEW_JOB } |
| What the screen shows over its panes. More... | |
Functions | |
| void | files_screen_set_io (const files_io_t *io) |
| Point the screen at the card's task. NULL leaves it without one: both panes show no card. | |
| files_view_t | files_screen_view (void) |
| The view on top. | |
| int | files_screen_active (void) |
| The active pane: the one OPEN, RENAME, DELETE, NEW and INFO act in, and whose entry COPY and MOVE take to the other. | |
| const fm_tree_t * | files_screen_pane (int i) |
| A pane as last read. | |
| int | files_screen_scroll (int i) |
| A pane's first row on screen. | |
| const char * | files_screen_message (void) |
| The message line: the last result or refusal, worded in the language showing; "" for none. The write gate's sentence, drawn while the line holds nothing, is not part of it. | |
| bool | files_screen_busy (void) |
| Whether a request is under way on the card's task. | |
| void | files_size_text (char *out, size_t n, uint64_t bytes) |
| A size as the panes and INFO write it, no space before the unit: "300B", "4kB", "3.0MB" from 1MiB, "8.00GB" from 1GiB. The units are binary: 1kB is 1024 bytes. | |
| void | files_time_text (char *out, size_t n, int64_t mtime) |
| A time as INFO writes it: "2024-05-17 12:34", read as UTC, or "" for -1. INFO hands it the stamp moved into the zone SETUP holds (wall_local_s()), and writes FM_INFO_NO_TIME for a stamp wall_stamp_known() refuses. | |
| const ui_screen_t * | files_screen (void) |
| The screen. | |
| void | files_screen_invalidate (void) |
| Repaint the cached chrome into every framebuffer. | |
FILES: the SD (Secure Digital) card in two panes, commander style, and the operations on its files and folders.
Two panes side by side, each a folder of the card with its own page, selection and scroll. The active pane has the accent heading; the other pane's folder is where COPY and MOVE put an entry. A tap on a row of the other pane makes that pane the active one and selects the row. A pane's header is a button that goes up one folder; PREV and NEXT stand beside it while the folder holds more than one page of FM_PAGE_MAX entries.
The footer holds OPEN, COPY, MOVE, RENAME, DELETE, NEW, INFO and RESCAN. OPEN enters a folder, and hands a .CSV file or a report in one of LOGS' three folders to LOGS (log_viewer_show()): the names LOGS' list holds (log_select_lists()), less a file the logger has open. DELETE asks first. NEW makes a folder or an empty text file, its name typed on the file-name keyboard (ui_textkey_open_file()), as RENAME takes one. INFO shows an entry's name, folder, kind, size and time, and a folder's entries. RESCAN looks at the slot and reads both panes from their first pages; a card swapped since is found there, and both panes go back to their start folders: the card's root and USER LOG FOLDER.
Writes are allowed only while the bench is SAFE and no log file is open (fm_gate()); browsing and INFO are allowed in every state. The places the bench keeps take no RENAME, MOVE or DELETE, the servo programmer's journal takes INFO only, and a file the logger writes takes INFO only (fm_rules.h). A footer button that would be refused is drawn dimmed; a tap on it says why in the message line.
The screen makes no card call. Every listing, INFO and job is a request (fm_req.h) handed to the card's task through files_io_t, one at a time; the screen reads the answer once the io says it is in. A copy shows its progress in a box with CANCEL, and stops at its next chunk when the bench is ARMED or a run starts logging.
The screen drives no output.
Pure C, no ESP-IDF (Espressif Internet-of-Things Development Framework).
SPDX-License-Identifier: MIT
| enum files_view_t |
| const ui_screen_t * files_screen | ( | void | ) |
The screen.
| int files_screen_active | ( | void | ) |
The active pane: the one OPEN, RENAME, DELETE, NEW and INFO act in, and whose entry COPY and MOVE take to the other.
| bool files_screen_busy | ( | void | ) |
Whether a request is under way on the card's task.
| const char * files_screen_message | ( | void | ) |
The message line: the last result or refusal, worded in the language showing; "" for none. The write gate's sentence, drawn while the line holds nothing, is not part of it.
| const fm_tree_t * files_screen_pane | ( | int | i | ) |
A pane as last read.
| i | 0 for the left pane, 1 for the right |
i | int files_screen_scroll | ( | int | i | ) |
A pane's first row on screen.
| i | 0 for the left pane, 1 for the right |
i | void files_screen_set_io | ( | const files_io_t * | io | ) |
Point the screen at the card's task. NULL leaves it without one: both panes show no card.
| io | the io, copied |
| files_view_t files_screen_view | ( | void | ) |
The view on top.
| void files_size_text | ( | char * | out, |
| size_t | n, | ||
| uint64_t | bytes ) |
A size as the panes and INFO write it, no space before the unit: "300B", "4kB", "3.0MB" from 1MiB, "8.00GB" from 1GiB. The units are binary: 1kB is 1024 bytes.
| out | takes the text |
| n | bytes at out |
| bytes | the size |
| void files_time_text | ( | char * | out, |
| size_t | n, | ||
| int64_t | mtime ) |
A time as INFO writes it: "2024-05-17 12:34", read as UTC, or "" for -1. INFO hands it the stamp moved into the zone SETUP holds (wall_local_s()), and writes FM_INFO_NO_TIME for a stamp wall_stamp_known() refuses.
| out | takes the text |
| n | bytes at out |
| mtime | seconds since 1970-01-01, or -1 |