Skip to content

Commit

Permalink
Merge branch 'feature/0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
elcojacobs committed Dec 3, 2015
2 parents d44c03e + 49046fd commit 3418ec0
Show file tree
Hide file tree
Showing 12 changed files with 499 additions and 294 deletions.
12 changes: 7 additions & 5 deletions beer-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
*/
?>
<div id="top-bar" class="ui-widget ui-widget-header ui-corner-all">
<div id="lcd" class="lcddisplay"><span class="lcd-text">
<span class="lcd-line" id="lcd-line-0">Live LCD waiting</span>
<span class="lcd-line" id="lcd-line-1">for update from</span>
<span class="lcd-line" id="lcd-line-2">script...</span>
<span class="lcd-line" id="lcd-line-3"></span>
<div id="lcd" class="lcddisplay">
<span class="lcd-text">
<span class="lcd-line" id="lcd-line-0">Live LCD waiting</span>
<span class="lcd-line" id="lcd-line-1">for update from</span>
<span class="lcd-line" id="lcd-line-2">script...</span>
<span class="lcd-line" id="lcd-line-3"></span>
</span>
</div>
<div id="logo-container">
<img src="brewpi_logo.png">
Expand Down
2 changes: 1 addition & 1 deletion control-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div id="profileEditControls">
<div class="profileEditFieldSet">
<div id="profileEditNameLabel" class="profileTableLabel edit">Profile Name:</div><input class="profileTableField" type="text" id="profileEditName" name="profileEditName" value="" />
<div class="profileTableLabel edit">Start Date:</div><input class="profileTableField" type="text" id="profileEditStartDate" name="profileEditStartDate" value="" />
<div class="profileTableLabel edit">Start Date:</div><input class="profileTableField" type="text" id="profileEditStartDate" name="profileEditStartDate" value="" tabindex="-1" />
</div>
<button class="halfwidth-button" type="button" id="profileEditNowButton">Start Now</button>
<button class="halfwidth-button" type="button" id="profileEditAddCurrentButton">Insert Now</button>
Expand Down
17 changes: 17 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ button#maintenance{
color: #555;
}

#maintenance-panel .ui-widget-content {
font-family: Verdana, Arial, sans-serif;
}

#maintenance-panel .device-container .device-setting-container{
width: 150px;
padding: 5px;
Expand Down Expand Up @@ -451,6 +455,10 @@ button#maintenance{
float: right;
}

#advanced-settings .reset-controller-button{
text-align: center;
}

#advanced-settings .setting-container select,
#advanced-settings .setting-container input,
#settings .setting-container select,
Expand Down Expand Up @@ -780,3 +788,12 @@ button.chart-error-refresh{
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }

.chart-placeholder{ display: block; margin-top:100px; width: 100%; text-align: center;}

