Modification BDD : Saisie des valeurs de test pour le client virtuel (puces + pins + états)
This commit is contained in:
parent
6f83c677d4
commit
bce1487a43
|
@ -254,12 +254,16 @@
|
||||||
var board = new Board(50);
|
var board = new Board(50);
|
||||||
|
|
||||||
var chip = {
|
var chip = {
|
||||||
led: new LedInterface( new Chip(1, 2, 3), led ),
|
led: new LedInterface( new Chip('serial', [1, 2, 3]), led ),
|
||||||
r1: new RelayInterface( new Chip(4), r1 ),
|
r1: new RelayInterface( new Chip('serial', [4]), r1 ),
|
||||||
r2: new RelayInterface( new Chip(5), r2 )
|
r2: new RelayInterface( new Chip('serial', [5]), r2 )
|
||||||
};
|
};
|
||||||
|
|
||||||
board.plug( chip.led )
|
var chipList = Object.keys(chip);
|
||||||
|
|
||||||
|
// Branchement des puces
|
||||||
|
for( var i = 0 ; i < chipList.length ; i++ )
|
||||||
|
board.plug( chip[chipList[i]] );
|
||||||
|
|
||||||
|
|
||||||
/* [1] Fonctions
|
/* [1] Fonctions
|
||||||
|
|
|
@ -78,7 +78,7 @@ var Board;
|
||||||
|
|
||||||
/* [2] Branchement + on lie l'interface
|
/* [2] Branchement + on lie l'interface
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
for( var i = 0 ; i < chipInterface.chip.pins.length ; i++ ){
|
for( i = 0 ; i < chipInterface.chip.pins.length ; i++ ){
|
||||||
this.pins[i] = chipInterface.chip.values[i];
|
this.pins[i] = chipInterface.chip.values[i];
|
||||||
this.listener[i] = chipInterface;
|
this.listener[i] = chipInterface;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ var Chip;
|
||||||
this.pins = pins;
|
this.pins = pins;
|
||||||
this.values = [];
|
this.values = [];
|
||||||
|
|
||||||
for( var i = 0 ; i < this.pins.length ; i++ )
|
for( i = 0 ; i < this.pins.length ; i++ )
|
||||||
this.values[i] = new Pin(0);
|
this.values[i] = new Pin(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -336,10 +336,8 @@ var RelayInterface;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
RelayInterface.prototype.update = function(){
|
RelayInterface.prototype.update = function(){
|
||||||
if( this.chip.pin[0] )
|
if( this.chip.pin[0] ) this.container.addClass('active');
|
||||||
this.container.addClass('active');
|
else this.container.remClass('active');
|
||||||
else
|
|
||||||
this.container.remClass('active');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue