Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulator + conrod/glium/winit upgrade #95

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
762e650
Fix repository URL
dsferruzza Nov 24, 2021
d19fcf2
Add simulator
dsferruzza Nov 24, 2021
1048155
Fix Clippy warnings
dsferruzza Nov 24, 2021
d36bdd8
Update rust-embed
dsferruzza Nov 24, 2021
bb55cf1
Update dependencies
dsferruzza Nov 24, 2021
0b428e9
Update to conrod 0.71 + glium 0.28 + winit 0.23
dsferruzza Nov 26, 2021
3278121
Do not start breathing automatically when initializing the simulator
dsferruzza Nov 26, 2021
f92a75c
Update dependencies
dsferruzza Nov 26, 2021
743fba7
UI for simulator tab in advanced settings
Benhalor Nov 26, 2021
0a2d32e
Allow to disable serial support
dsferruzza Nov 26, 2021
3a64d48
Add documentation for the simulator feature
dsferruzza Nov 26, 2021
99ff8b8
Fix warnings and coding style
dsferruzza Nov 26, 2021
f993688
Do not display simulator settings when compilation flag was not enabled
dsferruzza Nov 27, 2021
3801e86
Allow to change simulator settings using the UI
dsferruzza Nov 27, 2021
fc87365
Update to Rust 2021 Edition & update dependencies
dsferruzza Nov 27, 2021
7484e66
update simulator dependecy version
Benhalor Nov 27, 2021
9c7383c
Fix coding style
dsferruzza Nov 27, 2021
54e4887
Hide simulator setting when not running in simulator mode
dsferruzza Nov 27, 2021
7427c87
Fix coding style and warnings
dsferruzza Nov 27, 2021
3872d0c
Update to conrod 0.76
dsferruzza Nov 27, 2021
1da073d
Update to glium 0.30 and winit 0.25
dsferruzza Nov 28, 2021
a40be79
add unit to simulator tab
Benhalor Nov 28, 2021
27d3e24
Remove Cargo profile settings that are defaults
dsferruzza Nov 28, 2021
2962e7e
Add missing file header
dsferruzza Nov 28, 2021
a193738
Add Windows icon and metadata to built executable
dsferruzza Nov 28, 2021
1af3d5e
revert init/run separation and update french locale
Benhalor Nov 28, 2021
943703e
Allow to run from Windows Explorer
dsferruzza Nov 28, 2021
52bb303
Update simulator lib in Cargo.lock
dsferruzza Nov 28, 2021
45abc88
Update dependencies
dsferruzza Nov 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,265 changes: 884 additions & 381 deletions Cargo.lock

Large diffs are not rendered by default.

