From 2e6489240d828feccd53b72acc2547d71010e544 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Sun, 19 Feb 2023 18:49:39 +0100 Subject: [PATCH] update UI pretty lazily, fix color of bpm --- apps/run/karvonnen.js | 57 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/apps/run/karvonnen.js b/apps/run/karvonnen.js index 22b5e06d6b..5675d54675 100644 --- a/apps/run/karvonnen.js +++ b/apps/run/karvonnen.js @@ -43,6 +43,7 @@ exports.show = function karvonnen(hrmSettings, exsHrmStats) { // HR data: large, readable, in the middle of the screen function drawHR() { g.clearRect(62,66,62+80,70+40); + g.setColor(1,1,1); g.setFont("Vector",50); g.drawString(hr, 62,66); } @@ -84,19 +85,19 @@ exports.show = function karvonnen(hrmSettings, exsHrmStats) { } drawBackGround(); - function getzone1() {g.setColor("#00ffff");{(simplify (-88.5, -20, "Z1"));}zoning(minzone2, minhr);} - function getzone2a() {g.setColor("#00ff00");{(simplify (-43.5, -21.5, "Z2"));}zoning(maxzone2, minzone2);} - function getzone2b() {g.setColor("#00ff00");{(simplify (-20, 1.5, "Z2"));}zoning(maxzone2, minzone2);} - function getzone2c() {g.setColor("#00ff00");{(simplify (3, 24, "Z2"));}zoning(maxzone2, minzone2);} - function getzone3a() {g.setColor("#ffff00");{(simplify (25.5, 46.5, "Z3"));}zoning(maxzone3, maxzone2);} - function getzone3b() {g.setColor("#ffff00");{(simplify (48, 69, "Z3"));}zoning(maxzone3, maxzone2);} - function getzone3c() {g.setColor("#ffff00");{(simplify (70.5, 91.5, "Z3"));}zoning(maxzone3, maxzone2);} - function getzone4a() {g.setColor("#ff8000");{(simplify (91, 114.5, "Z4"));}zoning(maxzone4, maxzone3);} - function getzone4b() {g.setColor("#ff8000");{(simplify (116, 137.5, "Z4"));}zoning(maxzone4, maxzone3);} - function getzone4c() {g.setColor("#ff8000");{(simplify (139, 160, "Z4"));}zoning(maxzone4, maxzone3);} - function getzone5a() {g.setColor("#ff0000");{(simplify (161.5, 182.5, "Z5"));}zoning(maxzone5, maxzone4);} - function getzone5b() {g.setColor("#ff0000");{(simplify (184, 205, "Z5"));}zoning(maxzone5, maxzone4);} - function getzone5c() {g.setColor("#ff0000");{(simplify (206.5, 227.5, "Z5"));}zoning(maxzone5, maxzone4);} + function getzone1() {drawBackGround();g.setColor("#00ffff");{(simplify (-88.5, -20, "Z1"));}zoning(minzone2, minhr);} + function getzone2a() {drawBackGround();g.setColor("#00ff00");{(simplify (-43.5, -21.5, "Z2"));}zoning(maxzone2, minzone2);} + function getzone2b() {drawBackGround();g.setColor("#00ff00");{(simplify (-20, 1.5, "Z2"));}zoning(maxzone2, minzone2);} + function getzone2c() {drawBackGround();g.setColor("#00ff00");{(simplify (3, 24, "Z2"));}zoning(maxzone2, minzone2);} + function getzone3a() {drawBackGround();g.setColor("#ffff00");{(simplify (25.5, 46.5, "Z3"));}zoning(maxzone3, maxzone2);} + function getzone3b() {drawBackGround();g.setColor("#ffff00");{(simplify (48, 69, "Z3"));}zoning(maxzone3, maxzone2);} + function getzone3c() {drawBackGround();g.setColor("#ffff00");{(simplify (70.5, 91.5, "Z3"));}zoning(maxzone3, maxzone2);} + function getzone4a() {drawBackGround();g.setColor("#ff8000");{(simplify (91, 114.5, "Z4"));}zoning(maxzone4, maxzone3);} + function getzone4b() {drawBackGround();g.setColor("#ff8000");{(simplify (116, 137.5, "Z4"));}zoning(maxzone4, maxzone3);} + function getzone4c() {drawBackGround();g.setColor("#ff8000");{(simplify (139, 160, "Z4"));}zoning(maxzone4, maxzone3);} + function getzone5a() {drawBackGround();g.setColor("#ff0000");{(simplify (161.5, 182.5, "Z5"));}zoning(maxzone5, maxzone4);} + function getzone5b() {drawBackGround();g.setColor("#ff0000");{(simplify (184, 205, "Z5"));}zoning(maxzone5, maxzone4);} + function getzone5c() {drawBackGround();g.setColor("#ff0000");{(simplify (206.5, 227.5, "Z5"));}zoning(maxzone5, maxzone4);} function getzonealert() { const HRzonemax = require("graphics_utils"); @@ -110,21 +111,22 @@ exports.show = function karvonnen(hrmSettings, exsHrmStats) { } //Subdivided zones for better readability of zones when calling the images. //Changing HR zones will trigger the function with the image and previous&next HR zones. + let subZoneLast; function drawZones() { - if (hr <= hrr*0.6 + minhr) getzone1(); - else if (hr <= hrr*0.64 + minhr) getzone2a(); - else if (hr <= hrr*0.67 + minhr) getzone2b(); - else if (hr <= hrr * 0.7 + minhr) getzone2c(); - else if (hr <= hrr * 0.74 + minhr) getzone3a(); - else if (hr <= hrr * 0.77 + minhr) getzone3b(); - else if (hr <= hrr * 0.8 + minhr) getzone3c(); - else if (hr <= hrr * 0.84 + minhr) getzone4a(); - else if (hr <= hrr * 0.87 + minhr) getzone4b(); - else if (hr <= hrr * 0.9 + minhr) getzone4c(); - else if (hr <= hrr * 0.94 + minhr) getzone5a(); - else if (hr <= hrr * 0.96 + minhr) getzone5b(); - else if (hr <= hrr * 0.98 + minhr) getzone5c(); - else if (hr >= maxhr - 2) {g.clear();getzonealert();} + if (hr <= hrr * 0.6 + minhr) {if (subZoneLast!=0) {subZoneLast=0; getzone1();}} + else if (hr <= hrr * 0.64 + minhr) {if (subZoneLast!=1) {subZoneLast=1; getzone2a();}} + else if (hr <= hrr * 0.67 + minhr) {if (subZoneLast!=2) {subZoneLast=2; getzone2b();}} + else if (hr <= hrr * 0.7 + minhr) {if (subZoneLast!=3) {subZoneLast=3; getzone2c();}} + else if (hr <= hrr * 0.74 + minhr) {if (subZoneLast!=4) {subZoneLast=4; getzone3a();}} + else if (hr <= hrr * 0.77 + minhr) {if (subZoneLast!=5) {subZoneLast=5; getzone3b();}} + else if (hr <= hrr * 0.8 + minhr) {if (subZoneLast!=6) {subZoneLast=6; getzone3c();}} + else if (hr <= hrr * 0.84 + minhr) {if (subZoneLast!=7) {subZoneLast=7; getzone4a();}} + else if (hr <= hrr * 0.87 + minhr) {if (subZoneLast!=8) {subZoneLast=8; getzone4b();}} + else if (hr <= hrr * 0.9 + minhr) {if (subZoneLast!=9) {subZoneLast=9; getzone4c();}} + else if (hr <= hrr * 0.94 + minhr) {if (subZoneLast!=10) {subZoneLast=10; getzone5a();}} + else if (hr <= hrr * 0.96 + minhr) {if (subZoneLast!=11) {subZoneLast=11; getzone5b();}} + else if (hr <= hrr * 0.98 + minhr) {if (subZoneLast!=12) {subZoneLast=12; getzone5c();}} + else if (hr >= maxhr - 2) {if (subZoneLast!=13) {subZoneLast=13; g.clear();getzonealert();}} } drawZones(); @@ -134,7 +136,6 @@ exports.show = function karvonnen(hrmSettings, exsHrmStats) { hr = exsHrmStats.getValue(); if (hr!=hrLast) { drawHR(); - drawBackGround(); drawZones(); } }