diff --git a/test/client/interface.php b/test/client/interface.php index 4b29100..ffeb493 100644 --- a/test/client/interface.php +++ b/test/client/interface.php @@ -282,7 +282,7 @@ /* (2) Si l'état correspond */ if( previous(STATES[s].global_state, STATE) ){ - console.log('STATE', STATE, 'matches', STATES[s].global_state); + console.log('STATE', STATE.join(''), 'matches', STATES[s].global_state); /* (3) On applique l'état à chaque CHIP */ for( var c in CHIPS ){ @@ -296,8 +296,10 @@ var values = CHIPS[c].states[STATES[s].chips[c]]; /* (6) On applique les valeurs */ - for( var p in pins ) + for( var p in pins ){ board.set( parseInt(pins[p]), parseInt(values[p]) ); + console.log('board.set(', parseInt(pins[p]), ',', parseInt(values[p]), ');'); + } } diff --git a/test/client/lib-min.js b/test/client/lib-min.js index 1446072..26bd0f5 100644 --- a/test/client/lib-min.js +++ b/test/client/lib-min.js @@ -1,8 +1,8 @@ var Pin;(function(){Pin=function(a){parseInt(a)==a&&0<=a&&255>=a?this.value=parseInt(a):this.value=0};Pin.prototype={value:this.value};Pin.prototype.set=function(a){parseInt(a)==a&&0<=a&&255>=a&&(this.value=parseInt(a))};Pin.prototype.get=function(){return this.value}})();var Board; -(function(){Board=function(a){if(!(parseInt(a)!=a||1>a)){this.maxPin=a;this.pins=[];this.listener=[];for(a=0;athis.maxPin)&&this.pins[a]instanceof Pin){if("boolean"==typeof b)b=b?255:0;else if(b!=parseInt(b)||0>b||255a)){this.maxPin=a;this.pins=[];this.listener=[];for(a=0;athis.maxPin)&&this.pins[a]instanceof Pin){if("boolean"==typeof b)b=b?255:0;else if(b!=parseInt(b)||0>b||255=a)){if("boolean"==typeof b)b=b?255:0;else if(b!=parseInt(b)||0>b||255 1) this.container.addClass('active'); + else this.container.remClass('active'); }; @@ -352,6 +353,7 @@ var action; (function(){ + /* RETOURNE SI UN ETAT EST CORRECT * * @previous Condition d'état @@ -382,7 +384,8 @@ var action; for( var i = 0 ; i < action.length ; i++ ) if( action[i] == 'x' ) continue; - else state[i] = action[i]; + else state[i] = parseInt(action[i]); }; + })();