Skip to content

Commit 361f9eb

Browse files
authored
Display equinoxes and solstices.
1 parent cf53588 commit 361f9eb

8 files changed

Lines changed: 26 additions & 13 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This project is designed to create a desktop clock which provides weather and astronomical information. While primarily designed to run on a Raspberry Pi, the code will create a Node.js server and client web app that can be run on other computers and operating systems, albeit without the Raspberry Pi’s hardware-level support for wired and wireless temperature/humidity sensors.
44

5-
The clock displays the time and date in both analog and digital form, in 12- or 24-hour format (with a special display mode for the occasional leap second). The clock also displays current weather conditions, a four-day forecast, sunrise and sunset times, moon phases, and the positions of the Sun, Moon, and major planets along the ecliptic.
5+
The clock displays the time and date in both analog and digital form, in 12- or 24-hour format (with a special display mode for the occasional leap second). The clock also displays current weather conditions, a four-day forecast, sunrise and sunset times, moon phases, equinoxes, solstices, and the positions of the Sun, Moon, and major planets along the ecliptic.
66

77
### Getting started
88

@@ -17,15 +17,15 @@ While it’s typical to do `npm install` upon first cloning a project, this proj
1717

1818
To build and run this project you can use the following commands:
1919
-`npm run build` [-- [`--acu`] [`--dht`] [ `--pt`] [`--sd`]]” to build (with optional support for wired and/or wireless temperature/humidity sensors).
20-
-`npm run start-server`” to start the data server for this project (not on Windows).
21-
-`npm run start-server-win`” to start the data server for this project (on Windows).
22-
-`npm start`” to serve the web client using webpack-dev-server.
20+
-`npm run start-server`” to start the data server for this project (not for Windows) on `localhost:4201`.
21+
-`npm run start-server-win`” to start the data server for this project (for Windows) on `localhost:4201`.
22+
-`npm start`” to serve the web client using webpack-dev-server on `localhost:4200`. _(Note that for development and testing, two different ports are used, but that when the server is deployed, all content and data is served on one port, by default 8080.)_
2323

