www/js/mon_fermenter.js

changeset 182
58618d93c0fb
parent 180
a5aa3502310c
child 183
a810539dc218
--- a/www/js/mon_fermenter.js	Mon Jan 07 16:46:43 2019 +0100
+++ b/www/js/mon_fermenter.js	Mon Jan 07 22:35:32 2019 +0100
@@ -25,13 +25,14 @@
 
 	var	bname = '';
 	var	bcode = '';
+	var	yl = 12;	// Normal yeast temp range
+	var	yh = 24;
 
 	var gaugeoptions = {
-		min: -5, max: 35, width: 275, height: 275,
-		ranges: [{ startValue: -5, endValue:  0, style: { fill: '#3399FF', stroke: '#3399FF' }, endWidth: 10, startWidth: 10 },
-			 { startValue:  0, endValue: 16, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 },
-			 { startValue: 16, endValue: 24, style: { fill: '#FCA76A', stroke: '#FCA76A' }, endWidth: 10, startWidth: 10 },
-			 { startValue: 24, endValue: 35, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }],
+		min: 0, max: 40, width: 375, height: 375,
+		ranges: [{ startValue:  0, endValue: yl, style: { fill: '#3399FF', stroke: '#3399FF' }, endWidth: 10, startWidth: 10 },
+			 { startValue: yl, endValue: yh, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 },
+			 { startValue: yh, endValue: 40, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }],
 		ticksMinor: { interval: 1, size: '5%' },
 		ticksMajor: { interval: 5, size: '9%' },
 		labels: { interval: 5 },
@@ -41,9 +42,10 @@
 		animationDuration: 1200
 	};
 	var gaugeSmalloptions = {
-		min: -20, max: 25, width: 150, height: 150,
-		ranges: [{ startValue: -20, endValue:  0, startWidth: 5, endWidth: 5, style: { fill: '#3399FF', stroke: '#3399FF' }},
-			 { startValue:   0, endValue: 25, startWidth: 5, endWidth: 5, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }}],
+		min: -15, max: 25, width: 190, height: 190,
+		ranges: [{ startValue: -15, endValue:  0, startWidth: 5, endWidth: 5, style: { fill: '#3399FF', stroke: '#3399FF' }},
+		         { startValue:   0, endValue: 10, startWidth: 5, endWidth: 5, style: { fill: '#00CC33', stroke: '#00CC33' }},
+			 { startValue:  10, endValue: 25, startWidth: 5, endWidth: 5, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }}],
 		ticksMinor: { interval: 1, size: '5%' },
 		ticksMajor: { interval: 5, size: '9%' },
 		labels: { interval: 5 },
@@ -108,8 +110,7 @@
 		loadComplete: function (records) {
 			var record = dataAdapter.records[0];
 			var oline = (record.online) ? "On-line" : "Off-line";
-			var html  = "<div id='fermenter_table'>";
-			    html += "<table style='width: 100%; padding: 10px;'>";
+			var html  = "<table style='width: 100%; padding: 10px;'>";
 			    html += "<tr><th colspan=2>Klimaatkast overzicht</th></tr>";
 			    html += "<tr><td>Uuid</td><td>" + record.uuid + "</td></tr>";
 			    html += "<tr><td>Systeem</td><td>" + record.node +  "/" + record.alias + " " + oline + "</td></tr>";
@@ -117,11 +118,43 @@
 			    html += "<tr><td>Werking</td><td>" + record.mode + "</td></tr>";
 			    html += "<tr><td>Fase</td><td>" + record.stage + "</td></tr>"
 			    html += "</<table>";
-			    html += "</div>";
-			$("#ContentPanel").html(html);
+			$("#fermenter_info").html(html);
 			bcode = record.beercode;
 			bname = record.beername;
 
+			if (record.online && (record.mode != "OFF")) {
+				$("#fermentor_powerled").html('<div class="LEDblue_on"></div>Power');
+			} else {
+				$("#fermentor_powerled").html('<div class="LEDblue_off"></div>Power');
+			}
+			if (record.online && (record.alarm != "0")) {
+				$("#fermentor_alarmled").html('<div class="LEDred_on"></div>Alarm');
+			} else {
+				$("#fermentor_alarmled").html('<div class="LEDred_off"></div>Alarm');
+			}
+
+			$("#target_lo").html(record.setpoint_low.toFixed(1));
+			$("#target_hi").html(record.setpoint_high.toFixed(1));
+			$("#load_air").html(record.air_temperature.toFixed(3));
+			$("#load_beer").html(record.beer_temperature.toFixed(3));
+
+			if (record.online && (record.heater_state != "0")) {
+				$("#fermentor_led1").html('<div class="LEDgreen_on"></div>Heat');
+			} else {
+				$("#fermentor_led1").html('<div class="LEDgreen_off"></div>Heat');
+			}
+			if (record.online && (record.cooler_state != "0")) {
+				$("#fermentor_led2").html('<div class="LEDgreen_on"></div>Cool');
+			} else {
+				$("#fermentor_led2").html('<div class="LEDgreen_off"></div>Cool');
+			}
+			if (record.online && (record.fan_state != "0")) {
+				$("#fermentor_led3").html('<div class="LEDgreen_on"></div>Fan');
+			} else {
+				$("#fermentor_led3").html('<div class="LEDgreen_off"></div>Fan');
+			}
+
+
 			$('#gaugeContainer_air').jqxGauge({ value: record.air_temperature });
 			if (record.online && (record.air_state == "OK")) {
 				$("#gaugeContainer_air").jqxGauge({ disabled: false });
@@ -140,12 +173,6 @@
 			} else {
 				$("#gaugeContainer_chiller").jqxGauge({ disabled: true });
 			}
-
-			html  = "<div>SpH <span class='temperature NUM'>" + record.setpoint_high.toFixed(1) + "</span></div>";
-			html += "<div>SpL <span class='temperature NUM'>" + record.setpoint_low.toFixed(1) + "</span></div>";
-			html += "<div>Air <span class='temperature NUM'>" + record.air_temperature.toFixed(3) + "</span></div>";
-			html += "<div>Beer <span class='temperature NUM'>" + record.beer_temperature.toFixed(3) + "</span></div>";
-			$("#fermenter_tempdigits").html(html);
 		}
 	});
 

mercurial