Ported cprassist to Banglejs2

pull/1210/head
Adam Schmalhofer 2021-12-17 22:57:09 +01:00
parent d3ccc08209
commit d75940b9e6
3 changed files with 12 additions and 10 deletions

View File

@ -2970,11 +2970,11 @@
{
"id": "cprassist",
"name": "CPR Assist",
"version": "0.01",
"version": "0.02",
"description": "Provides assistance while performing a CPR",
"icon": "cprassist-icon.png",
"tags": "tool,firstaid",
"supports": ["BANGLEJS"],
"supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",
"allow_emulator": true,
"screenshots": [{"url":"bangle1-CPR-assist-screenshot.png"}],

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Ported to Banglejs2

View File

@ -35,23 +35,24 @@ function provideFeedback() {
}
function drawHeart() {
g.fillCircle(40, 92, 12);
g.fillCircle(60, 92, 12);
g.fillPoly([29, 98, 50, 120, 71, 98]);
var lowestPoint = g.getHeight()*3/5;
g.fillCircle(40, lowestPoint-29, 12);
g.fillCircle(60, lowestPoint-29, 12);
g.fillPoly([29, lowestPoint-22, 50, lowestPoint, 71, lowestPoint-22]);
}
function updateScreen() {
const colors = [0xFFFF, 0x9492];
g.reset().clearRect(0, 50, 250, 150);
g.reset().clearRect(0, 0, 250, g.getHeight()*5/6);
if (counter > 0) {
g.setFont("Vector", 40).setFontAlign(0, 0);
g.setColor(colors[counter%2]);
drawHeart();
g.drawString(counter + "", g.getWidth()/2, 100);
g.drawString(counter, 120, g.getHeight()*3/5-20);
} else {
g.setFont("Vector", 20).setFontAlign(0, 0);
g.drawString("RESCUE", g.getWidth()/2, 70);
g.drawString("BREATHS", g.getWidth()/2, 120);
g.drawString("RESCUE", g.getWidth()/2, g.getHeight()/3);
g.drawString("BREATHS", g.getWidth()/2, g.getHeight()*3/5);
}
}
@ -73,7 +74,7 @@ function tick() {
interval = setInterval(tick, 60000/setting('compression_rpm'));
g.clear(1).setFont("6x8");
g.drawString(setting('compression_count') + ' / ' + setting('breath_count'), 30, 200);
g.drawString(setting('compression_count') + ' / ' + setting('breath_count'), 30, g.getHeight()*5/6);
Bangle.loadWidgets();
Bangle.drawWidgets();