53 changes: 26 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "makair-control"
name = "makair-control-ui"
version = "2.4.0"
description = "Control UI for the MakAir open source ventilator."
readme = "README.md"
license-file = "LICENSE.md"
edition = "2018"
edition = "2021"
homepage = "https://github.com/makers-for-life/makair"
repository = "https://github.com/makers-for-life/makair.git"
repository = "https://github.com/makers-for-life/makair-control-ui"
keywords = ["covid-19", "fusion-360", "cad", "covid", "coronavirus", "sars-cov-2", "nucleo-board", "covid-respirator", "makair-respirators", "medical", "ards"]
categories = ["gui", "hardware-support"]
authors = ["Valerian Saliou <[email protected]>", "Quentin Adam <[email protected]>", "David Sferruzza <[email protected]>"]
Expand All @@ -23,41 +23,40 @@ confy = "0.4"
lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
paste = "1.0"
rust-embed = { version = "5.6", default-features = false, features = ["compression"] }
rust-embed = { version = "6.2", default-features = false, features = ["compression", "debug-embed"] }
chrono = { version = "0.4", default-features = false }
fluent = "0.15"
fluent = "0.16"
intl-memoizer = "0.5"
unic-langid = "0.9"
inflate = "0.4"
winit = "0.19"
winit = "0.25"
image = { version = "0.23", default-features = false, features = ["png"] }
glium = "0.24"
glium = "0.30"
plotters = { version = "0.3", default_features = false, features = ["chrono", "area_series"] }
plotters-conrod = "0.3"
conrod_glium = "0.70"
conrod_winit = "0.70"
conrod_core = "0.70"
sysfs_gpio = { version = "0.5", optional = true }
plotters-conrod = { git = "https://github.com/dsferruzza/plotters-conrod", branch = "conrod0.71-glium0.28-winit0.23" }
conrod_glium = { git = "https://github.com/dsferruzza/conrod", branch = "update-glium-winit" }
conrod_winit = { git = "https://github.com/dsferruzza/conrod", branch = "update-glium-winit" }
conrod_core = { git = "https://github.com/dsferruzza/conrod", branch = "update-glium-winit" }
sysfs_gpio = { version = "0.6", optional = true }
rn2903 = { git = "https://github.com/waxzce/lora-rust-rn2903-rn2483.git", rev = "b086057ba096920abef3870ad0cefa2c80a343e2", optional = true }
makair-telemetry = { git = "https://github.com/makers-for-life/makair-telemetry", tag = "v2.1.0", default-features = false, features = ["serial"] }
makair-telemetry = { git = "https://github.com/makers-for-life/makair-telemetry", rev = "72e9bf31a9baa5f2ef143bdc313bf5124a5223e2", default-features = false }
makair-simulator = { git = "https://github.com/makers-for-life/makair-simulator", rev = "0b91e1b6fd5740ea3cb379cc16f71d701ce66166", optional = true }

[build-dependencies]
winres = { git = "https://github.com/Skirmisher/winres", rev = "7333e0ff201d25eaaa70352682cd1a37614f93f4" } # https://github.com/mxre/winres/pull/36 is required

[package.metadata.winres]
ProductName = "MakAir Control UI"
CompanyName = "Makers For Life"
LegalCopyright = "Copyright © 2020, Makers For Life"

[features]
default = []
default = ["serial"]
fonts-cjk = []
lora = ["rn2903", "sysfs_gpio"]

[profile.dev]
opt-level = 0
debug = true
debug-assertions = true
serial = ["makair-telemetry/serial"]
simulator = ["makair-simulator"]

[profile.release]
opt-level = 3
lto = true
debug = false
debug-assertions = false

[profile.bench]
opt-level = 3
debug = false
debug-assertions = false
codegen-units = 1
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ The following options can be passed to the Control UI upon running it:
* `--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);
* `--simulator`: use a [MakAir Simulator](https://github.com/makers-for-life/makair-simulator) instance as source of data (`simulator` build feature);
* `--translation={locale}`: locale to use in the UI, where `{locale}` is a [supported locale code](#supported-translations) (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`);
Expand Down Expand Up @@ -121,20 +122,38 @@ _Make sure to replace the `version` script argument with the current release ver

