Awesome
MakAir Control UI
<p align="center"> <img alt="UI When Ventilation Unit Is Running" src="./doc/screens/unit-running.png"> </p>Versions
Version | Last Changelog | Ready? | Release |
---|---|---|---|
V1.1.x | Operational initial release | ✅ | none |
V1.2.x | Crashes fixed + smoother graph + implemented medical staff feedbacks | ✅ | none |
V1.3.x | Improve text readability, by increasing font sizes | ✅ | view |
V1.4.x | Added internationalization capabilities | ✅ | view |
V1.5.x | Improve UI readability + allow to change MakAir's settings | ✅ | view |
V2.0.x | Telemetry protocol version update to V2 + large code rework + improved UI/UX + reduced CPU usage + translated alarms + regulatory compliance | ✅ | view |
V2.1.x | Ventilation modes + flow sensing + new options + new plot renderer | ✅ | view |
V2.2.x | Patient configuration modal + new error messages + UX improvements | ✅ | view |
V2.3.x | Factory calibration utility + show more errors from the firmware | ✅ | view |
V2.4.x | Store user configurations in firmware EEPROM, eg. locale | ❌ | none |
How To Build?
Building on a computer (for development)
In order to setup your environment and build the code, please follow these steps:
- Install Rustup
- Ensure you are using the Rust stable toolchain:
rustup default stable
- On Linux, make sure you have
cmake
installed and those libraries (debian):libxcb-shape0 libxcb-shape0-dev libxcb-xfixes0 libxcb-xfixes0-dev libfontconfig libfontconfig1-dev libudev-dev
- Build the project:
cargo build
Wayland support may be available but it hasn't been tested. You need a working X11 server.
As well, please make sure that you have at least 2GB of RAM for the build to complete. Running the UI requires less than 40MB of RAM afterwards (in release
mode).
Tested with Rust version: rustc 1.52.1 (9bc8c42bb 2021-05-09)
Note: as the MakAir Control UI currently targets a single 7" touch display, the UI only supports a static resolution of 800 x 480 pixels.
Building on a MakAir ventilator (for end use)
Building directly on a ventilator is convenient for testing purposes while developing. The Raspberry Pi boards in ventilators run ArchLinux. To build on a ventilator:
- Make sure
glibc
is up to date (e.g. by runningpacman -S glibc
as root) - Install the following packages:
git gcc make cmake pkg-config
- Enable NTP by running
timedatectl set-ntp TRUE
- Install Rustup
- Ensure you are using the Rust stable toolchain:
rustup default stable
- Clone the repository and build the project:
cargo build --release
Warning: Do NOT perform a full system upgrade. This has been observed to break the software.
How To Run?
Quick start
To run the Control UI, please ensure that your device first has an open serial connection with the motherboard.
Note that the Control UI relies on the MakAir Telemetry library, which gets pulled from the makair-telemetry repository.
Take note of the serial port used as an input on your Control UI board, and call:
- Run:
./makair-control --port=0
(where--port
is your serial port ID, maybe /dev/ttyUSB0)
You may also play a pre-recorded file, by passing it as an input (this is handy while developing; example records are available in the telemetry library repository):
- Pull the telemetry library (in the parent directory):
git pull https://github.com/makers-for-life/makair-telemetry.git
- Run an example (from the Control UI directory):
./makair-control --input=../makair-telemetry/records/v2/short.record
(where--input
is an UNIX file path)
Available options
The following options can be passed to the Control UI upon running it:
--log={level}
: log level, where{level}
is one of:debug
,info
,warn
,error
(defaults towarn
inrelease
mode, elsedebug
);--port={id}
: serial port identifier to connect to the firmware via the telemetry protocol, where{id}
is a serial port ID, eg.1
;--input={file}
: path to a telemetry record to play in the UI, where{file}
is a record file (all UI controls will be inactive);--output={directory}
: path to directory in which telemetry records should be stored, where{directory}
is a path (disabled by default);--fullscreen
: enables fullscreen mode (used on the final ventilator display only);--translation={locale}
: locale to use in the UI, where{locale}
is a supported locale code (defaults toen
; overrides user settings);--disable-lora
: disables LoRa telemetry broadcasts (lora
build feature);--lora-device={device}
: LoRa device path, where{device}
is a path eg./dev/ttyAMA0
(lora
build feature; defaults to/dev/ttyAMA0
);
Supported Translations
As MakAir was designed to be used internationally, we have made sure that the Control UI was fully translated in major languages.
You can pass the desired locale code when running the makair-control
binary, using the --translation
argument. Make sure to pass the locale ISO code, eg. for French: --translation=fr
.
By default, you do not need to pass the target locale, as it is read from user settings and can be changed by the end-user through the UI. If the --translation
argument is used, then user settings are ignored and the passed locale is forcibly used.
➡️ You can find the list of supported languages, with their ISO language codes below:
- 🇬🇧 English:
en
- 🇫🇷 French:
fr
- 🇩🇪 German:
de
- 🇮🇹 Italian:
it
- 🇪🇸 Spanish:
es
- 🇵🇹 Portuguese:
pt
- 🇱🇻 Latvian:
lv
- 🇷🇺 Russian:
ru
- 🇺🇦 Ukrainian:
uk
➡️ Some CJK languages require building with the fonts-cjk
feature in order to render properly:
- 🇨🇳 Chinese (Simplified):
zh
ℹ️ If your language does not appear in the list above, you may translate the base English file, then open a Pull Request.
How To Build A Release? (Cross-Compile For ARM)
To cross-compile a new release for an ARM target (using MUSL; statically-linked libraries), you can call the release_binaries.sh
script:
- Run:
./scripts/release_binaries.sh --version=1.0.0
Make sure to replace the version
script argument with the current release version. This is used for file naming purposes only.
⚠️ Important note: this is still a work in progress. We are near cross-compiling capabilities, though some work still needs to be done due to non-MUSL C-based dependencies. See issue #38.
Optional Features
The Control UI behavior can be tuned at compile time, by enabling some optional features while building the binary:
-
Support for CJK languages (eg. Chinese):
- Feature name:
fonts-cjk
- Build command:
cargo build --features=fonts-cjk
- Purpose: enables font support for CJK languages. As the CJK font weights 10MB+, and given that all assets get bundled in the final release binary, this feature is disabled by default as an optimization on binary size. If you need to use CJK languages in your MakAir ventilator, please build the Control UI with this feature enabled. Note that with this feature disabled, you will still be able to run with a CJK font, though all its glyphs will render as squares.
- Feature name:
-
Radio broadcasting of metrics over LoRa / LoRaWAN:
- Feature name:
lora
- Build command:
cargo build --features=lora
- Purpose: enables periodic radio broadcasts of metrics, using an attached LoRa transmitter chip. This is an experimental feature, that is turned off by default. It aims at helping us build a central monitoring dashboard for hospitals, nesting all running MakAir metrics together.
- Feature name:
Prepared System Images
Prepared system images that run on a Raspberry Pi and pack the Control UI are available in the makair-files repository (over Git LFS). They can be flashed to a microSD card and ran in a MakAir in a matter of minutes.
You may use a base system image and update it with any newer version of the UI (compiled on the same image, with additional build tools installed). Image update and flash instructions are available within this repository.
Troubleshooting
In case of an issue, please review the following points and check if any could help:
- If you are on Linux, you need to be a member of the
dialout
group for your user to be able to use the device created by the serial port.