Skip to content

๐Ÿ–ฅ [Software] GUI application that uses the telemetry protocol to control the ventilator.

License

Notifications You must be signed in to change notification settings

makers-for-life/makair-control-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MakAir Control UI

Control Lint dependency status

UI When Ventilation Unit Is Running

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:

  1. Install Rustup
  2. Ensure you are using the Rust stable toolchain: rustup default stable
  3. 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
  4. 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:

  1. Make sure glibc is up to date (e.g. by running pacman -S glibc as root)
  2. Install the following packages: git gcc make cmake pkg-config
  3. Enable NTP by running timedatectl set-ntp TRUE
  4. Install Rustup
  5. Ensure you are using the Rust stable toolchain: rustup default stable
  6. 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:

  1. 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):

  1. Pull the telemetry library (in the parent directory): git pull https://github.com/makers-for-life/makair-telemetry.git
  2. 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 to warn in release mode, else debug);
  • --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 to en; 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:

โžก๏ธ Some CJK languages require building with the fonts-cjk feature in order to render properly:

โ„น๏ธ 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:

  1. 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.
  • 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.

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.

About

๐Ÿ–ฅ [Software] GUI application that uses the telemetry protocol to control the ventilator.

Resources

License

Stars

Watchers

Forks

Languages