Update app.js

master
Andy Smy 2025-05-13 08:12:59 +01:00 committed by GitHub
parent afd9c3e96c
commit c536e57341
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 18 deletions

View File

@ -179,8 +179,7 @@ function countDown(dir) {
timeSig.getTime() - lastTimeTime); timeSig.getTime() - lastTimeTime);
addLog(timeSig, over, counter, addLog(timeSig, over, counter,
"Play", /*LANG*/"Lost:" + formatDuration(timeDuration)); "Play", /*LANG*/"Lost:" + formatDuration(timeDuration));
} } else {
if(counter>0) // reset elapsed time if(counter>0) // reset elapsed time
ballTimes.push(timeSig.getTime()); ballTimes.push(timeSig.getTime());
Bangle.setLCDPower(1); //TODO need any more? Bangle.setLCDPower(1); //TODO need any more?
@ -192,6 +191,7 @@ function countDown(dir) {
addLog(timeSig, over, counter, addLog(timeSig, over, counter,
/*LANG*/"Correction", formatDuration(deadDuration)); /*LANG*/"Correction", formatDuration(deadDuration));
} }
}
// give haptic feedback // give haptic feedback
if(counter == BALLS_PER_OVER - 2) { if(counter == BALLS_PER_OVER - 2) {
// buzz twice "2 to come" // buzz twice "2 to come"
@ -231,36 +231,36 @@ function countDown(dir) {
} }
} }
// refresh in-play screen // refresh in-play screen
g.clear(1); //g.clear(1);
// draw wickets fallen (top-right) // draw wickets fallen (top-right)
g.setFontAlign(1,0); g.setFontAlign(1,0);
g.setFont("Vector",26). g.setFont("Vector",26).
drawString(wickets, 162, 14); drawString(wickets, 162, 14, true);
g.setFont("Vector",12). g.setFont("Vector",12).
drawString('\¦\¦\¦', 173, 15); drawString('\¦\¦\¦', 173, 15, true);
// draw battery and heart rate (top-left) // draw battery and heart rate (top-left)
g.setFontAlign(-1,0); g.setFontAlign(-1,0);
var heartRateString = 'HR:' + heartRate; var heartRateString = 'HR:' + heartRate;
if(heartRateEventSeconds <= 0) heartRateString = ''; if(heartRateEventSeconds <= 0) heartRateString = '';
g.setFont("Vector",16). g.setFont("Vector",16).
drawString(battery + '% ' + heartRateString, 5, 11); drawString(battery + '% ' + heartRateString, 5, 11, true);
// draw clock (upper-centre) // draw clock (upper-centre)
g.setFontAlign(0,0); g.setFontAlign(0,0);
g.setFont("Vector",48). g.setFont("Vector",48).
drawString(formatTimeOfDay(timeSig), 93, 55); drawString(formatTimeOfDay(timeSig), 93, 55, true);
// draw over.ball (centre) // draw over.ball (centre)
var ballString = (over-1) + "." + counter; var ballString = (over-1) + "." + counter;
if(over > OVERS_PER_INNINGS) if(over > OVERS_PER_INNINGS)
ballString = 'END'; ballString = 'END';
g.setFont("Vector",80). g.setFont("Vector",80).
drawString(ballString, 93, 120); drawString(ballString, 93, 120, true);
// draw ball graph and elapsed time // draw ball graph and elapsed time
var ballGraph = var ballGraph =
BALL_FACED_CHAR.repeat(counter) BALL_FACED_CHAR.repeat(counter)
+ BALL_TO_COME_CHAR.repeat(BALLS_PER_OVER - counter); + BALL_TO_COME_CHAR.repeat(BALLS_PER_OVER - counter);
if(timeCalled) ballGraph = '-TIME-'; if(timeCalled) ballGraph = '-TIME-';
g.setFont("Vector",18).drawString( g.setFont("Vector",18).drawString(
ballGraph + ' ' + formatDuration(deadDuration), 93, 166); ballGraph + ' ' + formatDuration(deadDuration), 93, 166, true);
// return to wait for next input // return to wait for next input
processing = false; processing = false;
} }