diff --git a/apps.json b/apps.json index e0f5142af..3bdc55f07 100644 --- a/apps.json +++ b/apps.json @@ -892,7 +892,7 @@ { "id": "marioclock", "name": "Mario Clock", "icon": "marioclock.png", - "version":"0.04", + "version":"0.05", "description": "Animated Mario clock, jumps to change the time!", "tags": "clock,mario,retro", "type": "clock", diff --git a/apps/marioclock/ChangeLog b/apps/marioclock/ChangeLog index 4334ad92c..74db9bc18 100644 --- a/apps/marioclock/ChangeLog +++ b/apps/marioclock/ChangeLog @@ -2,3 +2,4 @@ 0.02: Fix day of the week and add padding 0.03: use short date format from locale, take timeout from settings 0.04: modify date to display to be more at the original idea but still localized +0.05: use 12/24 hour clock from settings diff --git a/apps/marioclock/marioclock-app.js b/apps/marioclock/marioclock-app.js index ecbaba38a..2eeb21c97 100644 --- a/apps/marioclock/marioclock-app.js +++ b/apps/marioclock/marioclock-app.js @@ -1,14 +1,15 @@ /********************************** - BangleJS MARIO CLOCK V0.1.0 + BangleJS MARIO CLOCK + Based on Espruino Mario Clock V3 https://github.com/paulcockrell/espruino-mario-clock + Converting images to 1bit BMP: Image > Mode > Indexed and tick the "Use black and white (1-bit) palette", Then export as BMP. + Online Image convertor: https://www.espruino.com/Image+Converter **********************************/ -var locale = require("locale"); +const locale = require("locale"); const storage = require('Storage'); -const settings = (storage.readJSON('setting.json',1)||{}); -const timeout = settings.timeout||10; +const settings = (storage.readJSON('setting.json', 1) || {}); +const timeout = settings.timeout || 10; +const is12Hour = settings["12hour"] || false; // Screen dimensions let W, H; @@ -273,7 +274,8 @@ function drawTime() { drawBrick(42, 25); const t = new Date(); - const hours = ("0" + t.getHours()).substr(-2); + const h = t.getHours(); + const hours = ("0" + ((is12Hour && h > 12) ? h - 12 : h)).substr(-2); const mins = ("0" + t.getMinutes()).substr(-2); g.setFont("6x8"); @@ -374,8 +376,9 @@ function init() { Bangle.setLCDPower(true); } }); + + startTimers(); } // Initialise! init(); -startTimers();