# HG changeset patch # User Michiel Broek # Date 1570793911 -7200 # Node ID c09b67fd83237db49737a9a3cebe7f66b2b498a3 # Parent 42a0ab588a4fb61cb8f92faaf627832913637c1f Added CO2 meter units alarm led. diff -r 42a0ab588a4f -r c09b67fd8323 bmsd/bms.h --- a/bmsd/bms.h Fri Oct 11 11:44:37 2019 +0200 +++ b/bmsd/bms.h Fri Oct 11 13:38:31 2019 +0200 @@ -258,6 +258,7 @@ char *node; ///< Fixed node name bool online; ///< Online status char *mode; ///< Working mode + uint32_t alarm; ///< Alarm bits char *beercode; ///< Beer unique code char *beername; ///< Beer name in fermenter char *beeruuid; ///< Beer uuid in fermenter diff -r 42a0ab588a4f -r c09b67fd8323 bmsd/co2meters.c --- a/bmsd/co2meters.c Fri Oct 11 11:44:37 2019 +0200 +++ b/bmsd/co2meters.c Fri Oct 11 13:38:31 2019 +0200 @@ -95,6 +95,9 @@ } co2meter->mode = xstrcpy((char *)json_object_get_string(val)); } + if (json_object_object_get_ex(jobj, "alarm", &val)) { + co2meter->alarm = json_object_get_int(val); + } if (json_object_object_get_ex(jobj, "temperature", &sensor)) { if (json_object_object_get_ex(sensor, "address", &val)) { if (co2meter->temperature_address) diff -r 42a0ab588a4f -r c09b67fd8323 bmsd/mysql.c --- a/bmsd/mysql.c Fri Oct 11 11:44:37 2019 +0200 +++ b/bmsd/mysql.c Fri Oct 11 13:38:31 2019 +0200 @@ -606,10 +606,10 @@ char *query = malloc(2560); snprintf(query, 2559, - "INSERT INTO mon_co2meters SET uuid='%s', alias='%s', node='%s', online='%d', mode='%s', " \ + "INSERT INTO mon_co2meters SET uuid='%s', alias='%s', node='%s', online='%d', mode='%s', alarm='%d', " \ "temperature_address='%s', temperature_state='%s', temperature='%.3f', " \ "pressure_state='%s', pressure_channel='%d', pressure_voltage='%.3f', pressure_zero='%.3f', pressure_bar='%.3f'", - co2meter->uuid, co2meter->alias, co2meter->node, co2meter->online ? 1:0, co2meter->mode, + co2meter->uuid, co2meter->alias, co2meter->node, co2meter->online ? 1:0, co2meter->mode, co2meter->alarm, co2meter->temperature_address, co2meter->temperature_state, co2meter->temperature, co2meter->pressure_state, co2meter->pressure_channel, co2meter->pressure_voltage, co2meter->pressure_zero, co2meter->pressure_bar); @@ -626,11 +626,11 @@ char *query = malloc(2560); snprintf(query, 2559, - "UPDATE mon_co2meters SET online='%d', mode='%s', " \ + "UPDATE mon_co2meters SET online='%d', mode='%s', alarm='%d', " \ "temperature_address='%s', temperature_state='%s', temperature='%.3f', " \ "pressure_state='%s', pressure_channel='%d', pressure_voltage='%.3f', pressure_zero='%.3f', pressure_bar='%.3f' " \ "WHERE uuid='%s'", - co2meter->online ? 1:0, co2meter->mode, + co2meter->online ? 1:0, co2meter->mode, co2meter->alarm, co2meter->temperature_address, co2meter->temperature_state, co2meter->temperature, co2meter->pressure_state, co2meter->pressure_channel, co2meter->pressure_voltage, co2meter->pressure_zero, co2meter->pressure_bar, co2meter->uuid); diff -r 42a0ab588a4f -r c09b67fd8323 www/css/style-min.css --- a/www/css/style-min.css Fri Oct 11 11:44:37 2019 +0200 +++ b/www/css/style-min.css Fri Oct 11 13:38:31 2019 +0200 @@ -1,1 +1,1 @@ -body{background:#ccc;font-family:Verdana,Arial,sans-serif;margin:0}#MainPanel,#fermenter,#co2meter{width:1278px;height:628px;border:2px solid #4297d7;background:#252526;float:left;color:#eee}#water_totals{width:960px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#propagator{width:800px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#export_table,#about_table{width:960px;background:#353536;margin:150px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#node_table{width:600px;background:#353536;margin:50px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_table,#co2meter_table{width:960px;height:210px;background:#252526;margin:5px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.ebccolor{float:left;margin-left:10px;width:75px;height:23px;border:1px solid #59b4d4;border-radius:6px;moz-border-radius:6px;webkit-border-radius:6px;background:#212121}#fermenter_thermometers,#co2meter_meters{width:960px;height:390px;float:left;background-color:#252526;margin:5px;margin-top:3px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_panel_top,#co2meter_panel_top{width:290px;height:100px;float:right;margin:5px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_doorled,#fermenter_lightled,#fermenter_alarmled,#fermenter_powerled{width:50px;height:30px;float:left;text-align:center;margin-top:15px;margin-left:20px}#co2meter_powerled{width:50px;height:30px;float:right;text-align:center;margin-top:15px;margin-right:20px}#co2meter_panel_display{width:290px;height:260px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_panel_display{width:290px;height:98px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_display{width:145px;height:98px;float:left;text-align:center}#fermenter_panel_control{width:290px;height:150px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_led1,#fermenter_led2,#fermenter_led3{width:96px;height:30px;float:left;text-align:center;margin-top:13px}#fermenter_toggle1{float:left;margin-left:29px;margin-top:20px}#fermenter_toggle2,#fermenter_toggle3{float:left;margin-left:60px;margin-top:20px}#fermenter_panel_buttons,#co2meter_panel_buttons{width:290px;height:227px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.LEDred_on{margin:5px auto;width:18px;height:18px;background-color:#F40;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #C33 0 -1px 5px,#f44 0 2px 12px}.LEDred_off{margin:5px auto;width:18px;height:18px;background-color:#820;border-radius:50%;box-shadow:#400 0 0 1px 1px}.LEDyellow_on{margin:5px auto;width:18px;height:18px;background-color:#FF0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #860 0 -1px 5px,#DD0 0 2px 12px}.LEDyellow_off{margin:5px auto;width:18px;height:18px;background-color:#A90;border-radius:50%;box-shadow:#440 0 0 1px 1px}.LEDgreen_on{margin:5px auto;width:18px;height:18px;background-color:#5E0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #270 0 -1px 5px,#5D0 0 2px 12px}.LEDgreen_off{margin:5px auto;width:18px;height:18px;background-color:#270;border-radius:50%;box-shadow:#250 0 0 1px 1px}.LEDblue_on{margin:5px auto;width:18px;height:18px;background-color:#4AF;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #247 0 -1px 5px,#48F 0 2px 12px}.LEDblue_off{margin:5px auto;width:18px;height:18px;background-color:#137;border-radius:50%;box-shadow:#024 0 0 1px 1px}#hintBase,#hintStyle,#hintEq{float:left;margin-top:30px;margin-right:20px;padding:5px;width:600px;color:yellow}#section{margin:5px}#baseButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:160px}#styleButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#eqButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#completedButtonsWrapper{float:right;margin-right:10px;width:320px;margin-top:160px}.nextButton{float:right;margin-left:0}.backButton{float:left;margin-left:10px} \ No newline at end of file +body{background:#ccc;font-family:Verdana,Arial,sans-serif;margin:0}#MainPanel,#fermenter,#co2meter{width:1278px;height:628px;border:2px solid #4297d7;background:#252526;float:left;color:#eee}#water_totals{width:960px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#propagator{width:800px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#export_table,#about_table{width:960px;background:#353536;margin:150px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#node_table{width:600px;background:#353536;margin:50px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_table,#co2meter_table{width:960px;height:210px;background:#252526;margin:5px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.ebccolor{float:left;margin-left:10px;width:75px;height:23px;border:1px solid #59b4d4;border-radius:6px;moz-border-radius:6px;webkit-border-radius:6px;background:#212121}#fermenter_thermometers,#co2meter_meters{width:960px;height:390px;float:left;background-color:#252526;margin:5px;margin-top:3px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_panel_top,#co2meter_panel_top{width:290px;height:100px;float:right;margin:5px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_doorled,#fermenter_lightled,#fermenter_alarmled,#fermenter_powerled{width:50px;height:30px;float:left;text-align:center;margin-top:15px;margin-left:20px}#co2meter_alarmled,#co2meter_powerled{width:50px;height:30px;float:right;text-align:center;margin-top:15px;margin-right:20px}#co2meter_panel_display{width:290px;height:260px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_panel_display{width:290px;height:98px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_display{width:145px;height:98px;float:left;text-align:center}#fermenter_panel_control{width:290px;height:150px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_led1,#fermenter_led2,#fermenter_led3{width:96px;height:30px;float:left;text-align:center;margin-top:13px}#fermenter_toggle1{float:left;margin-left:29px;margin-top:20px}#fermenter_toggle2,#fermenter_toggle3{float:left;margin-left:60px;margin-top:20px}#fermenter_panel_buttons,#co2meter_panel_buttons{width:290px;height:227px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.LEDred_on{margin:5px auto;width:18px;height:18px;background-color:#F40;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #C33 0 -1px 5px,#f44 0 2px 12px}.LEDred_off{margin:5px auto;width:18px;height:18px;background-color:#820;border-radius:50%;box-shadow:#400 0 0 1px 1px}.LEDyellow_on{margin:5px auto;width:18px;height:18px;background-color:#FF0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #860 0 -1px 5px,#DD0 0 2px 12px}.LEDyellow_off{margin:5px auto;width:18px;height:18px;background-color:#A90;border-radius:50%;box-shadow:#440 0 0 1px 1px}.LEDgreen_on{margin:5px auto;width:18px;height:18px;background-color:#5E0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #270 0 -1px 5px,#5D0 0 2px 12px}.LEDgreen_off{margin:5px auto;width:18px;height:18px;background-color:#270;border-radius:50%;box-shadow:#250 0 0 1px 1px}.LEDblue_on{margin:5px auto;width:18px;height:18px;background-color:#4AF;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #247 0 -1px 5px,#48F 0 2px 12px}.LEDblue_off{margin:5px auto;width:18px;height:18px;background-color:#137;border-radius:50%;box-shadow:#024 0 0 1px 1px}#hintBase,#hintStyle,#hintEq{float:left;margin-top:30px;margin-right:20px;padding:5px;width:600px;color:yellow}#section{margin:5px}#baseButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:160px}#styleButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#eqButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#completedButtonsWrapper{float:right;margin-right:10px;width:320px;margin-top:160px}.nextButton{float:right;margin-left:0}.backButton{float:left;margin-left:10px} \ No newline at end of file diff -r 42a0ab588a4f -r c09b67fd8323 www/css/style.css --- a/www/css/style.css Fri Oct 11 11:44:37 2019 +0200 +++ b/www/css/style.css Fri Oct 11 13:38:31 2019 +0200 @@ -163,6 +163,7 @@ margin-left: 20px; } +#co2meter_alarmled, #co2meter_powerled { width: 50px; height: 30px; diff -r 42a0ab588a4f -r c09b67fd8323 www/getco2meter.php --- a/www/getco2meter.php Fri Oct 11 11:44:37 2019 +0200 +++ b/www/getco2meter.php Fri Oct 11 13:38:31 2019 +0200 @@ -5,7 +5,7 @@ if (isset($_GET["uuid"])) $uuid = $_GET["uuid"]; else - $uuid = "'ef166f25-1bb4-4bef-b112-a867af77f766'"; + $uuid = "'c0ffeeee-dead-beef-caf0-3c71bffe4054'"; $mysqli = new mysqli(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); diff -r 42a0ab588a4f -r c09b67fd8323 www/js/mon_co2meter-min.js --- a/www/js/mon_co2meter-min.js Fri Oct 11 11:44:37 2019 +0200 +++ b/www/js/mon_co2meter-min.js Fri Oct 11 13:38:31 2019 +0200 @@ -1,1 +1,1 @@ -$(document).ready(function(){var f={},e={},g=0,h={datatype:"json",cache:false,datafields:[{name:"code",type:"string"},{name:"name",type:"string"},{name:"uuid",type:"string"}],id:"code",url:"includes/db_product.php?select=ferment"},j=new $.jqx.dataAdapter(h,{beforeLoadComplete:function(k){var n,l,m=new Array();e.code="Free";e.name="Dummy";e.uuid="66ecccbf-e942-4a35-af49-8b02314561a5";m.push(e);for(l=0;lPower')}else{$("#co2meter_powerled").html('
Power')}$("#gaugeContainer_temperature").jqxGauge({caption:{value:"Temp: "+f.temperature.toFixed(3)}});$("#gaugeContainer_temperature").jqxGauge({value:f.temperature});if(f.temperature_state=="OK"){$("#gaugeContainer_temperature").jqxGauge({disabled:false})}else{$("#gaugeContainer_temperature").jqxGauge({disabled:true})}$("#gaugeContainer_pressure").jqxGauge({caption:{value:"Bar: "+f.pressure_bar.toFixed(2)}});$("#gaugeContainer_pressure").jqxGauge({value:f.pressure_bar});if(f.pressure_state=="OK"){$("#gaugeContainer_pressure").jqxGauge({disabled:false})}else{$("#gaugeContainer_pressure").jqxGauge({disabled:true})}}});$("#select_beer").jqxDropDownList({placeHolder:"Kies bier:",theme:theme,source:j,displayMember:"code",width:150,height:24,dropDownWidth:500,autoDropDownHeight:true,renderer:function(l,k,n){var m=j.records[l];return m.code+" - "+m.name}});$("#gaugeContainer_temperature").jqxGauge(c);$("#gaugeContainer_temperature").jqxGauge({caption:{value:"Temp: 00.000"}});$("#gaugeContainer_pressure").jqxGauge(d);$("#gaugeContainer_pressure").jqxGauge({caption:{value:"Bar: 00.000"}});srcMode=["OFF","ON"];$("#info_mode").jqxDropDownList({theme:theme,source:srcMode,width:100,height:24,dropDownHeight:62});i.dataBind();setInterval(function(){var k=false;if(k){g=4}else{if(g>0){g--}}if(g<=0){i.dataBind();g=20}},500);$("#info_mode").on("change",function(l){var k=l.args;if(k){f.mode=k.item.value}});$("#FLog").jqxButton({template:"primary",width:"150px",theme:theme});$("#FLog").click(function(){window.open("log_fermentation.php?code="+f.beercode+"&name="+f.beername)})}); \ No newline at end of file +$(document).ready(function(){var f={},e={},g=0,h={datatype:"json",cache:false,datafields:[{name:"code",type:"string"},{name:"name",type:"string"},{name:"uuid",type:"string"}],id:"code",url:"includes/db_product.php?select=ferment"},j=new $.jqx.dataAdapter(h,{beforeLoadComplete:function(k){var n,l,m=new Array();e.code="Free";e.name="Dummy";e.uuid="66ecccbf-e942-4a35-af49-8b02314561a5";m.push(e);for(l=0;lPower')}else{$("#co2meter_powerled").html('
Power')}if(f.online&&(f.alarm!="0")){$("#co2meter_alarmled").html('
Alarm')}else{$("#co2meter_alarmled").html('
Alarm')}$("#gaugeContainer_temperature").jqxGauge({caption:{value:"Temp: "+f.temperature.toFixed(3)}});$("#gaugeContainer_temperature").jqxGauge({value:f.temperature});if(f.temperature_state=="OK"){$("#gaugeContainer_temperature").jqxGauge({disabled:false})}else{$("#gaugeContainer_temperature").jqxGauge({disabled:true})}$("#gaugeContainer_pressure").jqxGauge({caption:{value:"Bar: "+f.pressure_bar.toFixed(2)}});$("#gaugeContainer_pressure").jqxGauge({value:f.pressure_bar});if(f.pressure_state=="OK"){$("#gaugeContainer_pressure").jqxGauge({disabled:false})}else{$("#gaugeContainer_pressure").jqxGauge({disabled:true})}}});$("#select_beer").jqxDropDownList({placeHolder:"Kies bier:",theme:theme,source:j,displayMember:"code",width:150,height:24,dropDownWidth:500,autoDropDownHeight:true,renderer:function(l,k,n){var m=j.records[l];return m.code+" - "+m.name}});$("#gaugeContainer_temperature").jqxGauge(c);$("#gaugeContainer_temperature").jqxGauge({caption:{value:"Temp: 00.000"}});$("#gaugeContainer_pressure").jqxGauge(d);$("#gaugeContainer_pressure").jqxGauge({caption:{value:"Bar: 00.000"}});srcMode=["OFF","ON"];$("#info_mode").jqxDropDownList({theme:theme,source:srcMode,width:100,height:24,dropDownHeight:62});i.dataBind();setInterval(function(){var k=false;if(k){g=4}else{if(g>0){g--}}if(g<=0){i.dataBind();g=20}},500);$("#info_mode").on("change",function(l){var k=l.args;if(k){f.mode=k.item.value}});$("#FLog").jqxButton({template:"primary",width:"150px",theme:theme});$("#FLog").click(function(){window.open("log_fermentation.php?code="+f.beercode+"&name="+f.beername)})}); \ No newline at end of file diff -r 42a0ab588a4f -r c09b67fd8323 www/js/mon_co2meter.js --- a/www/js/mon_co2meter.js Fri Oct 11 11:44:37 2019 +0200 +++ b/www/js/mon_co2meter.js Fri Oct 11 13:38:31 2019 +0200 @@ -94,6 +94,7 @@ { name: 'beername', type: 'string' }, { name: 'beeruuid', type: 'string' }, { name: 'mode', type: 'string' }, + { name: 'alarm', type: 'int' }, { name: 'temperature_state', type: 'string' }, { name: 'temperature', type: 'float' }, { name: 'pressure_state', type: 'string' }, @@ -119,6 +120,11 @@ } else { $("#co2meter_powerled").html('
Power'); } + if (record.online && (record.alarm != "0")) { + $("#co2meter_alarmled").html('
Alarm'); + } else { + $("#co2meter_alarmled").html('
Alarm'); + } $("#gaugeContainer_temperature").jqxGauge({ caption: { value: 'Temp: '+record.temperature.toFixed(3) }}); $('#gaugeContainer_temperature').jqxGauge({ value: record.temperature }); diff -r 42a0ab588a4f -r c09b67fd8323 www/mon_co2meter.php --- a/www/mon_co2meter.php Fri Oct 11 11:44:37 2019 +0200 +++ b/www/mon_co2meter.php Fri Oct 11 13:38:31 2019 +0200 @@ -13,6 +13,7 @@ CO2 meter overzicht +   Uuid
@@ -29,21 +30,21 @@ Werking -
- +
-
-
+
+
+