diff --git a/gulp/publish-frontend.js b/gulp/publish-frontend.js
index 720c1ef..b3d7d63 100644
--- a/gulp/publish-frontend.js
+++ b/gulp/publish-frontend.js
@@ -40,6 +40,7 @@ const js_sources = [
'server/scripts/modules/icons.js',
'server/scripts/modules/utilities.js',
'server/scripts/modules/currentweather.js',
+ 'server/scripts/modules/currentweatherscroll.js',
'server/scripts/modules/latestobservations.js',
'server/scripts/modules/travelforecast.js',
'server/scripts/modules/regionalforecast.js',
diff --git a/server/scripts/index.js b/server/scripts/index.js
index 7612454..c04427e 100644
--- a/server/scripts/index.js
+++ b/server/scripts/index.js
@@ -216,8 +216,6 @@ const index = (() => {
// Do not auto get the same city twice.
if (this.previousSuggestionValue === suggestion.value) return;
- this.previousSuggestionValue = suggestion.value;
- PreviousSuggestion = suggestion;
if (overrides[suggestion.value]) {
doRedirectToGeometry(overrides[suggestion.value]);
diff --git a/server/scripts/modules/almanac.js b/server/scripts/modules/almanac.js
index 514d387..900806b 100644
--- a/server/scripts/modules/almanac.js
+++ b/server/scripts/modules/almanac.js
@@ -38,7 +38,6 @@ class Almanac extends WeatherDisplay {
// process images for outlook
const [outlookTemp, outlookPrecip] = await Promise.all(imagePromises);
- console.log(outlookTemp,outlookPrecip);
const outlook = this.parseOutlooks(weatherParameters.latitude, weatherParameters.longitude, outlookTemp, outlookPrecip);
// store the data
@@ -47,8 +46,8 @@ class Almanac extends WeatherDisplay {
moon,
outlook,
};
- // draw the canvas
- this.drawCanvas();
+ // update status
+ this.setStatus(STATUS.loaded);
}
@@ -295,7 +294,6 @@ class Almanac extends WeatherDisplay {
});
this.finishDraw();
- this.setStatus(STATUS.loaded);
break;
case 1:
diff --git a/server/scripts/modules/currentweather.js b/server/scripts/modules/currentweather.js
index 238b0b8..a46b1cf 100644
--- a/server/scripts/modules/currentweather.js
+++ b/server/scripts/modules/currentweather.js
@@ -50,45 +50,55 @@ class CurrentWeather extends WeatherDisplay {
this.setStatus(STATUS.loaded);
}
- async drawCanvas () {
- super.drawCanvas();
+ // format the data for use outside this function
+ parseData() {
+ if (!this.data) return false;
+ const data = {};
const observations = this.data.features[0].properties;
// values from api are provided in metric
- let Temperature = Math.round(observations.temperature.value);
- let DewPoint = Math.round(observations.dewpoint.value);
- let Ceiling = Math.round(observations.cloudLayers[0].base.value);
- let CeilingUnit = 'm.';
- let Visibility = Math.round(observations.visibility.value/1000);
- let VisibilityUnit = ' km.';
- let WindSpeed = Math.round(observations.windSpeed.value);
- const WindDirection = utils.calc.directionToNSEW(observations.windDirection.value);
- let Pressure = Math.round(observations.barometricPressure.value);
- let HeatIndex = Math.round(observations.heatIndex.value);
- let WindChill = Math.round(observations.windChill.value);
- let WindGust = Math.round(observations.windGust.value);
- let Humidity = Math.round(observations.relativeHumidity.value);
- const Icon = icons.getWeatherIconFromIconLink(observations.icon);
- let PressureDirection = '';
- const TextConditions = observations.textDescription;
+ data.observations = observations;
+ data.Temperature = Math.round(observations.temperature.value);
+ data.DewPoint = Math.round(observations.dewpoint.value);
+ data.Ceiling = Math.round(observations.cloudLayers[0].base.value);
+ data.CeilingUnit = 'm.';
+ data.Visibility = Math.round(observations.visibility.value/1000);
+ data.VisibilityUnit = ' km.';
+ data.WindSpeed = Math.round(observations.windSpeed.value);
+ data.WindDirection = utils.calc.directionToNSEW(observations.windDirection.value);
+ data.Pressure = Math.round(observations.barometricPressure.value);
+ data.HeatIndex = Math.round(observations.heatIndex.value);
+ data.WindChill = Math.round(observations.windChill.value);
+ data.WindGust = Math.round(observations.windGust.value);
+ data.Humidity = Math.round(observations.relativeHumidity.value);
+ data.Icon = icons.getWeatherIconFromIconLink(observations.icon);
+ data.PressureDirection = '';
+ data.TextConditions = observations.textDescription;
// difference since last measurement (pascals, looking for difference of more than 150)
const pressureDiff = (observations.barometricPressure.value - this.data.features[1].properties.barometricPressure.value);
- if (pressureDiff > 150) PressureDirection = 'R';
- if (pressureDiff < -150) PressureDirection = 'F';
+ if (pressureDiff > 150) data.PressureDirection = 'R';
+ if (pressureDiff < -150) data.PressureDirection = 'F';
if (navigation.units() === UNITS.english) {
- Temperature = utils.units.celsiusToFahrenheit(Temperature);
- DewPoint = utils.units.celsiusToFahrenheit(DewPoint);
- Ceiling = Math.round(utils.units.metersToFeet(Ceiling)/100)*100;
- CeilingUnit = 'ft.';
- Visibility = utils.units.kilometersToMiles(observations.visibility.value/1000);
- VisibilityUnit = ' mi.';
- WindSpeed = utils.units.kphToMph(WindSpeed);
- Pressure = utils.units.pascalToInHg(Pressure);
- HeatIndex = utils.units.celsiusToFahrenheit(HeatIndex);
- WindChill = utils.units.celsiusToFahrenheit(WindChill);
- WindGust = utils.units.kphToMph(WindGust);
+ data.Temperature = utils.units.celsiusToFahrenheit(data.Temperature);
+ data.DewPoint = utils.units.celsiusToFahrenheit(data.DewPoint);
+ data.Ceiling = Math.round(utils.units.metersToFeet(data.Ceiling)/100)*100;
+ data.CeilingUnit = 'ft.';
+ data.Visibility = utils.units.kilometersToMiles(observations.visibility.value/1000);
+ data.VisibilityUnit = ' mi.';
+ data.WindSpeed = utils.units.kphToMph(data.WindSpeed);
+ data.Pressure = utils.units.pascalToInHg(data.Pressure);
+ data.HeatIndex = utils.units.celsiusToFahrenheit(data.HeatIndex);
+ data.WindChill = utils.units.celsiusToFahrenheit(data.WindChill);
+ data.WindGust = utils.units.kphToMph(data.WindGust);
}
+ return data;
+ }
+
+ async drawCanvas () {
+ super.drawCanvas();
+ // parse each time to deal with a change in units if necessary
+ const data = this.parseData();
this.context.drawImage(await this.backgroundImage, 0, 0);
draw.horizontalGradientSingle(this.context, 0, 30, 500, 90, draw.topColor1, draw.topColor2);
@@ -98,37 +108,37 @@ class CurrentWeather extends WeatherDisplay {
draw.titleText(this.context, 'Current', 'Conditions');
- draw.text(this.context, 'Star4000 Large', '24pt', '#FFFFFF', 170, 135, Temperature + String.fromCharCode(176), 2);
+ draw.text(this.context, 'Star4000 Large', '24pt', '#FFFFFF', 170, 135, data.Temperature + String.fromCharCode(176), 2);
- let Conditions = observations.textDescription;
- if (TextConditions.length > 15) {
+ let Conditions = data.observations.textDescription;
+ if (Conditions.length > 15) {
Conditions = this.shortConditions(Conditions);
}
draw.text(this.context, 'Star4000 Extended', '24pt', '#FFFFFF', 195, 170, Conditions, 2, 'center');
draw.text(this.context, 'Star4000 Extended', '24pt', '#FFFFFF', 80, 330, 'Wind:', 2);
- draw.text(this.context, 'Star4000 Extended', '24pt', '#FFFFFF', 300, 330, WindDirection + ' ' + WindSpeed, 2, 'right');
+ draw.text(this.context, 'Star4000 Extended', '24pt', '#FFFFFF', 300, 330, data.WindDirection + ' ' + data.WindSpeed, 2, 'right');
- if (WindGust) draw.text(this.context, 'Star4000 Extended', '24pt', '#FFFFFF', 80, 375, 'Gusts to ' + WindGust, 2);
+ if (data.WindGust) draw.text(this.context, 'Star4000 Extended', '24pt', '#FFFFFF', 80, 375, 'Gusts to ' + data.WindGust, 2);
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFF00', 315, 120, this.data.station.properties.name.substr(0, 20), 2);
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 165, 'Humidity:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 165, Humidity + '%', 2, 'right');
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 165, data.Humidity + '%', 2, 'right');
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 205, 'Dewpoint:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 205, DewPoint + String.fromCharCode(176), 2, 'right');
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 205, data.DewPoint + String.fromCharCode(176), 2, 'right');
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 245, 'Ceiling:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 245, (Ceiling === '' ? 'Unlimited' : Ceiling + CeilingUnit), 2, 'right');
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 245, (data.Ceiling === '' ? 'Unlimited' : data.Ceiling + data.CeilingUnit), 2, 'right');
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 285, 'Visibility:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 285, Visibility + VisibilityUnit, 2, 'right');
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 285, data.Visibility + data.VisibilityUnit, 2, 'right');
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 325, 'Pressure:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 535, 325, Pressure, 2, 'right');
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 535, 325, data.Pressure, 2, 'right');
- switch (PressureDirection) {
+ switch (data.PressureDirection) {
case 'R':
// Shadow
draw.triangle(this.context, '#000000', 552, 302, 542, 312, 562, 312);
@@ -158,17 +168,17 @@ class CurrentWeather extends WeatherDisplay {
default:
}
- if (observations.heatIndex.value && HeatIndex !== Temperature) {
+ if (data.observations.heatIndex.value && data.HeatIndex !== data.Temperature) {
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 365, 'Heat Index:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 365, HeatIndex + String.fromCharCode(176), 2, 'right');
- } else if (observations.windChill.value && WindChill !== '' && WindChill < Temperature) {
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 365, data.HeatIndex + String.fromCharCode(176), 2, 'right');
+ } else if (data.observations.windChill.value && data.WindChill !== '' && data.WindChill < data.Temperature) {
draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 340, 365, 'Wind Chill:', 2);
- draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 365, WindChill + String.fromCharCode(176), 2, 'right');
+ draw.text(this.context, 'Star4000 Large', 'bold 16pt', '#FFFFFF', 560, 365, data.WindChill + String.fromCharCode(176), 2, 'right');
}
// get main icon
this.gifs.push(await utils.image.superGifAsync({
- src: Icon,
+ src: data.Icon,
auto_play: true,
canvas: this.canvas,
x: 140,
@@ -179,6 +189,11 @@ class CurrentWeather extends WeatherDisplay {
this.finishDraw();
}
+ // return the latest gathered information if available
+ getCurrentWeather() {
+ return this.parseData();
+ }
+
shortConditions(condition) {
condition = condition.replace(/Light/g, 'L');
condition = condition.replace(/Heavy/g, 'H');
diff --git a/server/scripts/modules/currentweatherscroll.js b/server/scripts/modules/currentweatherscroll.js
new file mode 100644
index 0000000..c0f7317
--- /dev/null
+++ b/server/scripts/modules/currentweatherscroll.js
@@ -0,0 +1,96 @@
+'use strict';
+
+/* globals draw, navigation */
+
+// eslint-disable-next-line no-unused-vars
+const currentWeatherScroll = (() => {
+ // local variables
+ let context; // currently active context
+ let blankDrawArea; // original state of context
+ let station;
+ let interval;
+ let screenIndex = 0;
+
+ // start drawing conditions
+ // reset starts from the first item in the text scroll list
+ const start = (_context) => {
+ // see if there is a context available
+ if (!_context) return;
+ // store see if the context is new
+ if (_context !== context) {
+ // clean the outgoing context
+ cleanLastContext();
+ // store the new blank context
+ blankDrawArea = _context.getImageData(0, 405, 640, 75);
+ }
+ // store the context locally
+ context = _context;
+
+ // set up the interval if needed
+ if (!interval) {
+ interval = setInterval(incrementInterval, 700);
+ }
+
+ // draw the data
+ drawScreen();
+
+ };
+
+ const stop = (reset) => {
+ cleanLastContext();
+ if (interval) interval = clearInterval(interval);
+ if (reset) screenIndex = 0;
+ };
+
+ const cleanLastContext = () => {
+ if (blankDrawArea) context.putImageData(blankDrawArea, 0, 405);
+ blankDrawArea = undefined;
+ context = undefined;
+ };
+
+ // increment interval, roll over
+ const incrementInterval = () => {
+ screenIndex = (screenIndex+1)%2;
+ // draw new text
+ drawScreen();
+ };
+
+ const drawScreen = () => {
+ // get the conditions
+ const data = navigation.getCurrentWeather();
+
+ // nothing to do if there's no data yet
+ if (!data) return;
+ if (!station) return;
+
+ // clean up any old text
+ context.putImageData(blankDrawArea, 0, 405);
+
+ switch (screenIndex) {
+ case 0:
+ default:
+ drawCondition(`Conditions at ${station.name.substr(0,20)}`);
+ break;
+ case 1:
+ drawCondition(`Page 2`);
+ break;
+ }
+ };
+
+ // internal draw function with preset parameters
+ const drawCondition = (text) => {
+ draw.text(context, 'Star4000', '24pt', '#ffffff', 70, 430, text, 2);
+ };
+
+ // store the latest station data
+ const setStation = (weatherParameters) => {
+ station = weatherParameters.stations[0].properties;
+ };
+
+ // return the api
+ return {
+ start,
+ stop,
+ setStation,
+ };
+})();
\ No newline at end of file
diff --git a/server/scripts/modules/navigation.js b/server/scripts/modules/navigation.js
index 71ac900..7dc27e5 100644
--- a/server/scripts/modules/navigation.js
+++ b/server/scripts/modules/navigation.js
@@ -1,7 +1,7 @@
'use strict';
// navigation handles progress, next/previous and initial load messages from the parent frame
/* globals index, utils, _StationInfo, STATUS */
-/* globals CurrentWeather, LatestObservations, TravelForecast, RegionalForecast, LocalForecast, ExtendedForecast, Almanac, Radar, Progress */
+/* globals CurrentWeather, LatestObservations, TravelForecast, RegionalForecast, LocalForecast, ExtendedForecast, Almanac, Radar, Progress, currentWeatherScroll */
document.addEventListener('DOMContentLoaded', () => {
navigation.init();
@@ -19,6 +19,9 @@ const navigation = (() => {
let playing = false;
let progress;
+ // current conditions are made available from the display below
+ let currentWeather;
+
const init = async () => {
// nothing to do
};
@@ -94,8 +97,9 @@ const navigation = (() => {
// start loading canvases if necessary
if (displays.length === 0) {
+ currentWeather = new CurrentWeather(0,'currentWeather');
displays = [
- new CurrentWeather(0,'currentWeather'),
+ currentWeather,
new LatestObservations(1, 'latestObservations'),
new TravelForecast(2, 'travelForecast', false), // not active by default
new RegionalForecast(3, 'regionalForecast'),
@@ -107,6 +111,8 @@ const navigation = (() => {
}
// call for new data on each display
displays.forEach(display => display.getData(weatherParameters));
+ // pass the information to the bottom scroll
+ currentWeatherScroll.setStation(weatherParameters);
// GetMonthPrecipitation(this.weatherParameters);
// GetAirQuality3(this.weatherParameters);
@@ -256,6 +262,12 @@ const navigation = (() => {
// return the specificed display
const getDisplay = (index) => displays[index];
+ // get current conditions
+ const getCurrentWeather = () => {
+ if (!currentWeather) return false;
+ return currentWeather.getCurrentWeather();
+ };
+
return {
init,
message,
@@ -265,5 +277,6 @@ const navigation = (() => {
displayNavMessage,
msg,
getDisplay,
+ getCurrentWeather,
};
})();
\ No newline at end of file
diff --git a/server/scripts/modules/regionalforecast.js b/server/scripts/modules/regionalforecast.js
index 0dfef03..44b27e6 100644
--- a/server/scripts/modules/regionalforecast.js
+++ b/server/scripts/modules/regionalforecast.js
@@ -386,7 +386,6 @@ class RegionalForecast extends WeatherDisplay {
}));
this.finishDraw();
- this.setStatus(STATUS.loaded);
}
}
\ No newline at end of file
diff --git a/server/scripts/modules/utilities.js b/server/scripts/modules/utilities.js
index 765e5b5..213ca30 100644
--- a/server/scripts/modules/utilities.js
+++ b/server/scripts/modules/utilities.js
@@ -56,7 +56,6 @@ const utils = (() => {
const img = new Image();
img.scr = src;
cachedImages.push(src);
- console.log(cachedImages);
return true;
};
diff --git a/server/scripts/modules/weatherdisplay.js b/server/scripts/modules/weatherdisplay.js
index 25ec23a..c433637 100644
--- a/server/scripts/modules/weatherdisplay.js
+++ b/server/scripts/modules/weatherdisplay.js
@@ -1,6 +1,6 @@
// base weather display class
-/* globals navigation, utils, draw, UNITS, luxon */
+/* globals navigation, utils, draw, UNITS, luxon, currentWeatherScroll */
const STATUS = {
loading: Symbol('loading'),
@@ -150,6 +150,10 @@ class WeatherDisplay {
if (this.elemId === 'almanac') OkToDrawNoaaImage = false;
if (this.elemId === 'travelForecast') OkToDrawNoaaImage = false;
if (this.elemId === 'regionalForecast') OkToDrawNoaaImage = false;
+ if (this.elemId === 'progress') {
+ OkToDrawCurrentConditions = false;
+ OkToDrawNoaaImage = false;
+ }
if (this.elemId === 'radar') {
OkToDrawCurrentConditions = false;
OkToDrawCurrentDateTime = false;
@@ -171,8 +175,12 @@ class WeatherDisplay {
}
if (OkToDrawLogoImage) this.drawLogoImage();
if (OkToDrawNoaaImage) this.drawNoaaImage();
- // TODO: fix current conditions scroll
- // if (OkToDrawCurrentConditions) DrawCurrentConditions(WeatherParameters, this.context);
+ if (OkToDrawCurrentConditions) {
+ currentWeatherScroll.start(this.context);
+ } else {
+ // cause a reset if the progress screen is displayed
+ currentWeatherScroll.stop(this.elemId === 'progress');
+ }
// TODO: add custom scroll text
// if (OkToDrawCustomScrollText) DrawCustomScrollText(WeatherParameters, context);
}
diff --git a/server/scripts/twc3.js b/server/scripts/twc3.js
index 34261f5..c6e174c 100644
--- a/server/scripts/twc3.js
+++ b/server/scripts/twc3.js
@@ -1,5 +1,4 @@
-/* globals _StationInfo, luxon, _RegionalCities, utils, icons, _TravelCities, SunCalc */
-const _DayShortNames = { 'Sunday': 'Sun', 'Monday': 'Mon', 'Tuesday': 'Tue', 'Wednesday': 'Wed', 'Thursday': 'Thu', 'Friday': 'Fri', 'Saturday': 'Sat' };
+/* globals luxon, _TravelCities */
var canvasRegionalObservations;
@@ -28,9 +27,7 @@ var canvasAirQuality;
var canvasTravelForecast;
var divOutlookTemp;
-var cnvOutlookTemp;
var divOutlookPrcp;
-var cnvOutlookPrcp;
var canvasLatestObservations;
@@ -83,16 +80,6 @@ const GetMonthPrecipitation = async (WeatherParameters) => {
};
-Date.prototype.stdTimezoneOffset = function () {
- var jan = new Date(this.getFullYear(), 0, 1);
- var jul = new Date(this.getFullYear(), 6, 1);
- return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
-};
-
-Date.prototype.dst = function () {
- return this.getTimezoneOffset() < this.stdTimezoneOffset();
-};
-
var GetWeatherHazards3 = function (WeatherParameters) {
var ZoneId = WeatherParameters.ZoneId;
var HazardUrls = [];
@@ -260,53 +247,6 @@ $(() => {
});
});
-var NavigateMenu = function () {
- if (_IsPlaying) {
- NavigatePlayToggle();
- }
- Navigate(0);
- _PlayMs = 0;
-};
-
-
-
-$.fn.scrollIntoView = function () {
- const $self = this;
- const OkToFadeOut = true;
-
- _WeatherParameters.WeatherCanvases.forEach($WeatherCanvas => {
-
- if (!$WeatherCanvas.is($self)) {
- if ($WeatherCanvas.is(':visible')) {
- $WeatherCanvas.css('z-index', '9999');
- if (!OkToFadeOut) {
- $WeatherCanvas.hide();
- } else {
- $WeatherCanvas.fadeOut({
- progress: () => {
- UpdateWeatherCanvas(_WeatherParameters, $WeatherCanvas);
- UpdateWeatherCanvas(_WeatherParameters, $self);
- },
- });
- }
- }
- } else {
- if (!$WeatherCanvas.is(':visible')) {
- $WeatherCanvas.css('z-index', '');
- $WeatherCanvas.show();
- }
- $WeatherCanvas.stop();
- $WeatherCanvas.css('opacity', '');
- UpdateWeatherCanvas(_WeatherParameters, $WeatherCanvas);
- }
- });
-
- _RefreshGifs = true;
- window.setTimeout(function () { _RefreshGifs = false; }, 200);
-
-};
-
-
var canvasProgress_mousemove = function (e) {
canvasProgress.css('cursor', '');
@@ -517,7 +457,7 @@ const WeatherMonthlyTotalsParser = (text) => {
-const Progress = function (e) {
+
const DrawCustomScrollText = (WeatherParameters, context) => {
const font = 'Star4000';
const size = '24pt';
@@ -554,3 +494,116 @@ const AssignScrollText = (e) => {
_UpdateWeatherCurrentConditionCounterMs = 0;
};
+var DrawCurrentConditions = function (WeatherParameters, context) {
+ var Humidity;
+ var DewPoint;
+ var Temperature;
+ var TemperatureUnit;
+ var HeatIndex;
+ var WindChill;
+ var Pressure;
+ var PressureDirection;
+ var WindSpeed;
+ var WindDirection;
+ var WindGust;
+ var WindUnit;
+ var Visibility;
+ var VisibilityUnit;
+ var Ceiling;
+ var CeilingUnit;
+ var PrecipitationTotal;
+ var PrecipitationTotalUnit;
+
+ var text;
+
+ if (WeatherParameters.Progress.GetTotalPercentage() != 100) {
+ return;
+ }
+
+ // Clear the date and time area.
+ context.drawImage(canvasBackGroundCurrentConditions[0], 0, 0, 640, 75, 0, 405, 640, 75);
+
+ var WeatherCurrentConditions = WeatherParameters.WeatherCurrentConditions;
+ var WeatherMonthlyTotals = WeatherParameters.WeatherMonthlyTotals;
+
+
+ if (_UpdateWeatherCurrentConditionCounterMs >= 4000) {
+ _UpdateWeatherCurrentConditionCounterMs = 0;
+ _UpdateWeatherCurrentConditionType++;
+ if (_UpdateWeatherCurrentConditionType > CurrentConditionTypes.MonthPrecipitation) {
+ _UpdateWeatherCurrentConditionType = CurrentConditionTypes.Title;
+ }
+ }
+
+ switch(_UpdateWeatherCurrentConditionType) {
+ case CurrentConditionTypes.Title:
+ // mjb 06/01/19 text = "Conditions at " + WeatherCurrentConditions.StationName;
+ text = 'Conditions at ' + WeatherCurrentConditions.StationName.substr(0, 20); // mjb 06/01/19
+ break;
+ case CurrentConditionTypes.Conditions:
+ text = WeatherCurrentConditions.Conditions;
+ break;
+ case CurrentConditionTypes.Temperature:
+ text = 'Temp: ' + Temperature + String.fromCharCode(176) + TemperatureUnit;
+ if (HeatIndex != Temperature) {
+ text += ' ';
+ text += 'Heat Index: ' + HeatIndex + String.fromCharCode(176) + TemperatureUnit;
+ } else if (WindChill != '' && WindChill < Temperature) {
+ text += ' ';
+ text += 'Wind Chill: ' + WindChill + String.fromCharCode(176) + TemperatureUnit;
+ }
+ break;
+ case CurrentConditionTypes.HumidityDewpoint:
+ text = 'Humidity: ' + Humidity + '%';
+ text += ' ';
+ text += 'Dewpoint: ' + DewPoint + String.fromCharCode(176) + TemperatureUnit;
+ break;
+ case CurrentConditionTypes.BarometricPressure:
+ text = 'Barometric Pressure: ' + Pressure + ' ' + PressureDirection;
+ break;
+ case CurrentConditionTypes.Wind:
+ if (WindSpeed > 0) {
+ text = 'Wind: ' + WindDirection + ' ' + WindSpeed + WindUnit;
+ } else if (WindSpeed == 'NA') {
+ text = 'Wind: NA';
+ } else {
+ text = 'Wind: Calm';
+ }
+ if (WindGust != '') {
+ text += ' ';
+ text += 'Gusts to ' + WindGust;
+ }
+ break;
+ case CurrentConditionTypes.VisibilityCeiling:
+ text = 'Visib: ' + parseInt(Visibility).toString() + VisibilityUnit;
+ text += ' ';
+ text += 'Ceiling: ' + (Ceiling == '' ? 'Unlimited' : Ceiling + CeilingUnit);
+ break;
+ case CurrentConditionTypes.MonthPrecipitation:
+ if (PrecipitationTotal.toString() == '') {
+ _UpdateWeatherCurrentConditionCounterMs += 4000;
+ DrawCurrentConditions(WeatherParameters, context);
+ return;
+ }
+
+ // mjb 10/02/19 Begin
+ //text = WeatherMonthlyTotals.MonthName + " Precipitation: " + PrecipitationTotal.toString() + PrecipitationTotalUnit;
+
+ if (PrecipitationTotal.toString() == 'T') {
+ text = WeatherMonthlyTotals.MonthName + ' Precipitation: Trace';
+ } else {
+ text = WeatherMonthlyTotals.MonthName + ' Precipitation: ' + PrecipitationTotal.toString() + PrecipitationTotalUnit;
+ }
+
+ // mjb 10/02/19 End
+ break;
+ default:
+ }
+
+ // Draw the current condition.
+ DrawText(context, font, size, color, x, y, text, shadow);
+
+ //_UpdateWeatherCurrentConditionCounterMs += _UpdateWeatherUpdateMs;
+ //console.log(_UpdateWeatherUpdateMs);
+};
+
diff --git a/views/index.ejs b/views/index.ejs
index 105110b..29c01f6 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -46,6 +46,7 @@
+
diff --git a/ws4kp.code-workspace b/ws4kp.code-workspace
index 869deee..02ba744 100644
--- a/ws4kp.code-workspace
+++ b/ws4kp.code-workspace
@@ -11,6 +11,7 @@
"**/*.code-search": true,
"dist/**": true,
"**/*.min.js": true,
+ "**/vendor": true,
},
"cSpell.enabled": true,
"cSpell.words": [
@@ -23,5 +24,15 @@
"devbridge",
"nosleep"
],
+ "cSpell.ignorePaths": [
+ "**/package-lock.json",
+ "**/node_modules/**",
+ "**/vscode-extension/**",
+ "**/.git/objects/**",
+ ".vscode",
+ ".vscode-insiders",
+ "**/vendor/auto/**",
+ "**/twc3.js",
+ ],
},
}
\ No newline at end of file