rem: pwm[pin.pwm.path] = {}; pwm[pin.pwm.path].key = '' + pin.key; pwm[pin.pwm.path].freq = freq; f.pinMode(pin, gOUTPUT, pin.pwm.muxmode, 'disabled', 'fast'); 
add: if(pwm[pin.pwm.name].freq != freq) { fs.writeFileSync(pwm[pin.pwm.name].old_pwm_path+'/run', '0'); fs.writeFileSync(pwm[pin.pwm.name].old_pwm_path+'/duty_percent', '0'); fs.writeFileSync(pwm[pin.pwm.name].old_pwm_path+'/period_freq', Math.round(freq)); fs.writeFileSync(pwm[pin.pwm.name].old_pwm_path+'/run', '1'); pwm[pin.pwm.name].freq = freq; } fs.writeFileSync(pwm[pin.pwm.name].old_pwm_path+'/duty_percent', Math.round(value*100)); } 
context: f.analogWrite = function(pin, value, freq, callback) {    pin = getpin(pin);    freq = freq || 1000;    var path = '/sys/class/pwm/' + pin.pwm.path;    //var curMode = getPinMode(pin);    // Not yet possible to implement this test    //if(curMode.direction != OUTPUT) {    //    throw(pin.key + ' must be configured as OUTPUT for analogWrite()');    //}    if(!pin.pwm) {        throw(pin.key + ' does not support analogWrite()');    }    if(pwm[pin.pwm.path] && pwm[pin.pwm.path].key) {        if(pwm[pin.pwm.path].key != pin.key) {            throw(pin.key + ' requires pwm ' + pin.pwm.name +                ' but it is already in use by ' +                pwm[pin.pwm].key            );         }    } else {        pwm[pin.pwm.path] = {};        pwm[pin.pwm.path].key = '' + pin.key;        pwm[pin.pwm.path].freq = freq;        f.pinMode(pin, gOUTPUT, pin.pwm.muxmode, 'disabled', 'fast');        // Clear up any unmanaged usage        fs.writeFileSync(path+'/request', '0');        // Allocate and configure the PWM        fs.writeFileSync(path+'/request', '1');        fs.writeFileSync(path+'/period_freq', freq);        fs.writeFileSync(path+'/polarity', '0');        fs.writeFileSync(path+'/run', '1');    }    if(pwm[pin.pwm.path].freq != freq) {        fs.writeFileSync(path+'/run', '0');        fs.writeFileSync(path+'/duty_percent', '0');        fs.writeFileSync(path+'/period_freq', freq);        fs.writeFileSync(path+'/run', '1');        pwm[pin.pwm.path].freq = freq;    }    fs.writeFileSync(path+'/duty_percent', Math.round(value*100));    if(callback) callback();};
meta: 3863	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3863/ce011b7f00c4b14c71589e8986ebe4bce3c6f151/index.js/buggy/node_modules/bonescript/index.js