check for notifications and don't display if one is active

check for high / low speed out of range popups and only display one, block popping up of multiple notifications for the same event
This commit is contained in:
ntoff 2017-11-12 16:26:38 +10:00
parent 70d3e0803b
commit addd0ffa4b

View File

@ -40,17 +40,23 @@ $(function () {
self.control.fanSpeed(self.control.minFanSpeed()); self.control.fanSpeed(self.control.minFanSpeed());
var options = { var options = {
text: 'Fan speed increased to meet minimum requirement.', text: 'Fan speed increased to meet minimum requirement.',
addclass: 'fan_speed_notice_low',
} }
if ($(".fan_speed_notice_low").length <1) {
self.showNotify(self, options); self.showNotify(self, options);
} }
}
else if (self.control.fanSpeed() > self.control.maxFanSpeed()) { else if (self.control.fanSpeed() > self.control.maxFanSpeed()) {
console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is more than the maximum speed (" + self.control.maxFanSpeed() + "%), decreasing."); console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is more than the maximum speed (" + self.control.maxFanSpeed() + "%), decreasing.");
self.control.fanSpeed(self.control.maxFanSpeed()); self.control.fanSpeed(self.control.maxFanSpeed());
var options = { var options = {
text: 'Fan speed decreased to meet maximum requirement.', text: 'Fan speed decreased to meet maximum requirement.',
addclass: 'fan_speed_notice_high',
} }
if ($(".fan_speed_notice_high").length <1) {
self.showNotify(self, options); self.showNotify(self, options);
} }
}
}); });
//send gcode to set fan speed //send gcode to set fan speed