diff --git a/apps/pokertimer/ChangeLog b/apps/pokertimer/ChangeLog index 642dbcc7e..ff87a1708 100644 --- a/apps/pokertimer/ChangeLog +++ b/apps/pokertimer/ChangeLog @@ -1 +1,6 @@ -0.0.1: Packaged app +0.06: Fix bug when play/pause during alert +0.05: Added screenshots +0.04: Added 20-second warning buzz +0.03: Start app with paused timer +0.02: Fix alert buzz time, Indicate when paused +0.01: Packaged app diff --git a/apps/pokertimer/README.md b/apps/pokertimer/README.md index 09aa2d6a1..ce8316def 100644 --- a/apps/pokertimer/README.md +++ b/apps/pokertimer/README.md @@ -1,7 +1,12 @@ # Poker Timer +*v.0.06* A blinds timer for poker. Don't know what that means? See [Wikipedia: Blind (poker)](https://en.wikipedia.org/wiki/Blind_(poker)) and [Wikipedia: Texas hold 'em](https://en.wikipedia.org/wiki/Texas_hold_%27em). +![Screenshot showing countdown paused on start](screenshots/01_paused-start.png) +![Screenshot showing active countdown](screenshots/02_counting-down.png) +![Screenshot showing blinds up alert](screenshots/03_blinds-up.png) + The blinds are hardcoded and go up every ten minutes: - 1, 2 @@ -14,14 +19,32 @@ The blinds are hardcoded and go up every ten minutes: ... and so on, doubling each round. +## Features + +- Starts paused +- Button to pause/resume +- 20-second warning buzz +- Auto-exit after round 25 + ## Usage -The timer will start as soon as you open the app. Time left in the round is on the top of the screen, currnt small and big blinds are shown below. After ten minutes, it will vibrate and flash and show the new blind. Then it starts over. +The timer will start as soon as you open the app. Time left in the round is on the top of the screen, currnt small and big blinds are shown below. After ten minutes, it will vibrate and flash and show the new blind. Then it starts over. + +### Auto-exit + +The program will automatically exit after the 25 round. This is not a bug. If the blinds double again, it will perform some kind of overflow and convert the blind values to floats. + +The blinds in round 25 are `20971520 / 41943040`. You probably aren't still playing poker at that point and just forgot to exit the program. ## Controls - **Pause/Resume:** Press the button - - **Exit:** hold down the button. + - **Exit:** hold down the button + +## Roadmap + +- Set settings +- Better graphics ## Requests diff --git a/apps/pokertimer/ROADMAP.md b/apps/pokertimer/ROADMAP.md deleted file mode 100644 index b182c5b38..000000000 --- a/apps/pokertimer/ROADMAP.md +++ /dev/null @@ -1,17 +0,0 @@ -# Roadmap - -## Bugs - -- Unlock before vibrate/flash - -## Improvements - -- Screenshots in README -- Start app paused -- Indicate when paused -- 20-second warning - -## Long-term projects - -- Set settings -- Better graphics diff --git a/apps/pokertimer/app.img b/apps/pokertimer/app.img deleted file mode 100644 index e2e05ea17..000000000 Binary files a/apps/pokertimer/app.img and /dev/null differ diff --git a/apps/pokertimer/app.js b/apps/pokertimer/app.js index 26b72c481..9d584b3b2 100644 --- a/apps/pokertimer/app.js +++ b/apps/pokertimer/app.js @@ -1,5 +1,5 @@ -const BLIND_INTERVAL = 600; // 10 minutes -const BLINDSUP_ALERT_DURATION = 5000; // 30 seconds +const BLIND_INTERVAL = 600; // 10 minutes in seconds +const BLINDSUP_ALERT_DURATION = 10000; // 10 seconds in ms // Convert seconds to mm:ss const secondsToMinutes = (s) => { @@ -32,7 +32,13 @@ const stopTimer = () => { timer_running = false; }; const pauseResume = () => { - if (timer_running) stopTimer(); + if (is_alerting) return; + if (timer_running) { + stopTimer(); + g.setFont('Vector',15); + g.drawString('(PAUSED)', + g.getWidth()/2, g.getHeight()*7/8); + } else startTimer(); }; @@ -48,6 +54,7 @@ const getBlinds = (i) => { // Sound the alarm const blindsUp = () => { + is_alerting = true; // Display message const showMessage = () => { g.clear(); @@ -66,7 +73,7 @@ const blindsUp = () => { console.log(`Blinds for round ${b} are ${blinds[0]} / ${blinds[1]}`); // Buzz and light up every second const buzzInterval = setInterval(() => { - Bangle.buzz(); + Bangle.buzz(500); Bangle.setLCDPower(1); }, 1000); // Invert colors every second @@ -82,6 +89,7 @@ const blindsUp = () => { }, 500); // Restart timer setTimeout(() => { + is_alerting = false; fmtDark(); tick(); clearInterval(buzzInterval); clearInterval(flashInterval); @@ -94,6 +102,13 @@ const blindsUp = () => { const tick = () => { if (!timer_running) return; time_left--; + // 20-second warning buzz + if (time_left==20) { + const buzzInterval = setInterval(Bangle.buzz, 500); + setTimeout(() => { + clearInterval(buzzInterval); + }, 5000); + } if (time_left<=0) blindsUp(); else { g.clear(); @@ -120,5 +135,8 @@ let time_left = BLIND_INTERVAL + 1; let b = 0; let blinds = getBlinds(b); let timer_running = true; +let is_alerting = false; let timer = setInterval(tick, 1000); tick(); +// Start paused +pauseResume(); diff --git a/apps/pokertimer/metadata.json b/apps/pokertimer/metadata.json index abdc6e81f..a22229e4f 100644 --- a/apps/pokertimer/metadata.json +++ b/apps/pokertimer/metadata.json @@ -4,12 +4,12 @@ "shortName":"Poker Timer", "readme":"README.md", "icon": "app.png", - "version":"0.0.1", + "version":"0.06", "description": "A blinds timer for use with Texas Hold 'Em", "tags": "poker", "supports": ["BANGLEJS2"], "storage": [ - {"name":"timer.app.js","url":"app.js"}, - {"name":"timer.img","url":"app-icon.js","evaluate":true} + {"name":"pokertimer.app.js","url":"app.js"}, + {"name":"pokertimer.img","url":"app-icon.js","evaluate":true} ] } diff --git a/apps/pokertimer/screenshots/01_paused-start.png b/apps/pokertimer/screenshots/01_paused-start.png new file mode 100644 index 000000000..929bd473e Binary files /dev/null and b/apps/pokertimer/screenshots/01_paused-start.png differ diff --git a/apps/pokertimer/screenshots/02_counting-down.png b/apps/pokertimer/screenshots/02_counting-down.png new file mode 100644 index 000000000..38425a68b Binary files /dev/null and b/apps/pokertimer/screenshots/02_counting-down.png differ diff --git a/apps/pokertimer/screenshots/03_blinds-up.png b/apps/pokertimer/screenshots/03_blinds-up.png new file mode 100644 index 000000000..b01749719 Binary files /dev/null and b/apps/pokertimer/screenshots/03_blinds-up.png differ