@@ -14,7 +14,7 @@ function onHRM(h) {
1414 // the first time we're called remove
1515 // the countdown
1616 counter = undefined ;
17- g . clearRect ( 0 , 24 , g . getWidth ( ) , g . getHeight ( ) ) ;
17+ g . reset ( ) . clearRect ( 0 , 24 , g . getWidth ( ) , g . getHeight ( ) ) ;
1818 }
1919 hrmInfo = h ;
2020 /* On 2v09 and earlier firmwares the only solution for realtime
@@ -35,7 +35,7 @@ Bangle.on('HRM', onHRM);
3535
3636function updateHrm ( ) {
3737 var px = g . getWidth ( ) / 2 ;
38- g . setFontAlign ( 0 , - 1 ) ;
38+ g . reset ( ) . setFontAlign ( 0 , - 1 ) ;
3939 g . clearRect ( 0 , 24 , g . getWidth ( ) , 80 ) ;
4040 g . setFont ( "6x8" ) . drawString ( /*LANG*/ "Confidence " + ( hrmInfo . confidence || "--" ) + "%" , px , 70 ) ;
4141
@@ -62,6 +62,7 @@ var scale = 2000;
6262HRM events as they happen */
6363Bangle . on ( 'HRM-raw' , function ( v ) {
6464 hrmOffset ++ ;
65+ g . reset ( ) ;
6566 if ( hrmOffset > g . getWidth ( ) ) {
6667 let thousands = Math . round ( rawMax / 1000 ) * 1000 ;
6768 if ( thousands > scale ) scale = thousands ;
@@ -91,11 +92,11 @@ Bangle.on('HRM-raw', function(v) {
9192var counter = 5 ;
9293function countDown ( ) {
9394 if ( counter ) {
94- g . drawString ( counter -- , g . getWidth ( ) / 2 , g . getHeight ( ) / 2 , true ) ;
95+ g . reset ( ) . drawString ( counter -- , g . getWidth ( ) / 2 , g . getHeight ( ) / 2 , true ) ;
9596 setTimeout ( countDown , 1000 ) ;
9697 }
9798}
98- g . clear ( ) ;
99+ g . clear ( 1 ) ;
99100Bangle . loadWidgets ( ) ;
100101Bangle . drawWidgets ( ) ;
101102g . setColor ( g . theme . fg ) ;
@@ -111,7 +112,7 @@ var hrmInfo;
111112
112113function readHRM ( ) {
113114 if ( ! hrmInfo ) return ;
114-
115+ g . reset ( ) ;
115116 if ( hrmOffset == 0 ) {
116117 g . clearRect ( 0 , 100 , g . getWidth ( ) , g . getHeight ( ) ) ;
117118 lastHrmPt = [ - 100 , 0 ] ;
0 commit comments