2424
> Note: A dependency on `node-sass` sometimes causes build problems. It often helps to delete the top level `node_modules` directory, and then do `npm install` over again. I’ve also found that using `LIBSASS_EXT=”no” npm install` helped.
2525
2626
The server requires a Dark Sky API key for weather data. Use the environment variable `AWC_DARK_SKY_API_KEY` to set the key. (See https://darksky.net/ for further details.)
2727

28-
By default the server uses `pool.ntp.org` as an NTP time server. Use the environment variable `AWC_NTP_SERVER` to change the time server. Do not use a Google time server, or any other NTP server that implements “leap second smearing” if you want the Astronomy/Weather Clock to be able to display leap seconds.
28+
By default the server uses `pool.ntp.org` as an NTP time server. Use the environment variable `AWC_NTP_SERVER` to change the time server. Do not use a Google time server, or any other NTP server that implements “leap second smearing”, if you want the Astronomy/Weather Clock to be able to display leap seconds.
2929

3030
![Hypothetical leap second](https://shetline.com/misc/moment_of_leap_second.jpg)
3131

@@ -39,7 +39,7 @@ To build the server along with the web client, use `npm run build` (possibly fol
3939
| `npm run build -- --dht` |     Server/client with wired indoor sensor support. |
4040
| `npm run build -- --dht --acu` |     Server/client with both wired and wireless sensor support. |
4141

42-
This `--pt` option is for “plain text”, meaning the console colors and progress animation are disabled.
42+
This `--pt` option is for “plain text”, meaning that console colors and progress animation are disabled.
4343

4444
The Raspberry Pi-only option `--sd` deploys the app to the default `~/weather` directory (typically `/home/pi/weather`).
4545

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

server/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-server",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"private": true,

src/ephemeris.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class Ephemeris {
6262
private sunsets: JQuery[] = [];
6363
private moons: JQuery[] = [];
6464
private phaseTimes: JQuery[] = [];
65+
private esTimes: JQuery[] = [];
6566
private planetElems: JQuery[] = [];
6667

6768
private _hidePlanets = false;
@@ -80,6 +81,7 @@ export class Ephemeris {
8081
this.sunsets[i] = $('#day' + i + '-sunset');
8182
this.moons[i] = $('#day' + i + '-moon');
8283
this.phaseTimes[i] = $('#day' + i + '-phase-time');
84+
this.esTimes[i] = $('#day' + i + '-equisolstice');
8385
}
8486
}
8587

@@ -202,10 +204,13 @@ export class Ephemeris {
202204
const noon_JDU = KsDateTime.julianDay(noon.utcTimeMillis);
203205
const noon_JDE = UT_to_TDB(noon_JDU);
204206
const phase = solarSystem.getLunarPhase(noon_JDE);
205-
const event = eventFinder.getLunarPhaseEvent(date.y, date.m, date.d, timezone);
207+
const lpEvent = eventFinder.getLunarPhaseEvent(date.y, date.m, date.d, timezone);
208+
const esEvent = eventFinder.getEquinoxSolsticeEvent(date.y, date.m, date.d, timezone);
206209

207210
setSvgHref(this.moons[dayIndex], getMoonPhaseIcon(phase));
208-
this.phaseTimes[dayIndex].text(event ? formatTime(event.eventTime, amPm) : '');
211+
this.phaseTimes[dayIndex].text(lpEvent ? formatTime(lpEvent.eventTime, amPm) : '');
212+
this.esTimes[dayIndex].text(esEvent ? (date.m === 3 || date.m === 9 ? 'E•' : 'S•') +
213+
formatTime(esEvent.eventTime, amPm) : '');
209214
}
210215
}
211216
}

src/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
<text id="day0-sunset" x="115" y="88" class="small-caption" text-anchor="middle">--:--</text>
137137
<image id="day0-moon" href="assets/empty.svg" x="110" y="89" width="10" height="10"/>
138138
<text id="day0-phase-time" x="115" y="101.75" class="small-caption" text-anchor="middle"></text>
139+
<text id="day0-equisolstice" x="115" y="104.25" class="small-caption equisolstice" text-anchor="middle"></text>
139140

140141
<text x="128" y="59" class="small-caption forecast-day-header" text-anchor="middle">Tomorrow</text>
141142
<image id="day1-icon" href="assets/unknown.svg" x="122" y="60" width="12" height="12"/>
@@ -146,6 +147,7 @@
146147
<text id="day1-sunset" x="128" y="88" class="small-caption" text-anchor="middle">--:--</text>
147148
<image id="day1-moon" href="assets/empty.svg" x="123" y="89" width="10" height="10"/>
148149
<text id="day1-phase-time" x="128" y="101.75" class="small-caption" text-anchor="middle"></text>
150+
<text id="day1-equisolstice" x="128" y="104.25" class="small-caption equisolstice" text-anchor="middle"></text>
149151

150152
<text id="day2-caption" x="141" y="59" class="small-caption forecast-day-header" text-anchor="middle">---</text>
151153
<image id="day2-icon" href="assets/unknown.svg" x="135" y="60" width="12" height="12"/>
@@ -156,6 +158,7 @@
156158
<text id="day2-sunset" x="141" y="88" class="small-caption" text-anchor="middle">--:--</text>
157159
<image id="day2-moon" href="assets/empty.svg" x="136" y="89" width="10" height="10"/>
158160
<text id="day2-phase-time" x="141" y="101.75" class="small-caption" text-anchor="middle"></text>
161+
<text id="day2-equisolstice" x="141" y="104.25" class="small-caption equisolstice" text-anchor="middle"></text>
159162

160163
<text id="day3-caption" x="154" y="59" class="small-caption forecast-day-header" text-anchor="middle">---</text>
161164
<image id="day3-icon" href="assets/unknown.svg" x="148" y="60" width="12" height="12"/>
@@ -166,6 +169,7 @@
166169
<text id="day3-sunset" x="154" y="88" class="small-caption" text-anchor="middle">--:--</text>
167170
<image id="day3-moon" href="assets/empty.svg" x="149" y="89" width="10" height="10"/>
168171
<text id="day3-phase-time" x="154" y="101.75" class="small-caption" text-anchor="middle"></text>
172+
<text id="day3-equisolstice" x="154" y="104.25" class="small-caption equisolstice" text-anchor="middle"></text>
169173

170174
<image id="current-icon" xlink:href="assets/sunrise.svg" href="assets/sunrise.svg" x="103" y="83.5" width="6" height="6"/>
171175
</svg>
@@ -256,7 +260,7 @@
256260
</div>
257261
</div>
258262
<div class="dialog-buttons">
259-
<span class="version-number">2.0.3</span>
263+
<span class="version-number">2.0.4</span>
260264
<button id="settings-reload">Reload</button>
261265
<span>&bull;</span>
262266
<button id="settings-cancel">Cancel</button>

src/styles.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,3 +612,7 @@ input, button, select, textarea, optgroup, option { // Ignored by macOS Chrome f
612612
.meter-tint {
613613
filter: url(#meter-tint);
614614
}
615+
616+
.equisolstice {
617+
fill: #FA0;
618+
}

0 commit comments

Comments
 (0)