Wrap code within a closure function
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
( function() {
|
||||
|
||||
// Define regex filters to match against location
|
||||
var http = require( "http" ),
|
||||
filters = {
|
||||
@@ -186,6 +188,10 @@ function checkWeatherRestriction( adjustmentValue, weather ) {
|
||||
// adjustment method which is encoded to also carry the watering
|
||||
// restriction and therefore must be decoded
|
||||
exports.getWeather = function( req, res ) {
|
||||
|
||||
// The adjustment method is encoded by the OpenSprinkler firmware and must be
|
||||
// parsed. This allows the adjustment method and the restriction type to both
|
||||
// be saved in the same byte.
|
||||
var adjustmentMethod = req.params[0] & ~( 1 << 7 ),
|
||||
adjustmentOptions = req.query.wto,
|
||||
location = req.query.loc,
|
||||
@@ -268,4 +274,5 @@ exports.getWeather = function( req, res ) {
|
||||
} );
|
||||
}
|
||||
};
|
||||
} )();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user