<commit_before>/**
   * All the methods that are defined in Johnny-Five. These extend
   * our BrowserControl objects (not their associated elements)
   */
   var deviceMethods = {
    
    on: function() {
      if (socket) {
        socket.emit('call', { "board": this._board, "device": this._element, "method": "on" });
      }
      this._update(true);
    },
    
    off: function() {
      if (socket) {
        socket.emit('call', { "board": this._board, "device": this._element, "method": "off" });
      }
      this._update(false);
    },
    
    move: function(value) {
      
      // If no value was passed, then read the value from the HTML
      if (value === null) {
        value = Number(document.getElementById(this._element).value)
      }
      
      // Find the base value (0-1)
      var inValue = (value - this.inputMin)/(this.inputMax - this.inputMin);
      
      // value is within range
      if (inValue < 0) inValue = 0;
      if (inValue > 1) inValue = 1;
      
      var outValue = inValue * (this.max - this.min) + this.min;
      
      // If we have an easing function use it
      if (this.easing) {
        outValue = easing[this.easing](outValue);
      }
      
      if (socket && boards[this._board]._ready) {
        socket.emit('call', { "board": this._board, "device": this._element, "method": "move", params: outValue });
      }
      this._update( outValue );
    }
    
  }
  <commit_msg>Only update if tolerance is exceeded<commit_after>/**
   * All the methods that are defined in Johnny-Five. These extend
   * our BrowserControl objects (not their associated elements)
   */
   var deviceMethods = {
    
    on: function() {
      if (socket) {
        socket.emit('call', { "board": this._board, "device": this._element, "method": "on" });
      }
      this._update(true);
    },
    
    off: function() {
      if (socket) {
        socket.emit('call', { "board": this._board, "device": this._element, "method": "off" });
      }
      this._update(false);
    },
    
    move: function(value) {
      
      // If no value was passed, then read the value from the HTML
      if (value === null) {
        value = Number(document.getElementById(this._element).value)
      }
      
      // Find the base value (0-1)
      var inValue = (value - this.inputMin)/(this.inputMax - this.inputMin);
      
      // value is within range
      if (inValue < 0) inValue = 0;
      if (inValue > 1) inValue = 1;
      
      var outValue = inValue * (this.max - this.min) + this.min;
      
      // If we have an easing function use it
      if (this.easing) {
        outValue = easing[this.easing](outValue);
      }
      
      
     if (socket && boards[this._board]._ready && this.tolerance < Math.abs(outValue - this._lastUpdate)) {
        this._lastUpdate = outValue;
        socket.emit('call', { "board": this._board, "device": this._element, "method": "move", params: outValue });
      }
      this._update( outValue );
    }
    
  }
  
{'fraction_non_alphanumeric': 0.1430472388556221, 'fraction_numerical': 0.003992015968063872, 'mean_word_length': 2.0435222672064777, 'pattern_counts': {'":': 18, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5257025', 'n_tokens_mistral': 935, 'n_tokens_neox': 918, 'n_words': 248}