Skip to content

Commit 3418ec0

Browse files
committed
Merge branch 'feature/0.4'
2 parents d44c03e + 49046fd commit 3418ec0

12 files changed

+499
-294
lines changed

beer-panel.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
*/
1818
?>
1919
<div id="top-bar" class="ui-widget ui-widget-header ui-corner-all">
20-
<div id="lcd" class="lcddisplay"><span class="lcd-text">
21-
<span class="lcd-line" id="lcd-line-0">Live LCD waiting</span>
22-
<span class="lcd-line" id="lcd-line-1">for update from</span>
23-
<span class="lcd-line" id="lcd-line-2">script...</span>
24-
<span class="lcd-line" id="lcd-line-3"></span>
20+
<div id="lcd" class="lcddisplay">
21+
<span class="lcd-text">
22+
<span class="lcd-line" id="lcd-line-0">Live LCD waiting</span>
23+
<span class="lcd-line" id="lcd-line-1">for update from</span>
24+
<span class="lcd-line" id="lcd-line-2">script...</span>
25+
<span class="lcd-line" id="lcd-line-3"></span>
26+
</span>
2527
</div>
2628
<div id="logo-container">
2729
<img src="brewpi_logo.png">

control-panel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<div id="profileEditControls">
5959
<div class="profileEditFieldSet">
6060
<div id="profileEditNameLabel" class="profileTableLabel edit">Profile Name:</div><input class="profileTableField" type="text" id="profileEditName" name="profileEditName" value="" />
61-
<div class="profileTableLabel edit">Start Date:</div><input class="profileTableField" type="text" id="profileEditStartDate" name="profileEditStartDate" value="" />
61+
<div class="profileTableLabel edit">Start Date:</div><input class="profileTableField" type="text" id="profileEditStartDate" name="profileEditStartDate" value="" tabindex="-1" />
6262
</div>
6363
<button class="halfwidth-button" type="button" id="profileEditNowButton">Start Now</button>
6464
<button class="halfwidth-button" type="button" id="profileEditAddCurrentButton">Insert Now</button>

css/style.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ button#maintenance{
380380
color: #555;
381381
}
382382

383+
#maintenance-panel .ui-widget-content {
384+
font-family: Verdana, Arial, sans-serif;
385+
}
386+
383387
#maintenance-panel .device-container .device-setting-container{
384388
width: 150px;
385389
padding: 5px;
@@ -451,6 +455,10 @@ button#maintenance{
451455
float: right;
452456
}
453457

458+
#advanced-settings .reset-controller-button{
459+
text-align: center;
460+
}
461+
454462
#advanced-settings .setting-container select,
455463
#advanced-settings .setting-container input,
456464
#settings .setting-container select,
@@ -780,3 +788,12 @@ button.chart-error-refresh{
780788
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
781789

782790
.chart-placeholder{ display: block; margin-top:100px; width: 100%; text-align: center;}
791+
792+
/* css for json syntax highlighting */
793+
pre.json {outline: 1px solid #ccc; padding: 5px; margin: 5px;
794+
background-color: #333; color: #808080; width: auto; height: 550px; overflow: auto;}
795+
.string { color: #32cd32; }
796+
.number { color: #ff006a; }
797+
.boolean { color: #00bfff; }
798+
.null { color: #ff4500; }
799+
.key { color: #d3d3d3; }

js/control-panel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ function loadControlPanel(){
7070
$controlPanel.tabs( "option", "active", 3);
7171
statusMessage("normal","Temperature control disabled");
7272
break;
73+
case 't':
74+
$controlPanel.tabs( "option", "active", 3);
75+
statusMessage("normal","Testing mode");
76+
break;
7377
default:
7478
statusMessage("error","Invalid mode ("+window.controlSettings.mode+") received");
7579
}

js/device-config.js

Lines changed: 79 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,52 @@ function addDeviceToDeviceList(device, pinList, addManual){
168168
applyDeviceSettings(device.nr);
169169
});
170170

171+
// add actuator control buttons buttons
172+
if(device.t == 5) // manual actuator
173+
{
174+
if (device.h == 4){ // DS2408, used for values
175+
var $valveOpenButton = $("<button class='apply'>Open</button>");
176+
$valveOpenButton.appendTo($nameAndApply);
177+
$valveOpenButton.button({icons: {primary: "ui-icon-arrowthick-2-e-w"}});
178+
$valveOpenButton.click(function () {
179+
$.post('socketmessage.php', {
180+
messageType: String("writeDevice"),
181+
message: String('{"i": ' + device.i.toString() + ',"w":1}')
182+
});
183+
});
184+
185+
var $valveCloseButton = $("<button class='apply'>Close</button>");
186+
$valveCloseButton.appendTo($nameAndApply);
187+
$valveCloseButton.button({icons: {primary: "ui-icon-arrowthickstop-1-e"}});
188+
$valveCloseButton.click(function () {
189+
$.post('socketmessage.php', {
190+
messageType: String("writeDevice"),
191+
message: String('{"i": ' + device.i.toString() + ',"w":2}')
192+
});
193+
});
194+
}
195+
if (device.h == 1 || device.h == 3){ // digital pin or DS2413
196+
var $onButton = $("<button class='apply'>ON</button>");
197+
$onButton.appendTo($nameAndApply);
198+
$onButton.button({icons: {primary: "ui-icon-radio-on"}});
199+
$onButton.click(function () {
200+
$.post('socketmessage.php', {
201+
messageType: String("writeDevice"),
202+
message: String('{"i": ' + device.i.toString() + ',"w":1}')
203+
});
204+
});
205+
206+
var $offButton = $("<button class='apply'>OFF</button>");
207+
$offButton.appendTo($nameAndApply);
208+
$offButton.button({icons: {primary: "ui-icon-radio-off"}});
209+
$offButton.click(function () {
210+
$.post('socketmessage.php', {
211+
messageType: String("writeDevice"),
212+
message: String('{"i": ' + device.i.toString() + ',"w":0}')
213+
});
214+
});
215+
}
216+
}
171217

172218

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

259305
if((typeof device.n !== "undefined") ){
260306
$settings.append(generateDeviceSettingContainer(
261-
"DS2413 pin",
262-
"ds2413-pin",
263-
generateSelect([{ val: 0, text: 'pin 0'}, {val: 1, text: 'pin 1'}], device.n)));
307+
"Output",
308+
"output-nr",
309+
generateSelect([{ val: 0, text: 'Output A'}, {val: 1, text: 'Output B'}], device.n)));
264310
}
265311
if((typeof device.v !== "undefined") ){
266312
var value = device.v;
@@ -273,6 +319,15 @@ function addDeviceToDeviceList(device, pinList, addManual){
273319
value = "Active";
274320
}
275321
}
322+
if(parseInt(device.t, 10) === 5){
323+
// Device type is valve/switch actuator
324+
if(value === 0){
325+
value = "Inactive";
326+
}
327+
else if(value ===1){
328+
value = "Active";
329+
}
330+
}
276331
if(parseInt(value,10)===-64){
277332
value = "Disconnected";
278333
}
@@ -296,23 +351,25 @@ function findPinInList(pinList, pinNr){
296351
function pinTypeToFunctionList(pinType, hwType){
297352
"use strict";
298353
var functionList=[];
299-
var actFunctions = [2, 3, 4, 7];
354+
var actFunctions = [2, 3, 4, 7, 8];
300355

301356
switch(pinType){
302357
case 'act':
303358
functionList = actFunctions; // all actuator functions
304359
break;
305360
case 'free':
306-
functionList = [1, 2, 3, 4, 7]; // all actuator functions + door
361+
functionList = [1, 2, 3, 4, 7, 8]; // all actuator functions + door
307362
break;
308363
case 'onewire':
309-
if (hwType!==3)
364+
if (hwType==2)
310365
functionList = [5, 6, 9];
311-
else
366+
else if (hwType == 3)
312367
functionList = actFunctions; // ds2413 actuator
368+
else if (hwType==4)
369+
functionList = [8]; // ds2408 actuator
313370
break;
314371
case 'door':
315-
functionList = [1, 2, 3, 4, 7]; // all actuator functions + door
372+
functionList = [1, 2, 3, 4, 7, 8]; // all actuator functions + door
316373
break;
317374
}
318375
return functionList;
@@ -324,6 +381,7 @@ function functionToPinTypes(functionType){
324381
var pinTypes;
325382
switch(functionType){
326383
case 0: // none
384+
case 8: // Manual actuator
327385
pinTypes = ['free', 'act', 'onewire', 'door'];
328386
break;
329387
case 1: // door
@@ -340,6 +398,7 @@ function functionToPinTypes(functionType){
340398
case 9: // beer temp
341399
pinTypes = ['onewire'];
342400
break;
401+
343402
default: // unknown function
344403
pinTypes = [];
345404
break;
@@ -359,7 +418,7 @@ function getDeviceFunctionList(){
359418
{val : 5, text: 'Chamber Temp'},
360419
{val : 6, text: 'Room Temp'},
361420
{val : 7, text: 'Chamber Fan'},
362-
/*{val : 8, text: 'Chamber Reserved 1'},*/
421+
{val : 8, text: 'Manual Actuator'},
363422
{val : 9, text: 'Beer Temp'}/*,
364423
{val : 10, text: 'Beer Temperature 2'},
365424
{val : 11, text: 'Beer Heater'},
@@ -390,18 +449,21 @@ function getDeviceHwTypeList(){
390449
{val : 0, text: 'None'},
391450
{val : 1, text: 'Digital Pin'},
392451
{val : 2, text: 'Temp Sensor'},
393-
{val : 3, text: 'DS2413'}
452+
{val : 3, text: 'DS2413'},
453+
{val : 4, text: 'DS2408/Valve'},
394454
];
395455
}
396456

397-
function getDeviceTypeList(){
457+
function getDeviceTypeList() {
398458
"use strict";
399459
// currently unsupported/unused devices commented out
400460
return [
401-
{val : 0, text: 'None'},
402-
{val : 1, text: 'Temp Sensor'},
403-
{val : 2, text: 'Switch Sensor'},
404-
{val : 3, text: 'Switch Actuator'}
461+
{val: 0, text: 'None'},
462+
{val: 1, text: 'Temp Sensor'},
463+
{val: 2, text: 'Switch Sensor'},
464+
{val: 3, text: 'Switch Actuator'},
465+
{val: 4, text: 'PWM Actuator'},
466+
{val: 5, text: 'Manual Actuator'}
405467
];
406468
}
407469

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

419481
function getDeviceSlotList(){
420482
"use strict";
421-
var maxDevices = 15;
483+
var maxDevices = 25;
422484
var list = [ {val: -1, text: 'Unassigned'}];
423485
for(var i = 0; i <= maxDevices; i++){
424486
list.push({val: i, text: i.toString()});
@@ -528,7 +590,7 @@ function getDeviceConfigString(deviceNr){
528590
}
529591
configString = addToConfigString(configString,"x", $deviceContainer.find(".pin-type select").val());
530592
configString = addToConfigString(configString,"a", $deviceContainer.find("span.onewire-address").text());
531-
configString = addToConfigString(configString,"n", $deviceContainer.find(".ds2413-pin select").val());
593+
configString = addToConfigString(configString,"n", $deviceContainer.find(".output-nr select").val());
532594

533595
//configString = addToConfigString(configString,"d", 0); // hardwire deactivate for now
534596
//configString = addToConfigString(configString,"j", 0); // hardwire calibration for now

0 commit comments

Comments
 (0)