From b39e13f9f7898a46d245cf51cc6b879fa2c588c5 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Fri, 7 Jun 2024 12:58:15 -0700 Subject: [PATCH 01/10] inititial commit --- apps/burn/ChangeLog | 1 + apps/burn/bangle1-burn-screenshot.png | Bin 0 -> 13968 bytes apps/burn/burn-icon.js | 5 + apps/burn/burn.js | 254 ++++++++++++++++++++++++++ apps/burn/burn_icon.png | Bin 0 -> 1744 bytes apps/burn/metadata.json | 15 ++ 6 files changed, 275 insertions(+) create mode 100644 apps/burn/ChangeLog create mode 100644 apps/burn/bangle1-burn-screenshot.png create mode 100644 apps/burn/burn-icon.js create mode 100644 apps/burn/burn.js create mode 100644 apps/burn/burn_icon.png create mode 100644 apps/burn/metadata.json diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/burn/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/burn/bangle1-burn-screenshot.png b/apps/burn/bangle1-burn-screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..fef0e701eb4ecf2987f773cce2e4585582c94818 GIT binary patch literal 13968 zcmeIYbyQqW6DABH!686!f`^0z8C(Vi2=0*Jo&g5;8Qk521qcqoJ-9=#;2zu(oWb2; zC;7eleS6OCyJz>m_nvcS`gT=6UG;Qz-R|iLRaTV3!6e5-LPElkkrscC_&)r7qd!7? zR`7atBOyI~=ccL&dk=P|v2(CBF}H%yz+CMhG!Pea6C@;;xxFOI*cY#H10JAZpho~? zATB!FJjL$Og^IEInURTGqw|#2y*$KOQr-A5a_qpOMBqt=_wpgY%VHA0=ya^QrdMgQ z$n_Z9H9g|Cq*5|+a{^s9IJ)88?A#`WTOLxD?x{nG#8r;v)XCT47nS=qobRi+$8>WmG_~|iLnM%%=c{xeHEYskR5ns zZ4KtWG{N*UC-ya4S*!ojQq*C!S4|FqK|4l;$Bje=^}Cz93}J1XOShJo{N-nDWS1wG zl<7jkEk}f2C*8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D;}mm8}3X-W=0R!Bf9ko0RwkO zwXtnF+OA8C)hJ5P)Ks*F{+*|lm6foOFm0EV_q+!J8}T=TuC6Xx46%Sh)L4sk25n(sm@WF$`1rH|j4UkNNpIo-@rj8~&@OaaVcq>2>WZJ)^k>OP2~|Dv z>g(&pJ)@f!ZW#aoN1;%JSqX08@4F`Q!vpa8@5bn3F_nlJsU1otwgd3;l`@>Da<*Xa zR8->dRuD-=DvJ8u)YD { + const date = new Date(); + // Month is 0-indexed, so we add 1 to get the correct month number + return `${date.getMonth() + 1}-${date.getDate()}-${date.getFullYear()}`; +}; + +// Counter object to keep track of the count and the date +let counter = { count: 0, date: dayString() }; + +// Function to read the counter from the file +function readCounterFromFile() { + try { + // Open the file in read mode + file = Storage.open(PATH, "r"); + let line = file.readLine(); + + // If the file has content, parse it and update the counter + if (line) { + let splitLine = line.trim().split(","); + counter = { count: parseInt(splitLine[0]), date: splitLine[1] }; + } + } catch (err) { + // If the file does not exist, the counter will remain 0 + } +} + +// Function to write the counter to the file +function writeCounterToFile() { + // Open the file in write mode + file = Storage.open(PATH, "w"); + // Write the counter and date to the file + file.write(counter.count.toString() + "," + counter.date + "\n"); +} + +// Function to reset the counter +function resetCounter() { + // Reset the counter to 0 and update the date + counter = { count: 0, date: dayString() }; +} + +// Function to update the counter value +function updateCounterValue(value) { + // Update the counter with the new value, ensuring it's not less than 0 + counter = { count: Math.max(0, value), date: dayString() }; +} + +// Function to update the counter +function updateCounter(value) { + // If the date has changed, reset the counter + if (counter.date != dayString()) { + resetCounter(); + } else { + // Otherwise, update the counter value + updateCounterValue(value); + } + + // Write the updated counter to the file + writeCounterToFile(); + // Update the screen with the new counter value + updateScreen(); +} + +// Function to set a watch on a button to update the counter when pressed +function counterButtonWatch(button, increment) { + setWatch( + () => { + // If the button is for incrementing, or the counter is greater than 0, update the counter + if (increment || counter.count > 0) { + updateCounter( + counter.count + (increment ? getInterval() : -getInterval()) + ); + // Update the screen with the new counter value + updateScreen(); + } + }, + button, + { repeat: true } + ); +} + +// Function to create interval functions +const createIntervalFunctions = function () { + // Array of intervals + const intervals = [50, 100, 200, 10]; + // Current location in the intervals array + let location = 0; + + // Function to get the current interval + const getInterval = function () { + return intervals[location]; + }; + + // Function to rotate the increment + const rotateIncrement = function () { + // Update the location to the next index in the intervals array, wrapping around if necessary + location = (location + 1) % intervals.length; + // Update the screen with the new increment + updateScreen(); + }; + + // Return the getInterval and rotateIncrement functions + return { getInterval, rotateIncrement }; +}; + +// Create the interval functions +const intervalFunctions = createIntervalFunctions(); +const getInterval = intervalFunctions.getInterval; +const rotateIncrement = intervalFunctions.rotateIncrement; + +// Check if the hardware version is Bangle.js 2 +const BANGLEJS2 = process.env.HWVERSION == 2; + +// Variables for drag handling and screen coordinates +let drag, y, x; + +// If the hardware version is Bangle.js 2, set the coordinates accordingly +if (BANGLEJS2) { + drag = undefined; + y = 45; + x = 5; +} else { + // If the hardware version is Bangle.js 1, set the coordinates accordingly + y = 100; + x = 25; +} + +// Function to update the screen +function updateScreen() { + // Clear the screen area for the counter + g.clearRect(0, 50, 250, BANGLEJS2 ? 130 : 150) + .setBgColor(g.theme.bg) + .setColor(g.theme.fg) + .setFont("Vector", 40) + .setFontAlign(0, 0) + // Draw the counter value + .drawString(Math.floor(counter.count), g.getWidth() / 2, 100) + .setFont("6x8") + // Clear the screen area for the increment + .clearRect(g.getWidth() / 2 - 50, 140, g.getWidth() / 2 + 50, 160) + // Draw the increment value + .drawString("Increment: " + getInterval(), g.getWidth() / 2, 150); + + // If the hardware version is Bangle.js 1, draw the increment and decrement buttons + if (!BANGLEJS2) { + g.drawString("-", 45, 100).drawString("+", 185, 100); + } +} + +// If the hardware version is Bangle.js 2, set up the drag handling and button watch +if (BANGLEJS2) { + // Set up drag handling + Bangle.on("drag", (e) => { + // If this is the start of a drag, record the initial coordinates + if (!drag) { + drag = { x: e.x, y: e.y }; + return; + } + + // If the button is still being pressed, ignore this event + if (e.b) return; + + // Calculate the change in x and y from the start of the drag + const dx = e.x - drag.x; + const dy = e.y - drag.y; + // Reset the drag start coordinates + drag = null; + + // Determine if the drag is primarily horizontal or vertical + const isHorizontalDrag = Math.abs(dx) > Math.abs(dy) + 10; + const isVerticalDrag = Math.abs(dy) > Math.abs(dx) + 10; + + // If the drag is primarily horizontal, ignore it + if (isHorizontalDrag) { + return; + } + + // If the drag is primarily vertical, update the counter + if (isVerticalDrag) { + // If the drag is downwards and the counter is greater than 0, decrease the counter + if (dy > 0 && counter.count > 0) { + updateCounter(counter.count - getInterval()); + } else if (dy < 0) { + // If the drag is upwards, increase the counter + updateCounter(counter.count + getInterval()); + } + // Update the screen with the new counter value + updateScreen(); + } + }); + + // Set a watch on the button to rotate the increment when pressed + setWatch(rotateIncrement, BTN1, { repeat: true }); +} else { + // If the hardware version is Bangle.js 1, set up the button watches + + // Set watch on button to increase the counter + counterButtonWatch(BTN1, true); + counterButtonWatch(BTN5, true); // screen tap + // Set watch on button to decrease the counter + counterButtonWatch(BTN3, false); + counterButtonWatch(BTN4, false); // screen tap + + // Set a watch on button to rotate the increment when pressed + setWatch( + () => { + rotateIncrement(); + }, + BTN2, + { repeat: true } + ); +} + +// clear the screen +g.clear(); + +// Set the background and foreground colors +g.setBgColor(g.theme.bg).setColor(g.theme.fg); + +// Load and draw the widgets +Bangle.loadWidgets(); +Bangle.drawWidgets(); + +// Read the counter from the file +readCounterFromFile(); +// Update the screen with the counter value +updateScreen(); diff --git a/apps/burn/burn_icon.png b/apps/burn/burn_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..23d4a13e6fae6dcbd0c04597f36731274a8b197e GIT binary patch literal 1744 zcmbW0e@q)?7{}kcw(BS(&=r=kjd2{_)$x*rvx@+a0$eOU%kC9 z$Ycz4fXPPUh*K8+Sez{ACYBnM5t5AsHE|&(W^++PCc4EXitz^<#NqQ^+Z3t(p-*!6 zzW03I?{m-dKJVM-s&K^VcIXg7an4fS4Wo%XY8AZS&RU#6i0W;!*<4PWjcILfk(!=w zL@0BxYp}5Nx@Fgm!&Lz`$y#vgRKsY+Hr}2R(Ah^5nqT&&lx6?flM(0aAGokk-MVyS z{Ktj6?~a`uV>Tb}&M(M+^5fFJwS&4n^@aIA%}sTlp2FR(J-MGZ?^Kz;*=HCZedEBD z{u82)={~gOxoT-B$LMUE*mZb$>6hQLulcJ-Ry%xS$pci;;0r^^7t60&_XnDG4lnoF zvYr~7y*GOyqxQ_h!3X_wEyEqzvHQ7(48yOpsr5OxW)B$rS1;)+x4tTrzw=`1_v4=( z8}NIx{40fzVoxS_HJ*E5*6OdbLyWbzCs&twt)$m`J~1}t&gl=A;wO*y)#yIb)h#|_ ziP_O`EB>)|W-9Q3;k!d_lWt-r|K^-2;kKqZY3@F$yTuewB@q_>afM>Zyi8- zFz^E?kt9W;7u)nCtFRH!KqPD^t1w8Fz{p?Oy&w#GVcbnXJ@HUbTLjRFe2F9-33=85 zisyL=%Ugp>>4?GrKq(;NQf8Ey=WVheJiWn>3;=TM(SYJOvsIrY2;>s3HvpU-QG!sF zu-=W3f#Y((wO0_L0ogH#6%B|-BM5(wL_!5Y)xUv_S*e1GbiuVjLD`g0g1~G5D3QxS zC_Sn^=z#|$vK%FV68Quqm^KFbuit79C^T+b07JAG`B5GQAj)cT1Q{d7zEEU1r69mE zEdsEJzC6qXiGu(KmJy{-!VGq)LV!ddXIqA4Mj2t38V9r1U1f&CSBeJ=I7-=sk5VCua z8rnq47cCJ5^ui5*0R;dUf<`7ZyvX5aIW8B5|6?l7WZ=wvF->lo1+o*}N}Wgn9M7u> zsDll~vIc5JNM%zLHU(Iq8`wuHfZ`Cj0}Q;ByUel-$!^ literal 0 HcmV?d00001 diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json new file mode 100644 index 000000000..576d6ef9e --- /dev/null +++ b/apps/burn/metadata.json @@ -0,0 +1,15 @@ +{ + "id": "burn", + "name": "Burn", + "version": "0.01", + "description": "Calorie Counter", + "icon": "burn_icon.png", + "tags": "tool", + "supports": ["BANGLEJS", "BANGLEJS2"], + "screenshots": [{"url":"bangle1-burn-screenshot.png"}], + "allow_emulator": true, + "storage": [ + {"name":"burn.app.js","url":"burn.js"}, + {"name":"burn.img","url":"burn-icon.js","evaluate":true} + ] +} From 18b8217886ff5e7867e0315cc95b63224c96738a Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Fri, 7 Jun 2024 13:24:55 -0700 Subject: [PATCH 02/10] added README --- apps/burn/ChangeLog | 1 + apps/burn/README.md | 29 +++++++++++++++++++++++++++++ apps/burn/metadata.json | 5 +++-- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 apps/burn/README.md diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog index 5560f00bc..e617d1ee3 100644 --- a/apps/burn/ChangeLog +++ b/apps/burn/ChangeLog @@ -1 +1,2 @@ 0.01: New App! +0.02: Added README.md diff --git a/apps/burn/README.md b/apps/burn/README.md new file mode 100644 index 000000000..5a32609ba --- /dev/null +++ b/apps/burn/README.md @@ -0,0 +1,29 @@ +# Burn: Calorie Counter + +Burn is a calorie counter application for Bangle.js (Espruino). It is based on the original Counter app and has been enhanced with additional features. + +## Features + +- **Persistent counter**: The counter value is saved to a file, so it persists even when the app is closed or the device is restarted. +- **Daily reset**: The counter resets each day, allowing you to track your calorie intake on a daily basis. +- **Adjustable increment value**: You can adjust the increment value to suit your needs. + +## Controls + +### Bangle.js 1 + +- **BTN1**: Increase (or tap right) +- **BTN3**: Decrease (or tap left) +- **Press BTN2**: Change increment + +### Bangle.js 2 + +- **Swipe up**: Increase +- **Swipe down**: Decrease +- **Press BTN**: Change increment + +## How it Works + +The counter value and the date are stored in a file named "kcal.txt". The counter value is read from the file when the app starts and written to the file whenever the counter value is updated. + +The app uses the current date to determine whether to reset the counter. If the date has changed since the last time the counter was updated, the counter is reset to 0. diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index 576d6ef9e..7555c3632 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -1,10 +1,11 @@ { "id": "burn", "name": "Burn", - "version": "0.01", - "description": "Calorie Counter", + "version": "0.02", + "description": "Simple Calorie Counter -- saves to flash and resets at midnight", "icon": "burn_icon.png", "tags": "tool", + "readme":"README.md", "supports": ["BANGLEJS", "BANGLEJS2"], "screenshots": [{"url":"bangle1-burn-screenshot.png"}], "allow_emulator": true, From 7cfec8402052fda824c0a6d22c1dbe76267ea30f Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Fri, 7 Jun 2024 13:33:13 -0700 Subject: [PATCH 03/10] icon fix --- apps/burn/.prettierignore | 2 ++ apps/burn/ChangeLog | 1 + apps/burn/burn-icon.js | 6 +----- apps/burn/metadata.json | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 apps/burn/.prettierignore diff --git a/apps/burn/.prettierignore b/apps/burn/.prettierignore new file mode 100644 index 000000000..172082901 --- /dev/null +++ b/apps/burn/.prettierignore @@ -0,0 +1,2 @@ +# Ignore icon: +burn-icon.js \ No newline at end of file diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog index e617d1ee3..bdaba247c 100644 --- a/apps/burn/ChangeLog +++ b/apps/burn/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Added README.md +0.03: Icon update \ No newline at end of file diff --git a/apps/burn/burn-icon.js b/apps/burn/burn-icon.js index 04a5287db..65afdd92f 100644 --- a/apps/burn/burn-icon.js +++ b/apps/burn/burn-icon.js @@ -1,5 +1 @@ -require("heatshrink").decompress( - atob( - "AJhMOJ/4NEf//6VQsf+/57fl/ZRWcv5xGfIgAlJQGEGU6DQguHAgaNJIoFzBKRI4jEwSMCA4FEQAFUDQIBwakXRAiGFxZAFwicDR7vFQuTALMAAkwGFwavd7uMBLNQYtZjuEsSAuFdUeUAB5MFgQACEAhwDNBsEFyZGFw7kEA4MhAgsRArLVSQFcwgMFyYNVQADd4jFLEJRguRYwuEoBAAbBpqFganFKJRKMFzrGFwptVAuhBpnM5rVrNZAuDQguhM3sDBguDQ7ARjQsDNgiFNAwCF0BcCAAS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0wYDIAEDJu3aH+0AC5t2Obt7bqJf///+jiDSLFCMwERNt7dpXwiD/nkDkqZEMkbAZ0Iw9YEQv1EQiDTYQEQrNwIztu3QLN26TID4FkDiEA=")) \ No newline at end of file diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index 7555c3632..80a7c4437 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -1,7 +1,7 @@ { "id": "burn", "name": "Burn", - "version": "0.02", + "version": "0.03", "description": "Simple Calorie Counter -- saves to flash and resets at midnight", "icon": "burn_icon.png", "tags": "tool", From 94a26e6c29107798e5054ffa0fc0fe81a6e32d65 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Fri, 7 Jun 2024 13:35:28 -0700 Subject: [PATCH 04/10] metadata update --- apps/burn/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index 80a7c4437..dfda2f24c 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -2,7 +2,7 @@ "id": "burn", "name": "Burn", "version": "0.03", - "description": "Simple Calorie Counter -- saves to flash and resets at midnight", + "description": "Simple Calorie Counter -- saves to flash (kcal.txt) and resets at midnight", "icon": "burn_icon.png", "tags": "tool", "readme":"README.md", From ebc5f5cf5badd8755011cd935af808963ae62020 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Fri, 7 Jun 2024 13:47:20 -0700 Subject: [PATCH 05/10] icon fix --- apps/burn/ChangeLog | 3 ++- apps/burn/burn-icon.js | 2 +- apps/burn/metadata.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog index bdaba247c..bfa77f389 100644 --- a/apps/burn/ChangeLog +++ b/apps/burn/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Added README.md -0.03: Icon update \ No newline at end of file +0.03: Icon update +0.04: Icon Fix \ No newline at end of file diff --git a/apps/burn/burn-icon.js b/apps/burn/burn-icon.js index 65afdd92f..8cd3b7ca1 100644 --- a/apps/burn/burn-icon.js +++ b/apps/burn/burn-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("AJhMOH/4NEf//6VQsf+/57fl/ZRWcv56TJMkAi6qAgYBBAiZhgiFAAWJJYYESICHRuTLQQJJNpkoQBwZNgIAFwcTJtIKQgmFUgiFJToFJNP/OoERoHbdt2AiHr//+hqFtsJ7SyEABIIEQf/UjWOABILvwiD0qQdwbkTQRGOEARsCEQYBGE8CERpbbRID+wiEAAYkERrXbdv8qZyASHAggLA53bU0DSRGIABoz27brOTJMwESuaEQb0ETIMRQbd20aDiAiXtvtALTJMeESZmIwdhAIPJMmES96/wYaETd4BAYDJMgEUMYEUDWVAwiHBZISwT6TrQiFCZJQFmV1dvgIDSZEECoBGqt8IBw4gES32DcIFRggWAIYtUAGDSMFkn2DAJRTDcLZF6DAomjQQkDQYlSZoEA4Ezwohk4FhAiDoonWZKEQ5SEQtI9gY3bYTQMxAwiGmQQiCJgQiDAIJTIBmILJWSFAYTpMhEZNEwQDCKVAstERqJEolEJDLhGFIrAAwcTMDWJEqA5AeFSkAChAZRSX8KEQTyFDIFySADEqWoRQiDFAiDIoFSMAAgU0EERUmDyaBFqRAIUdgcMNhAiFARADFqIFwQiDhRGJAQGE0wYDIAEDJu3aH+0AC5t2Obt7bqJf///+jiDSLFCMwERNt7dpXwiD/nkDkqZEMkbAZ0Iw9YEQv1EQiDTYQEQrNwIztu3QLN26TID4FkDiEA=")) \ No newline at end of file +require("heatshrink").decompress(atob("mEw4f/gUA///j32o8h9v6glA+P9+/3tu27YCLvICBgEGCJlFmwRBgALFxQRIgIdF28JmIIEknG7cMyVJk4nBC4PJk4dBC4OJkmSrYRCkuACQM26/88wRGgQHB2iGCm33//8GoXtonbraYGgwRB/+bNY4AEg9/CIPbth3BxYRJn4RB/YRBgEUTwIRGne275IBCIQABjYRGrpCB+VK1gJDgYQFgXN23YQwIjEAA0WMwPQ0mSqgRK2QRBy6cBCJUFGIO12wjBpgRMlsAqmSqTOCAA0sCINogEIyVKCJdLoEAhQRNpQFCyVII5IRGqARQNZUECIcGyRLBPpPSCIQWBsCzK3VJoEB0mTCBUAitplEA0WYCJb7B1EBCYIAsjJjCknDpMkyUAmlKNwuEyEAgMSwwQBpNhAQM4CAcDkgRBe4ODogOB4MT0MldgcxCIXEyWAi3axNgykECIcBxIRBEwIRBYoK3BykGkw1DxPEyEZksSCIMEpcDjAIBGocbhMQiMzCIUyqALB5KmFhMghMk0VLQANYPoLeBCI0SRgOKJYOAgOSpihFCIMaCIOTgMk4ACBqVICIyTBKIMZkkAhpyBo4RHgOk4EZPAIjByVFNYYIBAoU2AoOwAQO5kmMf7QALpMg2VJ23Mn////8OIVThmUCIs27FvCIP+eQOSpUIyXAgFNEYfQCIX8P4OSp0MCIVZgEWFoNgrMktuwgdt23YOIQ")) \ No newline at end of file diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index dfda2f24c..d33c47474 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -1,7 +1,7 @@ { "id": "burn", "name": "Burn", - "version": "0.03", + "version": "0.04", "description": "Simple Calorie Counter -- saves to flash (kcal.txt) and resets at midnight", "icon": "burn_icon.png", "tags": "tool", From 5d2427dff27d4e61335554585ae58cac61e82f16 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Fri, 7 Jun 2024 14:36:16 -0700 Subject: [PATCH 06/10] cleanup for PR --- apps/burn/ChangeLog | 3 ++- apps/burn/README.md | 5 +++-- apps/burn/metadata.json | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog index bfa77f389..5551398c0 100644 --- a/apps/burn/ChangeLog +++ b/apps/burn/ChangeLog @@ -1,4 +1,5 @@ 0.01: New App! 0.02: Added README.md 0.03: Icon update -0.04: Icon Fix \ No newline at end of file +0.04: Icon Fix +0.05: Misc cleanup for PR \ No newline at end of file diff --git a/apps/burn/README.md b/apps/burn/README.md index 5a32609ba..44f1e260f 100644 --- a/apps/burn/README.md +++ b/apps/burn/README.md @@ -1,10 +1,11 @@ # Burn: Calorie Counter -Burn is a calorie counter application for Bangle.js (Espruino). It is based on the original Counter app and has been enhanced with additional features. +Burn is a simple calorie counter application. It is based on the original Counter app and has been enhanced with additional features (I recommend using +it with the "Digital Clock Widget", if you intend to keep it running). ## Features -- **Persistent counter**: The counter value is saved to a file, so it persists even when the app is closed or the device is restarted. +- **Persistent counter**: The counter value is saved to flash, so it persists even when the app is closed or the device is restarted. - **Daily reset**: The counter resets each day, allowing you to track your calorie intake on a daily basis. - **Adjustable increment value**: You can adjust the increment value to suit your needs. diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index d33c47474..82967794f 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -1,8 +1,8 @@ { "id": "burn", "name": "Burn", - "version": "0.04", - "description": "Simple Calorie Counter -- saves to flash (kcal.txt) and resets at midnight", + "version": "0.05", + "description": "Simple Calorie Counter -- saves to flash and resets at midnight. I often keep mine running while the digital clock widget is at the top", "icon": "burn_icon.png", "tags": "tool", "readme":"README.md", From c3f35762007d218b34fee9aff319b369a00056a4 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Sun, 9 Jun 2024 13:33:14 -0700 Subject: [PATCH 07/10] fixes from PR comments --- apps/burn/.gitignore | 1 + apps/burn/.prettierignore | 2 +- apps/burn/ChangeLog | 3 ++- apps/burn/{burn-icon.js => app-icon.js} | 0 apps/burn/{burn_icon.png => app-icon.png} | Bin ...burn-screenshot.png => app-screenshot.png} | Bin apps/burn/{burn.js => app.js} | 24 ++++-------------- apps/burn/metadata.json | 10 ++++---- 8 files changed, 14 insertions(+), 26 deletions(-) create mode 100644 apps/burn/.gitignore rename apps/burn/{burn-icon.js => app-icon.js} (100%) rename apps/burn/{burn_icon.png => app-icon.png} (100%) rename apps/burn/{bangle1-burn-screenshot.png => app-screenshot.png} (100%) rename apps/burn/{burn.js => app.js} (95%) diff --git a/apps/burn/.gitignore b/apps/burn/.gitignore new file mode 100644 index 000000000..656b79624 --- /dev/null +++ b/apps/burn/.gitignore @@ -0,0 +1 @@ +.prettierignore \ No newline at end of file diff --git a/apps/burn/.prettierignore b/apps/burn/.prettierignore index 172082901..292d490cb 100644 --- a/apps/burn/.prettierignore +++ b/apps/burn/.prettierignore @@ -1,2 +1,2 @@ # Ignore icon: -burn-icon.js \ No newline at end of file +app-icon.js \ No newline at end of file diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog index 5551398c0..11d2aaf66 100644 --- a/apps/burn/ChangeLog +++ b/apps/burn/ChangeLog @@ -2,4 +2,5 @@ 0.02: Added README.md 0.03: Icon update 0.04: Icon Fix -0.05: Misc cleanup for PR \ No newline at end of file +0.05: Misc cleanup for PR +0.06: Implementing fixes from PR comments \ No newline at end of file diff --git a/apps/burn/burn-icon.js b/apps/burn/app-icon.js similarity index 100% rename from apps/burn/burn-icon.js rename to apps/burn/app-icon.js diff --git a/apps/burn/burn_icon.png b/apps/burn/app-icon.png similarity index 100% rename from apps/burn/burn_icon.png rename to apps/burn/app-icon.png diff --git a/apps/burn/bangle1-burn-screenshot.png b/apps/burn/app-screenshot.png similarity index 100% rename from apps/burn/bangle1-burn-screenshot.png rename to apps/burn/app-screenshot.png diff --git a/apps/burn/burn.js b/apps/burn/app.js similarity index 95% rename from apps/burn/burn.js rename to apps/burn/app.js index 44ed7d146..a2dad9a54 100644 --- a/apps/burn/burn.js +++ b/apps/burn/app.js @@ -19,6 +19,9 @@ // File variable to handle file operations let file; +// Check if the hardware version is Bangle.js 2 +const BANGLEJS2 = process.env.HWVERSION == 2; + // Importing the Storage module for file operations const Storage = require("Storage"); @@ -26,11 +29,11 @@ const Storage = require("Storage"); const PATH = "kcal.txt"; // Function to get the current date as a string -const dayString = () => { +function dayString() { const date = new Date(); // Month is 0-indexed, so we add 1 to get the correct month number return `${date.getMonth() + 1}-${date.getDate()}-${date.getFullYear()}`; -}; +} // Counter object to keep track of the count and the date let counter = { count: 0, date: dayString() }; @@ -135,23 +138,6 @@ const intervalFunctions = createIntervalFunctions(); const getInterval = intervalFunctions.getInterval; const rotateIncrement = intervalFunctions.rotateIncrement; -// Check if the hardware version is Bangle.js 2 -const BANGLEJS2 = process.env.HWVERSION == 2; - -// Variables for drag handling and screen coordinates -let drag, y, x; - -// If the hardware version is Bangle.js 2, set the coordinates accordingly -if (BANGLEJS2) { - drag = undefined; - y = 45; - x = 5; -} else { - // If the hardware version is Bangle.js 1, set the coordinates accordingly - y = 100; - x = 25; -} - // Function to update the screen function updateScreen() { // Clear the screen area for the counter diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index 82967794f..7cb81a1b8 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -1,16 +1,16 @@ { "id": "burn", "name": "Burn", - "version": "0.05", + "version": "0.06", "description": "Simple Calorie Counter -- saves to flash and resets at midnight. I often keep mine running while the digital clock widget is at the top", - "icon": "burn_icon.png", + "icon": "app-icon.png", "tags": "tool", "readme":"README.md", "supports": ["BANGLEJS", "BANGLEJS2"], - "screenshots": [{"url":"bangle1-burn-screenshot.png"}], + "screenshots": [{"url":"app-screenshot.png"}], "allow_emulator": true, "storage": [ - {"name":"burn.app.js","url":"burn.js"}, - {"name":"burn.img","url":"burn-icon.js","evaluate":true} + {"name":"burn.app.js","url":"app.js"}, + {"name":"burn.img","url":"app-icon.js","evaluate":true} ] } From 7f7ebd1039cb19c1f84655fc3150ca09abb70f11 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Sun, 9 Jun 2024 13:39:12 -0700 Subject: [PATCH 08/10] bug fix --- apps/burn/app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/burn/app.js b/apps/burn/app.js index a2dad9a54..348a19153 100644 --- a/apps/burn/app.js +++ b/apps/burn/app.js @@ -161,6 +161,9 @@ function updateScreen() { } // If the hardware version is Bangle.js 2, set up the drag handling and button watch + +let drag; + if (BANGLEJS2) { // Set up drag handling Bangle.on("drag", (e) => { From fa2ed9d30d528d96160ef56b4cfa3aac2456d191 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Sun, 9 Jun 2024 13:40:42 -0700 Subject: [PATCH 09/10] bug fix --- apps/burn/ChangeLog | 3 ++- apps/burn/metadata.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/burn/ChangeLog b/apps/burn/ChangeLog index 11d2aaf66..66c4f98bd 100644 --- a/apps/burn/ChangeLog +++ b/apps/burn/ChangeLog @@ -3,4 +3,5 @@ 0.03: Icon update 0.04: Icon Fix 0.05: Misc cleanup for PR -0.06: Implementing fixes from PR comments \ No newline at end of file +0.06: Implementing fixes from PR comments +0.07: Bug fix diff --git a/apps/burn/metadata.json b/apps/burn/metadata.json index 7cb81a1b8..c032058c8 100644 --- a/apps/burn/metadata.json +++ b/apps/burn/metadata.json @@ -1,7 +1,7 @@ { "id": "burn", "name": "Burn", - "version": "0.06", + "version": "0.07", "description": "Simple Calorie Counter -- saves to flash and resets at midnight. I often keep mine running while the digital clock widget is at the top", "icon": "app-icon.png", "tags": "tool", From 6cc24efe5267b22f92ee6e6a8d15aa7a08c25a67 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Sun, 9 Jun 2024 14:01:02 -0700 Subject: [PATCH 10/10] remove prettierignore --- apps/burn/.prettierignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 apps/burn/.prettierignore diff --git a/apps/burn/.prettierignore b/apps/burn/.prettierignore deleted file mode 100644 index 292d490cb..000000000 --- a/apps/burn/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore icon: -app-icon.js \ No newline at end of file