Privacywonk / MMM-Surf

MagicMirror module that pulls in tide, water temp, and Magicseaweed data to show an at-a-glance surf report for your favorite spot.
Other
5 stars 2 forks source link

Add color coding to Wind Directions #30

Closed Privacywonk closed 6 years ago

Privacywonk commented 6 years ago

As we define what winds the spot does will with in "spotWind" - we can easily pop those variables green on the display. However, we need a way to indicate bad winds and so-so winds:

Added to config stanza in MMM-Surf.js five new variables: ` spotCoast: "" //configurable variable - what coast the spot sits on values are "N, E, S, W"

    eastSpotBadWinds: ["NNE", "NE", "ENE", "E", "ESE", "SE", "SSE"],

    westSpotBadWinds: ["SSW", "SW", "WSW", "W", "WNS", "NW", "NNW"],

    northSpotBadWinds: ["WNW", "NW", "NNW", "N", "NNE", "NE", "ENE"],

    southSpotBadWinds: ["ESE", "SE", "SSW", "S", "SSE", "SE", "WSW"],

` *badWind variables are directionally "on shore" based on spotCoast.

Further in MMM-Surf.js we step through the orientation of the coast (East coast example): if (this.config.spotCoast === "E") { if (this.config.eastSpotBadWinds.indexOf(this.magicforecast12hrs[f].windCompassDirection) != -1) { windInfoCell.className = "wi wi-wind " + this.magicforecast12hrs[f].windDirection + " swellred"; } else { windInfoCell.className = "wi wi-wind " + this.magicforecast12hrs[f].windDirection + " swellorange"; } }