// this function calls the Ajax update and draws the canvas elements
// it is to be executed repeatedly through the use of the setInterval method
function update() {
// update data from XML file
ajaxUpdateValues();
// draw gauges
steamPressGauge.setValueAnimated(steamPress);
steamTempGauge.setValueAnimated(steamTemp);
mashVolGauge.setValueAnimated(mashVol);
boilVolGauge.setValueAnimated(boilVol);
mashTempGauge.setValueAnimated(mashTemp);
spargeTempGauge.setValueAnimated(spargeTemp);
boilTempGauge.setValueAnimated(boilTemp);
}
// make the script execute at a set interval (in milliseconds)
function init() {
// Define section(s)
var sections = Array(steelseries.Section(10, 12, "rgba(0, 220, 0, 0.3)"),
steelseries.Section(12, 15, "rgba(220, 220, 0, 0.3)"),
steelseries.Section(15, 20, "rgba(220, 0, 0, 0.3)"));
// Define area(s)
var areas = Array(steelseries.Section(15, 20, "rgba(220, 0, 0, 0.3)"));
// Initialize gauge
steamPressGauge = new steelseries.Radial("steamPress", {
gaugeType: steelseries.GaugeType.TYPE4,
minValue: 0,
maxValue: 20,
threshold: 12,
section: sections,
area: areas,
titleString: "Steam Pressure",
unitString: "psi",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
// Define section(s)
sections = Array(steelseries.Section(212, 245, "rgba(0, 220, 0, 0.3)"),
steelseries.Section(245, 260, "rgba(220, 0, 0, 0.3)"));
// Define area(s)
areas = Array(steelseries.Section(245, 260, "rgba(220, 0, 0, 0.3)"));
// Initialize gauge
steamTempGauge = new steelseries.Radial("steamTemp", {
gaugeType: steelseries.GaugeType.TYPE3,
minValue: 100,
maxValue: 260,
threshold: 240,
section: sections,
area: areas,
titleString: "Steam Temp",
unitString: "°F",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
// Initialize gauge
mashVolGauge = new steelseries.Radial("mashVol", {
gaugeType: steelseries.GaugeType.TYPE4,
minValue: 0,
maxValue: 24,
threshold: 15,
//section: sections,
//area: areas,
titleString: "Mash Volume",
unitString: "Gal",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
// Initialize gauge
boilVolGauge = new steelseries.Radial("boilVol", {
gaugeType: steelseries.GaugeType.TYPE4,
minValue: 0,
maxValue: 24,
threshold: 15,
//section: sections,
//area: areas,
titleString: "Boil Volume",
unitString: "Gal",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
// Define section(s)
sections = Array(steelseries.Section(140, 160, "rgba(0, 220, 0, 0.3)"),
steelseries.Section(160, 180, "rgba(220, 220, 0, 0.3)"),
steelseries.Section(180, 190, "rgba(220, 0, 0, 0.3)"));
// Define area(s)
areas = Array(steelseries.Section(180, 190, "rgba(220, 0, 0, 0.3)"));
// Initialize gauge
mashTempGauge = new steelseries.Radial("mashTemp", {
gaugeType: steelseries.GaugeType.TYPE3,
minValue: 100,
maxValue: 190,
threshold: 152,
section: sections,
area: areas,
titleString: "Mash Temp",
unitString: "°F",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
// Define section(s)
sections = Array(steelseries.Section(160, 180, "rgba(0, 220, 0, 0.3)"),
steelseries.Section(180, 190, "rgba(220, 0, 0, 0.3)"));
// Define area(s)
areas = Array(steelseries.Section(180, 190, "rgba(220, 0, 0, 0.3)"));
// Initialize gauge
spargeTempGauge = new steelseries.Radial("spargeTemp", {
gaugeType: steelseries.GaugeType.TYPE3,
minValue: 100,
maxValue: 190,
threshold: 175,
section: sections,
area: areas,
titleString: "Sparge Temp",
unitString: "°F",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
// Define area(s)
areas = Array(steelseries.Section(210, 214, "rgba(0, 220, 0, 0.3)"));
// Initialize gauge
boilTempGauge = new steelseries.Radial("boilTemp", {
gaugeType: steelseries.GaugeType.TYPE3,
minValue: 100,
maxValue: 220,
threshold: 212,
//section: sections,
area: areas,
titleString: "Boil Temp",
unitString: "°F",
pointerType: steelseries.PointerType.TYPE1,
frameDesign: steelseries.FrameDesign.BLACK_METAL,
foregroundType: steelseries.ForegroundType.TYPE3,
backgroundColor: steelseries.BackgroundColor.CARBON,
ledVisible: false
});
setInterval("update();", 1000);
//setInterval("updateImage();", 3000);
}
</script>