**⚠️ 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](https://github.com/makers-for-life/makair-control-ui/issues/38).**

## Optional Features
## Compilation Features

### Default Features

By default, the Control UI comes with the following features:

* **Support for telemetry/control over serial:**
* Feature name: `serial`
* Purpose: allow to open a serial device (using `-p [device]` or `--port [device]`) in order to get telemetry data from it and send control messages to it.

It is possible to disable all default features at once by using the `--no-default-features` when building with Cargo.
If some default features need to stay enabled, it is possible to add `--features [feature1],[feature2],...` to re-enable them.

### 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`
* 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](https://en.wikipedia.org/wiki/LoRa):**
* Feature name: `lora`
* Build command: `cargo build --features=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.

* **Embed [MakAir Simulator](https://github.com/makers-for-life/makair-simulator):**
* Feature name: `simulator`
* Build command: `cargo build --features simulator`
* Purpose: embed the MakAir Simulator projet, which means that using `-s` or `--simulator` will run the [MakAir Firmware](https://github.com/makers-for-life/makair-firmware) attached to a mathematical model that simulates sensors and actuators in a realistic way and allow to visualize/control it using Control UI.

## Prepared System Images

Prepared system images that run on a Raspberry Pi and pack the Control UI are available in the [makair-files](https://github.com/makers-for-life/makair-files) repository (over Git LFS). They can be flashed to a microSD card and ran in a MakAir in a matter of minutes.
Expand Down
38 changes: 38 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// MakAir Control UI
//
// Copyright: 2020, Makers For Life
// License: Public Domain License

fn main() {
// This is only useful when compiling to a Windows target
if std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap_or_else(|_| "".to_owned()) == "windows"
&& std::env::var("DISABLE_WINRES").is_err()
{
const ICON_PATH: &str = "res/images/app-icon.ico";
println!("cargo:rerun-if-changed={}", ICON_PATH);

let features = std::env::vars_os()
.flat_map(|(k, v)| {
let var_name = k.to_string_lossy();
match var_name.strip_prefix("CARGO_FEATURE_") {
Some(name) if v == "1" => Some(name.to_lowercase()),
_ => None,
}
})
.collect::<Vec<_>>()
.join(", ");

let mut res = winres::WindowsResource::new();
res.set_icon(ICON_PATH);
res.set(
"FileDescription",
&format!(
"{} Compiled with features: {}.",
env!("CARGO_PKG_DESCRIPTION"),
&features
),
);
res.compile()
.expect("could not compile with Windows icon and metadata");
}
}
Binary file added res/images/app-icon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions res/locales/de.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mode-group-alarms = Alarm

advanced-group-statistics = Statistiken
advanced-group-settings = Optionen
advanced-group-simulator = Simulator

modal-close = Schließen
modal-apply = Anwenden
Expand Down Expand Up @@ -105,6 +106,20 @@ modal-advanced-date = Datum
modal-advanced-time = Zeit
modal-advanced-timezone = Zeitzone

modal-advanced-simulator-airway-resistance = Resistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Breath rate
modal-advanced-simulator-spontaneous-breath-effort = Breath effort
modal-advanced-simulator-spontaneous-breath-duration = Breath duration
modal-advanced-simulator-acceleration-factor = Acceleration percent

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = cycle/min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %

initializing-connecting = Inbetriebnahme...
initializing-connected = Initialisierung...

Expand Down
16 changes: 16 additions & 0 deletions res/locales/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mode-group-alarms = Alarms

advanced-group-statistics = Statistics
advanced-group-settings = Settings
advanced-group-simulator = Simulator

modal-close = Close
modal-apply = Apply
Expand Down Expand Up @@ -105,6 +106,21 @@ modal-advanced-date = Date
modal-advanced-time = Time
modal-advanced-timezone = Timezone

modal-advanced-simulator-airway-resistance = Resistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Breath rate
modal-advanced-simulator-spontaneous-breath-effort = Breath effort
modal-advanced-simulator-spontaneous-breath-duration = Breath duration
modal-advanced-simulator-acceleration-factor = Acceleration

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = cycle/min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %


initializing-connecting = Starting up...
initializing-connected = Initializing...

Expand Down
16 changes: 16 additions & 0 deletions res/locales/es.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ mode-group-alarms = Alarmas

advanced-group-statistics = Estadísticas
advanced-group-settings = Configuraciones
advanced-group-simulator = Simulator


modal-close = Cerca
modal-apply = Aplicar
Expand Down Expand Up @@ -105,6 +107,20 @@ modal-advanced-date = Fecha
modal-advanced-time = Hora
modal-advanced-timezone = Zona horaria

modal-advanced-simulator-airway-resistance = Resistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Breath rate
modal-advanced-simulator-spontaneous-breath-effort = Breath effort
modal-advanced-simulator-spontaneous-breath-duration = Breath duration
modal-advanced-simulator-acceleration-factor = Acceleration percent

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = cycle/min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %

initializing-connecting = Empezando...
initializing-connected = Inicializando...

Expand Down
16 changes: 16 additions & 0 deletions res/locales/fr.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ mode-group-alarms = Alarmes

advanced-group-statistics = Statistiques
advanced-group-settings = Paramètres
advanced-group-simulator = Simulateur


modal-close = Fermer
modal-apply = Valider
Expand Down Expand Up @@ -105,6 +107,20 @@ modal-advanced-date = Date
modal-advanced-time = Heure
modal-advanced-timezone = Fuseau horaire

modal-advanced-simulator-airway-resistance = Résistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Fréquence respiratoire
modal-advanced-simulator-spontaneous-breath-effort = Effort spontané
modal-advanced-simulator-spontaneous-breath-duration = Durée d'effort
modal-advanced-simulator-acceleration-factor = Accélération du temps

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = /min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %

initializing-connecting = Démarrage en cours...
initializing-connected = Préparation en cours...

Expand Down
16 changes: 16 additions & 0 deletions res/locales/it.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ mode-group-alarms = Allarmi

advanced-group-statistics = Statistiche
advanced-group-settings = Impostazioni
advanced-group-simulator = Simulator


modal-close = Cerca
modal-apply = Aplicar
Expand Down Expand Up @@ -105,6 +107,20 @@ modal-advanced-date = Data
modal-advanced-time = Tempo
modal-advanced-timezone = Fuso orario

modal-advanced-simulator-airway-resistance = Resistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Breath rate
modal-advanced-simulator-spontaneous-breath-effort = Breath effort
modal-advanced-simulator-spontaneous-breath-duration = Breath duration
modal-advanced-simulator-acceleration-factor = Acceleration percent

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = cycle/min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %

initializing-connecting = Cominciando...
initializing-connected = Inizializzazione in corso...

Expand Down
16 changes: 16 additions & 0 deletions res/locales/lv.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ mode-group-alarms = Signāli

advanced-group-statistics = Statistika
advanced-group-settings = Iestatījumi
advanced-group-simulator = Simulator


modal-close = Aizvērt
modal-apply = Piesakies
Expand Down Expand Up @@ -105,6 +107,20 @@ modal-advanced-date = Datums
modal-advanced-time = Laiks
modal-advanced-timezone = Laika zona

modal-advanced-simulator-airway-resistance = Resistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Breath rate
modal-advanced-simulator-spontaneous-breath-effort = Breath effort
modal-advanced-simulator-spontaneous-breath-duration = Breath duration
modal-advanced-simulator-acceleration-factor = Acceleration percent

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = cycle/min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %

initializing-connecting = Notiek palaišana...
initializing-connected = Notiek inicializēšana...

Expand Down
15 changes: 15 additions & 0 deletions res/locales/pt.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mode-group-alarms = Alarmes

advanced-group-statistics = Estatisticas
advanced-group-settings = Configurações
advanced-group-simulator = Simulator

modal-close = Fechar
modal-apply = Aplique
Expand Down Expand Up @@ -105,6 +106,20 @@ modal-advanced-date = Encontro
modal-advanced-time = Tempo
modal-advanced-timezone = Fuso horário

modal-advanced-simulator-airway-resistance = Resistance
modal-advanced-simulator-airway-compliance = Compliance
modal-advanced-simulator-spontaneous-breath-rate = Breath rate
modal-advanced-simulator-spontaneous-breath-effort = Breath effort
modal-advanced-simulator-spontaneous-breath-duration = Breath duration
modal-advanced-simulator-acceleration-factor = Acceleration percent

modal-advanced-simulator-airway-resistance-unit = cmH2O/L/s
modal-advanced-simulator-airway-compliance-unit = mL/cmH2O
modal-advanced-simulator-spontaneous-breath-rate-unit = cycle/min
modal-advanced-simulator-spontaneous-breath-effort-unit = cmH2O
modal-advanced-simulator-spontaneous-breath-duration-unit = ms
modal-advanced-simulator-acceleration-factor-unit = %

initializing-connecting = Começando...
initializing-connected = Inicializando...

Expand Down
Loading