Improved buzz timing and rendering

pull/218/head
msdeibel 2020-04-04 08:50:55 +02:00
parent a55efc5740
commit 8fa7fd0e43
2 changed files with 326 additions and 329 deletions

View File

@ -1,3 +1,4 @@
0.05: Improved buzz timing and rendering
0.04: Only buzz on high confidence (>85%)
0.03: Optimized rendering for the background
0.02: Adapted to new App code layout

View File

@ -5,13 +5,13 @@ const Setter = {
LOWER: 'lower'
};
const shortBuzzTimeInMs = 50;
const longBuzzTimeInMs = 200;
const shortBuzzTimeInMs = 80;
const longBuzzTimeInMs = 400;
let upperLimit = 90;
let upperLimit = 130;
let upperLimitChanged = true;
let lowerLimit = 50;
let lowerLimit = 100;
let lowerLimitChanged = true;
let limitSetter = Setter.NONE;
@ -76,8 +76,6 @@ function renderLowerLimitBackground() {
function drawTrainingHeartRate() {
//Only redraw if the display is on
if (Bangle.isLCDOn()) {
renderUpperLimit();
renderCurrentHeartRate();
@ -111,7 +109,7 @@ function renderCurrentHeartRate() {
if(!hrChanged) { return; }
g.setColor(255,255,255);
g.fillRect(45, 110, 165, 150);
g.fillRect(55, 110, 165, 150);
g.setColor(0,0,0);
g.setFontVector(24);
@ -186,14 +184,12 @@ function buzz()
if(currentHeartRate > upperLimit)
{
Bangle.buzz(shortBuzzTimeInMs);
setTimeout(() => { Bangle.buzz(shortBuzzTimeInMs); }, shortBuzzTimeInMs+10);
setTimeout(() => { Bangle.buzz(shortBuzzTimeInMs); }, shortBuzzTimeInMs+10);
setTimeout(() => { Bangle.buzz(shortBuzzTimeInMs); }, shortBuzzTimeInMs * 2);
}
if(currentHeartRate < lowerLimit)
{
Bangle.buzz(longBuzzTimeInMs);
setTimeout(() => { Bangle.buzz(longBuzzTimeInMs); }, longBuzzTimeInMs+10);
}
}