diff --git a/archbee.json b/archbee.json index b9c818f..e004ac6 100644 --- a/archbee.json +++ b/archbee.json @@ -32,6 +32,12 @@ "path": "dev-log/Dev-Log.md", "isFoldedByDefault": true, "children": [ + { + "categoryName": "#7", + "isCategory": false, + "path": "dev-log/7.md", + "children": [] + }, { "categoryName": "#6", "isCategory": false, diff --git a/docs/dev-log/7.md b/docs/dev-log/7.md new file mode 100644 index 0000000..37a5886 --- /dev/null +++ b/docs/dev-log/7.md @@ -0,0 +1,109 @@ +--- +title: "#7: Screen streaming and input emulation" +slug: dev-log/7 +--- + +This is our Dev Log where we share how the development of Flipper One is going. + +**In this Dev Log:** RPC screen streaming and input injection over RPC, CLI tools for scripting input and viewing the screen from a terminal, 3D-printed PCB fit-checks, Recovery OS, fuel gauge calibration for the battery pack, and a USB teardown bug we'd love help fixing. + +--- + +## Screen streaming over RPC + +We're continuing our work on the automated testing toolchain. This week, we've enabled [screen streaming and input-signal injection](https://github.com/flipperdevices/flipperone-mcu-firmware/pull/210), allowing us to build automated tests for Flipper One's UI. + +Screen streaming runs over USB or a Flipper One debug probe and uses RPC (Remote Procedure Call), the same protobuf-based protocol as on Flipper Zero. Streaming over a debug probe is available both in the MCU mode (low power consumption) and the CPU mode (running boot menu and Linux), while USB only works in the MCU mode (as the CPU takes control of USB when it starts). + +::embed[]{url="https://www.youtube.com/watch?v=DbhWdC43dUY"} + +The debug probe connection uses UART, which limits speed to around 1.5 Mbaud (146 KB/s). With a frame size of 37 KB (255px × 144px × 1 byte for grayscale), it allows a frame rate of 3.9 FPS, which reduces to 3.2 FPS in practice, due to the data processing lag. That's not much, but more than enough for UI testing. + +::embed[]{url="https://www.youtube.com/watch?v=bFnkLBRDYVg"} + + +## Input emulation CLI for automated testing + +One of our engineers built a [CLI tool](https://github.com/flipperdevices/flipperone-mcu-firmware/pull/205) that injects key and touch events directly over the debug console, without touching the physical buttons or screen. This means we'll be able to script input for automated tests, instead of relying on someone physically pressing buttons or touching the screen for every test run. + +![Input emulation CLI over a serial console, injecting button presses and a touch gesture](/files/pics/dev-log/7/cli-input-emulation-log.jpg "`input send` and `input touch` commands injecting key presses and a touch drag") + +The `input` command can inject button presses (`send `) and touch events (`touch `). In the log above, a sequence of `touch Start`/`Move`/`End` commands traces out a rectangle — and that same rectangle shows up on the Flipper One screen, in the on-device touchpad test tool: + +![Flipper One's touchpad test screen showing a rectangle traced entirely by injected touch events](/files/pics/dev-log/7/cli-input-emulation-gui.jpg "Touchpad Test screen showing the rectangle traced by the emulated input") + +--- + +## Screen viewer in a terminal + +Our community contributor @HobbitTheCat added a [`screen` command to the Flipper ONE CLI](https://github.com/flipperdevices/flipperone-mcu-firmware/pull/179). This command streams the Flipper One display straight into a terminal over the same VCP/UART CLI pipeline, and lets you control the device from there — arrow keys or WASD to navigate, number keys for the bottom buttons, and Enter/Backspace to confirm or go back. + +![CLI screen viewer showing the Flipper One UI rendered with Unicode Braille patterns](/files/pics/dev-log/7/cli-screen-test.png "Live display streamed into a terminal with the `screen` CLI command") + +Frames are rendered using Unicode Braille patterns, which map 1:1 onto the display's pixels. We also tried a one-character-per-pixel grayscale approach, but it needed the terminal font shrunk so much that the UI's fine text became unreadable — Braille encoding keeps pixel accuracy without touching the font size. + +--- + +## 3d-printing PCBs before assembly + +Last week we released the PCB revision 2.F0B1C2. As a part of pre-release testing, we 3d-printed all PCBs to make sure they fit and the whole device could be assembled. + +On the photo you can see the main board model, the small touchpad board, and the control board: + +![](/files/pics/dev-log/7/3d-printed-PCBs.jpg "From top left: main board, touchpad board, and control board") + +## Recovery OS + +You can now boot into Recovery OS on Flipper One. Recovery OS is a minimal Linux build whose job is to help you get a broken Flipper One to work again. + +Recovery OS is currently available as a boot menu option, and we're also working to make it reachable from an MCU-level menu, even before the boot menu starts. Once that's in place, even if the boot record is damaged and the boot menu doesn't start, you'll still be able to run Recovery OS and reinstall the system. This method skips U-Boot entirely: the MCU will use Falcon Mode to tell the CPU which partition to boot from directly. + +Recovery OS image is stored in Flipper One's persistent storage (UFS), separately from the boot record and OS profiles, and boots straight into RAM. Recovery OS will include the Flipper OS installer and profile management tools. Besides, it creates and exposes a RAM-disk at half of the available memory. You can use the disk to upload a newer installer version or your backed up profiles. + +--- + +## Tracking remaining battery charge + +Do you know how a device tracks remaining battery charge? There's a special chip called a _fuel gauge_. It reads the battery voltage, current, and temperature data, and calculates remaining charge. But first, you need to calibrate the fuel gauge with a thing called _battery chemistry ID_. + +Flipper One has a 2-cell battery pack with a capacity of 3250 mAh at 7.74V. This week we ran a series of battery discharge tests and fed the logged data into TI's Impedance Track chemistry ID selection tool, to find the closest chemistry match. + +Below is a part of the tool's output: + +``` +Chemistry ID selection tool, rev=2.57 + +Configuration used in present fit: +ProcessingType = 2 +NumCellSeries = 2 +ElapsedTimeColumn = 0 +VoltageColumn = 1 +CurrentColumn = 2 +TemperatureColumn = 3 + +Best chemical ID : 3702 Best chemical ID max. deviation, % : 1.39 +... +Max. deviations for best ID is within recommended range. Chosen best chemical ID is suitable for programming the gauge. +``` + +The best match for the current battery is chemistry ID **3702**, with a maximum depth-of-discharge deviation of just 1.39%. You can view the deviation as a measure of confidence: a number like 1–2% (our winning ID is at 1.39%) is a very close match, while something like 10% means that the fuel gauge would make mistakes if calibrated with this chemistry ID. + +The work doesn't stop on the fuel gauge calibration. As a next step, we're going to check how the battery degrades over multiple recharge cycles. We'll keep you updated on this research. + +## Another USB bug — \[help wanted\] + +Last week, we found and fixed a bug, rendering USB unusable. This new week brought us a new one, not so severe, but annoying: every time a USB gadget (like our MTP/mass-storage/NCM composite) is torn down, the kernel logs a `was not queued to ep0out` error. It's cosmetic — the request has already completed by the time it's dequeued, so nothing leaks and no transfer is affected — but it drowns out real USB errors in the logs. + +If you're in a contribution mood, we invite you to help us with this bug; see [flipperdevices/flipper-linux-kernel#20](https://github.com/flipperdevices/flipper-linux-kernel/issues/20). + +## More U-boot patches going upstream + +--- + +## Join Flipper One development and make your contribution + +- Building a project that helps test or improve Flipper One? Add it to the [community projects](../community/community.md) page. +- 3rd-party module contributions are welcome! Check out the [contribution guide](../mechanics/About-Mechanics.md#contribute-a-third-party-module) and open a pull request in [flipperdevices/flipperone-mechanics](https://github.com/flipperdevices/flipperone-mechanics). +- We have many other tasks open to the community! See the full list on the [🚧 Open tasks](https://docs.flipper.net/one/open-tasks) page. + +See you in the next Dev Log! diff --git a/docs/dev-log/Dev-Log.md b/docs/dev-log/Dev-Log.md index 5b08244..4bd0074 100644 --- a/docs/dev-log/Dev-Log.md +++ b/docs/dev-log/Dev-Log.md @@ -13,6 +13,8 @@ This is our regular Dev Log, where we share how Flipper One development is going All logs: +- [#7: PCB fit-checks with 3D-printed models](./7.md), and a CLI tool for injecting button and touch input during automated tests. + - [#6: New PCB revision assembled](./6.md), Flipper One developer kit and rack unit, OS profiles prototype, multifunctional device over USB-C1, and the Flipper OS installer. - [#5: M.2 port testing in R&D and production](./5.md), power-on and boot sequence design, and extended pixel fonts for FlipCTL / Flipper One UI. diff --git a/docs/files/pics/dev-log/7/3d-printed-PCBs.jpg b/docs/files/pics/dev-log/7/3d-printed-PCBs.jpg new file mode 100644 index 0000000..c411c13 Binary files /dev/null and b/docs/files/pics/dev-log/7/3d-printed-PCBs.jpg differ diff --git a/docs/files/pics/dev-log/7/cli-input-emulation-gui.jpg b/docs/files/pics/dev-log/7/cli-input-emulation-gui.jpg new file mode 100644 index 0000000..0734c88 Binary files /dev/null and b/docs/files/pics/dev-log/7/cli-input-emulation-gui.jpg differ diff --git a/docs/files/pics/dev-log/7/cli-input-emulation-log.jpg b/docs/files/pics/dev-log/7/cli-input-emulation-log.jpg new file mode 100644 index 0000000..668258e Binary files /dev/null and b/docs/files/pics/dev-log/7/cli-input-emulation-log.jpg differ