speed improvements
parent
fa0b2c7d08
commit
96c75058a3
|
|
@ -8,4 +8,12 @@ Plan is to show also constellations, but this is work in progress. Now it shows
|
||||||
|
|
||||||
I think code is quite optimized already. It runs as fast as I could make it run. If someone has some ideas to speed it up, I could plot more stars.
|
I think code is quite optimized already. It runs as fast as I could make it run. If someone has some ideas to speed it up, I could plot more stars.
|
||||||
|
|
||||||
Basic equations to compute declination and right ascension for stars where taken from this [github repo](https://github.com/Michi83/planetarium).
|
Basic equations to compute declination and right ascension for stars where taken from this [github repo](https://github.com/Michi83/planetarium). Thanks!
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
The planetarium plots the stars as if you are looking to the sky (with your watch screen pointing downwards). This means, if you have the watch in your wrist, you have to look south to see the stars matching. If you want to look north, just take out the watch from your wrist and make a 180º turn.
|
||||||
|
|
||||||
|
## Improvements
|
||||||
|
I plan to add more constellations as soon as I have time. I am adding the constellations that I know of, but the plan is to add all the main ones (at least for North Hemisphere).
|
||||||
|
|
||||||
|
Please note that the watch hardware is limited and computing the stars positions is a quite intensive task for this little processor. This is why it plots only stars and no planets or the moon. For plotting the planets, storage will be a limiting factor as well as computing the position for planets needs more initial data compared with stars.
|
||||||
|
|
@ -46,7 +46,6 @@ function drawStars(lat,lon,date){
|
||||||
|
|
||||||
storage = require('Storage');
|
storage = require('Storage');
|
||||||
f=storage.read("planetarium.data.csv","r");
|
f=storage.read("planetarium.data.csv","r");
|
||||||
linestart=0;
|
|
||||||
g.clear();
|
g.clear();
|
||||||
|
|
||||||
//Common calculations based only on time
|
//Common calculations based only on time
|
||||||
|
|
@ -59,14 +58,12 @@ function drawStars(lat,lon,date){
|
||||||
let starNumber = 0;
|
let starNumber = 0;
|
||||||
var starPositions = {};
|
var starPositions = {};
|
||||||
|
|
||||||
for (i=0;i<f.length;i++)
|
var line,linestart = 0;
|
||||||
{
|
lineend = f.indexOf("\n");
|
||||||
if (f[i]=='\n'){
|
while (lineend>=0) {
|
||||||
|
line = f.substring(linestart,lineend);
|
||||||
starNumber++;
|
starNumber++;
|
||||||
//console.log("Line from "+linestart.toString()+"to "+(i-1).toString());
|
|
||||||
line = f.substr(linestart,i-linestart);
|
|
||||||
//console.log(line);
|
//console.log(line);
|
||||||
linestart = i+1;
|
|
||||||
//Process the star
|
//Process the star
|
||||||
starInfo = line.split(',');
|
starInfo = line.split(',');
|
||||||
//console.log(starInfo[0]);
|
//console.log(starInfo[0]);
|
||||||
|
|
@ -93,8 +90,10 @@ function drawStars(lat,lon,date){
|
||||||
g.flip();
|
g.flip();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
linestart = lineend+1;
|
||||||
|
lineend = f.indexOf("\n",linestart);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.constellations){
|
if (settings.constellations){
|
||||||
//Each star has a number (the position on the file (line number)). These are the lines
|
//Each star has a number (the position on the file (line number)). These are the lines
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue