Modification BDD : Saisie des valeurs de test pour le client virtuel (puces + pins + états)

This commit is contained in:
xdrm-brackets 2016-07-19 10:52:06 +02:00
parent 6f83c677d4
commit bce1487a43
2 changed files with 12 additions and 10 deletions

View File

@ -254,12 +254,16 @@
var board = new Board(50);
var chip = {
led: new LedInterface( new Chip(1, 2, 3), led ),
r1: new RelayInterface( new Chip(4), r1 ),
r2: new RelayInterface( new Chip(5), r2 )
led: new LedInterface( new Chip('serial', [1, 2, 3]), led ),
r1: new RelayInterface( new Chip('serial', [4]), r1 ),
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

View File

@ -78,7 +78,7 @@ var Board;
/* [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.listener[i] = chipInterface;
}
@ -166,7 +166,7 @@ var Chip;
this.pins = pins;
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);
};
@ -336,10 +336,8 @@ var RelayInterface;
*
*/
RelayInterface.prototype.update = function(){
if( this.chip.pin[0] )
this.container.addClass('active');
else
this.container.remClass('active');
if( this.chip.pin[0] ) this.container.addClass('active');
else this.container.remClass('active');
};