/* css for json syntax highlighting */
pre.json {outline: 1px solid #ccc; padding: 5px; margin: 5px;
background-color: #333; color: #808080; width: auto; height: 550px; overflow: auto;}
.string { color: #32cd32; }
.number { color: #ff006a; }
.boolean { color: #00bfff; }
.null { color: #ff4500; }
.key { color: #d3d3d3; }
4 changes: 4 additions & 0 deletions js/control-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function loadControlPanel(){
$controlPanel.tabs( "option", "active", 3);
statusMessage("normal","Temperature control disabled");
break;
case 't':
$controlPanel.tabs( "option", "active", 3);
statusMessage("normal","Testing mode");
break;
default:
statusMessage("error","Invalid mode ("+window.controlSettings.mode+") received");
}
Expand Down
96 changes: 79 additions & 17 deletions js/device-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,52 @@ function addDeviceToDeviceList(device, pinList, addManual){
applyDeviceSettings(device.nr);
});

// add actuator control buttons buttons
if(device.t == 5) // manual actuator
{
if (device.h == 4){ // DS2408, used for values
var $valveOpenButton = $("<button class='apply'>Open</button>");
$valveOpenButton.appendTo($nameAndApply);
$valveOpenButton.button({icons: {primary: "ui-icon-arrowthick-2-e-w"}});
$valveOpenButton.click(function () {
$.post('socketmessage.php', {
messageType: String("writeDevice"),
message: String('{"i": ' + device.i.toString() + ',"w":1}')
});
});

var $valveCloseButton = $("<button class='apply'>Close</button>");
$valveCloseButton.appendTo($nameAndApply);
$valveCloseButton.button({icons: {primary: "ui-icon-arrowthickstop-1-e"}});
$valveCloseButton.click(function () {
$.post('socketmessage.php', {
messageType: String("writeDevice"),
message: String('{"i": ' + device.i.toString() + ',"w":2}')
});
});
}
if (device.h == 1 || device.h == 3){ // digital pin or DS2413
var $onButton = $("<button class='apply'>ON</button>");
$onButton.appendTo($nameAndApply);
$onButton.button({icons: {primary: "ui-icon-radio-on"}});
$onButton.click(function () {
$.post('socketmessage.php', {
messageType: String("writeDevice"),
message: String('{"i": ' + device.i.toString() + ',"w":1}')
});
});

var $offButton = $("<button class='apply'>OFF</button>");
$offButton.appendTo($nameAndApply);
$offButton.button({icons: {primary: "ui-icon-radio-off"}});
$offButton.click(function () {
$.post('socketmessage.php', {
messageType: String("writeDevice"),
message: String('{"i": ' + device.i.toString() + ',"w":0}')
});
});
}
}


var $settings = $("<div class='device-all-settings'><div>");
Expand Down Expand Up @@ -258,9 +304,9 @@ function addDeviceToDeviceList(device, pinList, addManual){

if((typeof device.n !== "undefined") ){
$settings.append(generateDeviceSettingContainer(
"DS2413 pin",
"ds2413-pin",
generateSelect([{ val: 0, text: 'pin 0'}, {val: 1, text: 'pin 1'}], device.n)));
"Output",
"output-nr",
generateSelect([{ val: 0, text: 'Output A'}, {val: 1, text: 'Output B'}], device.n)));
}
if((typeof device.v !== "undefined") ){
var value = device.v;
Expand All @@ -273,6 +319,15 @@ function addDeviceToDeviceList(device, pinList, addManual){
value = "Active";
}
}
if(parseInt(device.t, 10) === 5){
// Device type is valve/switch actuator
if(value === 0){
value = "Inactive";
}
else if(value ===1){
value = "Active";
}
}
if(parseInt(value,10)===-64){
value = "Disconnected";
}
Expand All @@ -296,23 +351,25 @@ function findPinInList(pinList, pinNr){
function pinTypeToFunctionList(pinType, hwType){
"use strict";
var functionList=[];
var actFunctions = [2, 3, 4, 7];
var actFunctions = [2, 3, 4, 7, 8];

switch(pinType){
case 'act':
functionList = actFunctions; // all actuator functions
break;
case 'free':
functionList = [1, 2, 3, 4, 7]; // all actuator functions + door
functionList = [1, 2, 3, 4, 7, 8]; // all actuator functions + door
break;
case 'onewire':
if (hwType!==3)
if (hwType==2)
functionList = [5, 6, 9];
else
else if (hwType == 3)
functionList = actFunctions; // ds2413 actuator
else if (hwType==4)
functionList = [8]; // ds2408 actuator
break;
case 'door':
functionList = [1, 2, 3, 4, 7]; // all actuator functions + door
functionList = [1, 2, 3, 4, 7, 8]; // all actuator functions + door
break;
}
return functionList;
Expand All @@ -324,6 +381,7 @@ function functionToPinTypes(functionType){
var pinTypes;
switch(functionType){
case 0: // none
case 8: // Manual actuator
pinTypes = ['free', 'act', 'onewire', 'door'];
break;
case 1: // door
Expand All @@ -340,6 +398,7 @@ function functionToPinTypes(functionType){
case 9: // beer temp
pinTypes = ['onewire'];
break;

default: // unknown function
pinTypes = [];
break;
Expand All @@ -359,7 +418,7 @@ function getDeviceFunctionList(){
{val : 5, text: 'Chamber Temp'},
{val : 6, text: 'Room Temp'},
{val : 7, text: 'Chamber Fan'},
/*{val : 8, text: 'Chamber Reserved 1'},*/
{val : 8, text: 'Manual Actuator'},
{val : 9, text: 'Beer Temp'}/*,
{val : 10, text: 'Beer Temperature 2'},
{val : 11, text: 'Beer Heater'},
Expand Down Expand Up @@ -390,18 +449,21 @@ function getDeviceHwTypeList(){
{val : 0, text: 'None'},
{val : 1, text: 'Digital Pin'},
{val : 2, text: 'Temp Sensor'},
{val : 3, text: 'DS2413'}
{val : 3, text: 'DS2413'},
{val : 4, text: 'DS2408/Valve'},
];
}

function getDeviceTypeList(){
function getDeviceTypeList() {
"use strict";
// currently unsupported/unused devices commented out
return [
{val : 0, text: 'None'},
{val : 1, text: 'Temp Sensor'},
{val : 2, text: 'Switch Sensor'},
{val : 3, text: 'Switch Actuator'}
{val: 0, text: 'None'},
{val: 1, text: 'Temp Sensor'},
{val: 2, text: 'Switch Sensor'},
{val: 3, text: 'Switch Actuator'},
{val: 4, text: 'PWM Actuator'},
{val: 5, text: 'Manual Actuator'}
];
}

Expand All @@ -418,7 +480,7 @@ function getLimitedPinList(pinList, pinTypes){

function getDeviceSlotList(){
"use strict";
var maxDevices = 15;
var maxDevices = 25;
var list = [ {val: -1, text: 'Unassigned'}];
for(var i = 0; i <= maxDevices; i++){
list.push({val: i, text: i.toString()});
Expand Down Expand Up @@ -528,7 +590,7 @@ function getDeviceConfigString(deviceNr){
}
configString = addToConfigString(configString,"x", $deviceContainer.find(".pin-type select").val());
configString = addToConfigString(configString,"a", $deviceContainer.find("span.onewire-address").text());
configString = addToConfigString(configString,"n", $deviceContainer.find(".ds2413-pin select").val());
configString = addToConfigString(configString,"n", $deviceContainer.find(".output-nr select").val());

//configString = addToConfigString(configString,"d", 0); // hardwire deactivate for now
//configString = addToConfigString(configString,"j", 0); // hardwire calibration for now
Expand Down
Loading

0 comments on commit 3418ec0

Please sign in to comment.