-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Binary LED Clock (BLC) #3569
Open
aemkai
wants to merge
15
commits into
espruino:master
Choose a base branch
from
aemkai:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e5458fc
fix recent change for file backup
gfwilliams 2569ef9
Update blc.js
aemkai 2da3498
Update metadata.json
aemkai ca055b4
upload new screenshots
aemkai db315f4
add settings files
aemkai 5403964
Delete apps/blc/screenshot_blc.bmp
aemkai 19391a0
Update README.md
aemkai 8bd5f3e
Update ChangeLog
aemkai 3b37203
Merge branch 'espruino:master' into master
aemkai 8336e4e
Update blc.settings.js
aemkai 3bdaad5
Update blc.js
aemkai b5491e1
Update blc.js
aemkai 15c2ddb
Update blc.settings.js
aemkai b7b23b8
Update blc.settings.js
aemkai b4f7f6f
Update apps/blc/blc.settings.json
aemkai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
0.10: New app introduced to the app loader! | ||
0.20: skipped (internal revision) | ||
0.30: skipped (internal revision) | ||
0.40: added functionality for customizing colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Change settings for BinaryClk | ||
|
||
(function(back){ | ||
|
||
// color array -- don't change order unless change oder in BinaryClk.js | ||
let LED_ColorNames = ["white", "red", "green", "blue", "yellow", "magenta", "cyan", "black"]; | ||
|
||
var FILE = "BinaryClk.settings.json"; | ||
// Load settings | ||
var settings = Object.assign({ | ||
HourCol: "red", | ||
MinCol: "green", | ||
DayCol: "yellow", | ||
MonCol: "yellow", | ||
RingOn: true, | ||
}, require('Storage').readJSON(FILE, true) || {}); | ||
|
||
function writeSettings(){ | ||
require('Storage').writeJSON(FILE, settings); | ||
} | ||
|
||
// Helper method which uses int-based menu item for set of string values | ||
function stringItems(startvalue, writer, values) { | ||
return{ | ||
value: (startvalue === undefined ? 0 : values.indexOf(startvalue)), | ||
format: v => values[v], | ||
min: 0, | ||
max: values.length - 1, | ||
wrap: true, | ||
step: 1, | ||
onchange: v => { | ||
writer(values[v]); | ||
writeSettings(); | ||
} | ||
}; | ||
} | ||
|
||
// Helper method which breaks string set settings down to local settings object | ||
function stringInSettings(name, values) { | ||
return stringItems(settings[name], v => settings[name] = v, values); | ||
} | ||
|
||
// Show the menu | ||
var mainmenu = { | ||
"" : { | ||
"title" : "BinaryCLK" | ||
}, | ||
"< Back" : () => back(), | ||
'Color Hour.:': stringInSettings("HourCol", LED_ColorNames), | ||
'Color Minute:': stringInSettings("MinCol", LED_ColorNames), | ||
'Color Day': stringInSettings("DayCol", LED_ColorNames), | ||
'Color Month:': stringInSettings("MonCol", LED_ColorNames), | ||
'LED ring on/off': { | ||
value: (settings.RingOn !== undefined ? settings.RingOn : true), | ||
onchange: v => { | ||
settings.RingOn = v; | ||
writeSettings(); | ||
} | ||
}, | ||
}; | ||
|
||
// Show submenues | ||
//var submenu1 = { | ||
//"": { | ||
// "title": "Show sub1..." | ||
//}, | ||
//"< Back": () => E.showMenu(mainmenu), | ||
//"ItemName": stringInSettings("settingsVar", ["Yes", "No", "DontCare"]), | ||
//}; | ||
|
||
E.showMenu(mainmenu); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"HourCol": "red", | ||
"MinCol": "green", | ||
"DayCol": "yellow", | ||
"MonCol": "yellow", | ||
"RingOn": true | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this you can use bitshifting if you like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is also a good solution. In my opinion the the "LUT"-way may be a bit faster an with only six values not much bigger regarding code size.