Improved buzz timing and rendering
parent
a55efc5740
commit
8fa7fd0e43
|
|
@ -1,3 +1,4 @@
|
||||||
|
0.05: Improved buzz timing and rendering
|
||||||
0.04: Only buzz on high confidence (>85%)
|
0.04: Only buzz on high confidence (>85%)
|
||||||
0.03: Optimized rendering for the background
|
0.03: Optimized rendering for the background
|
||||||
0.02: Adapted to new App code layout
|
0.02: Adapted to new App code layout
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ const Setter = {
|
||||||
LOWER: 'lower'
|
LOWER: 'lower'
|
||||||
};
|
};
|
||||||
|
|
||||||
const shortBuzzTimeInMs = 50;
|
const shortBuzzTimeInMs = 80;
|
||||||
const longBuzzTimeInMs = 200;
|
const longBuzzTimeInMs = 400;
|
||||||
|
|
||||||
let upperLimit = 90;
|
let upperLimit = 130;
|
||||||
let upperLimitChanged = true;
|
let upperLimitChanged = true;
|
||||||
|
|
||||||
let lowerLimit = 50;
|
let lowerLimit = 100;
|
||||||
let lowerLimitChanged = true;
|
let lowerLimitChanged = true;
|
||||||
|
|
||||||
let limitSetter = Setter.NONE;
|
let limitSetter = Setter.NONE;
|
||||||
|
|
@ -76,8 +76,6 @@ function renderLowerLimitBackground() {
|
||||||
function drawTrainingHeartRate() {
|
function drawTrainingHeartRate() {
|
||||||
//Only redraw if the display is on
|
//Only redraw if the display is on
|
||||||
if (Bangle.isLCDOn()) {
|
if (Bangle.isLCDOn()) {
|
||||||
|
|
||||||
|
|
||||||
renderUpperLimit();
|
renderUpperLimit();
|
||||||
|
|
||||||
renderCurrentHeartRate();
|
renderCurrentHeartRate();
|
||||||
|
|
@ -111,7 +109,7 @@ function renderCurrentHeartRate() {
|
||||||
if(!hrChanged) { return; }
|
if(!hrChanged) { return; }
|
||||||
|
|
||||||
g.setColor(255,255,255);
|
g.setColor(255,255,255);
|
||||||
g.fillRect(45, 110, 165, 150);
|
g.fillRect(55, 110, 165, 150);
|
||||||
|
|
||||||
g.setColor(0,0,0);
|
g.setColor(0,0,0);
|
||||||
g.setFontVector(24);
|
g.setFontVector(24);
|
||||||
|
|
@ -186,14 +184,12 @@ function buzz()
|
||||||
if(currentHeartRate > upperLimit)
|
if(currentHeartRate > upperLimit)
|
||||||
{
|
{
|
||||||
Bangle.buzz(shortBuzzTimeInMs);
|
Bangle.buzz(shortBuzzTimeInMs);
|
||||||
setTimeout(() => { Bangle.buzz(shortBuzzTimeInMs); }, shortBuzzTimeInMs+10);
|
setTimeout(() => { Bangle.buzz(shortBuzzTimeInMs); }, shortBuzzTimeInMs * 2);
|
||||||
setTimeout(() => { Bangle.buzz(shortBuzzTimeInMs); }, shortBuzzTimeInMs+10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentHeartRate < lowerLimit)
|
if(currentHeartRate < lowerLimit)
|
||||||
{
|
{
|
||||||
Bangle.buzz(longBuzzTimeInMs);
|
Bangle.buzz(longBuzzTimeInMs);
|
||||||
setTimeout(() => { Bangle.buzz(longBuzzTimeInMs); }, longBuzzTimeInMs+10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue