starting planetarium

pull/652/head
Pablo Gonzalez 2021-01-28 13:34:39 +01:00
parent c6d35c5ae9
commit 8c0c0b5a53
6 changed files with 213 additions and 0 deletions

View File

@ -2674,4 +2674,18 @@
{"name":"intervals.img","url":"intervals-icon.js","evaluate":true}
]
}
,
{ "id": "planetarium",
"name": "Planetarium",
"shortName":"planetarium",
"icon": "planetarium.png",
"version":"0.01",
"description": "Planetarium.",
"tags": "",
"storage": [
{"name":"planetarium.app.js","url":"planetarium.app.js"},
{"name":"planetarium.app.csv","url":"planetarium.app.csv"},
{"name":"planetarium.img","url":"planetarium-icon.js","evaluate":true}
]
}
]

View File

@ -0,0 +1 @@
# Planetarium

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwg96xAWVhGIwAuWGCoXrCIZfFDZkJyAKTAAOZBaojEzIADGBoOChITEAgIUCGBAhCCwIlFA4YwIhIjCDQYtDAoIMBQhgUCzJMDR5xYGFwSPMHwYRED4KPMCQcIxKtHWApoCEYczmYXCPgYAEGgZGCAgMDC4pEGA4gVBGwIWCF6GqhWgC4kqBYYAGGgegC4QWCC4kKI4oQBC4guEC4wJDC4gtBGoIXDmWqBoQMBBQUwIAQXJKopSDJooXGmQRBBwYLBFgR2EC4QAEC4RIDToRQDC56pESYhHDAAYFBA4YvMD4oOEL5bMGaJIQFC5ZiEAoxRCC5I1KJoIXVBYJ4FEYgAGPAwwHSYIAGJAwwHEA5+HB5AvMZI4XKBwu72ELAQIHCAoQCBchQMCAQIADDgIfEDBYRBAAI5DCxYUDAxYYMAAgWPDIoVSAFAA=="))

View File

@ -0,0 +1,30 @@
1.76779,-0.29175,-1.5,AL CMA
1.67531,-0.91971,-0.7,AL CAR
3.73352,0.33480,-0.0,AL BOO
3.83799,-1.06178,-0.0,AL1 CEN
4.87356,0.67690,0.0,AL LYR
1.38181,0.80282,0.1,AL AUR
1.37243,-0.14315,0.1,BE ORI
2.00408,0.09119,0.4,AL CMI
0.42636,-0.99897,0.5,AL ERI
1.54973,0.12928,0.5,AL ORI
3.68187,-1.05370,0.6,BE CEN
5.19577,0.15478,0.8,AL AQL
1.20393,0.28814,0.8,AL TAU
4.31710,-0.46132,1.0,AL SCO
3.51331,-0.19480,1.0,AL VIR
2.03032,0.48915,1.1,BE GEM
6.01113,-0.51701,1.2,AL PSA
3.34982,-1.04176,1.2,BE CRU
5.41676,0.79029,1.2,AL CYG
3.83799,-1.06178,1.3,AL2 CEN
2.65452,0.20887,1.4,AL LEO
1.82660,-0.50566,1.5,EP CMA
1.98356,0.55656,1.6,AL GEM
3.25765,-1.10128,1.6,AL1 CRU
1.98356,0.55656,1.6,AL GEM
3.27758,-0.99681,1.6,GA CRU
4.59723,-0.64758,1.6,LA SCO
1.41865,0.11082,1.6,GA ORI
1.42372,0.49930,1.6,BE TAU
2.41380,-1.21680,1.7,BE CAR
1 1.76779 -0.29175 -1.5 AL CMA
2 1.67531 -0.91971 -0.7 AL CAR
3 3.73352 0.33480 -0.0 AL BOO
4 3.83799 -1.06178 -0.0 AL1 CEN
5 4.87356 0.67690 0.0 AL LYR
6 1.38181 0.80282 0.1 AL AUR
7 1.37243 -0.14315 0.1 BE ORI
8 2.00408 0.09119 0.4 AL CMI
9 0.42636 -0.99897 0.5 AL ERI
10 1.54973 0.12928 0.5 AL ORI
11 3.68187 -1.05370 0.6 BE CEN
12 5.19577 0.15478 0.8 AL AQL
13 1.20393 0.28814 0.8 AL TAU
14 4.31710 -0.46132 1.0 AL SCO
15 3.51331 -0.19480 1.0 AL VIR
16 2.03032 0.48915 1.1 BE GEM
17 6.01113 -0.51701 1.2 AL PSA
18 3.34982 -1.04176 1.2 BE CRU
19 5.41676 0.79029 1.2 AL CYG
20 3.83799 -1.06178 1.3 AL2 CEN
21 2.65452 0.20887 1.4 AL LEO
22 1.82660 -0.50566 1.5 EP CMA
23 1.98356 0.55656 1.6 AL GEM
24 3.25765 -1.10128 1.6 AL1 CRU
25 1.98356 0.55656 1.6 AL GEM
26 3.27758 -0.99681 1.6 GA CRU
27 4.59723 -0.64758 1.6 LA SCO
28 1.41865 0.11082 1.6 GA ORI
29 1.42372 0.49930 1.6 BE TAU
30 2.41380 -1.21680 1.7 BE CAR

View File

@ -0,0 +1,167 @@
var counter;
var counterInterval;
var settings;
var work=false; //true if training false if resting
var prep=true; //true if we are in prep phase (at the beginning of the session
var setNum;
var paused;
function endPart() {
g.clear();
if (prep){
prep=false;
work = true;
counter = settings.workseg+settings.workmin*60;
startCounter();
}else if (work){
work = false;
counter = settings.restseg+settings.restmin*60;
startCounter();
}
else{
if (setNum>1)
{
setNum--;
work = true;
counter = settings.workseg+settings.workmin*60;
startCounter();
}
else
{
//End session
setWatch(showMenu, BTN2);
E.showMessage("Press BTN2 for\ngoing back\nto the menu","Well done!");
}
}
}
function printCounter(counter){
g.setFontAlign(0,0); // center font
g.setFont("Vector",80); // vector font, 80px
// draw the current counter value
let minutes = Math.floor(counter/60);
let segs = counter % 60;
let textMinutes = minutes.toString().padStart(2, "0");
let textSegs = segs.toString().padStart(2,"0");
g.clearRect(0,80,239,160);
g.setFont("Vector",30);
if (prep)
g.setColor(125,125,0);
else if (work)
g.setColor(255,0,0);
else
g.setColor(0,255,0);
g.drawString(setNum,120,50);
if (prep)
g.drawString("PREPARATION",120,190);
else if (work)
g.drawString("WORK",120,190);
else
g.drawString("REST",120,190);
g.setFont("Vector",10);
g.drawString("Touch to pause",120,215);
g.setFont("Vector",80);
g.drawString(textMinutes+":"+textSegs,120,120);
}
function signal_to_user(le){
if (settings.buzz)
Bangle.buzz(le);
else
Bangle.beep(le,4000);
}
function countDown() {
counter--;
if (counter<4 && counter>0)
signal_to_user(200);
if (counter==0)
signal_to_user(600);
if (counter<0) {
clearInterval(counterInterval);
counterInterval = undefined;
endPart();
}
else
{
printCounter(counter);
}
g.flip();
}
function startCounter(){
if (!counterInterval)
counterInterval = setInterval(countDown, 1000);
}
function pause()
{
if (!paused)
{
clearInterval(counterInterval);
counterInterval = undefined;
setWatch(resume,BTN4);
setWatch(resume,BTN5);
paused=true;
g.clear();
g.setFont("Vector",60);
g.drawString("PAUSED",120,120);
g.setFont("Vector",20);
g.drawString("Touch to continue",120,180);
}
}
function resume(){
if (paused)
{
g.clear();
counterInterval = setInterval(countDown, 1000);
setWatch(pause,BTN4);
setWatch(pause,BTN5);
paused=false;
}
}
function startSession() {
E.showMenu();
paused=false;
setWatch(pause,BTN4);
setWatch(pause,BTN5);
require('Storage').write('intervals.settings.json',settings);
setNum = settings.sets;
counter = 5;//prep time
prep=true;
work=false;
startCounter();
}
function showMenu()
{
settings = require('Storage').readJSON('intervals.settings.json',1)||
{ sets:1,workseg:10,workmin:0,restseg:5,restmin:0,buzz:true};
var mainmenu = {
"" : { "title" : "-- Main Menu --" },
"START" : function() { startSession(); },
"Sets" : { value : settings.sets,min:0,max:20,step:1,onchange : v => { settings.sets=v; } },
"Work minutes" : { value : settings.workmin,min:0,max:59,step:1,onchange : v => { settings.workmin=v; } },
"Work seconds" : { value : settings.workseg,min:0,max:59,step:5,onchange : v => { settings.workseg=v; } },
"Rest minutes" : { value : settings.restmin,min:0,max:59,step:1,onchange : v => { settings.restmin=v; } },
"Rest seconds" : { value : settings.restseg,min:0,max:59,step:5,onchange : v => { settings.restseg=v; } },
"Signal type" : { value : settings.buzz,format : v => v?"Buzz":"Beep",onchange : v => { settings.buzz=v; }}
};
E.showMenu(mainmenu);
}
showMenu();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB