Skip to content

Commit

Permalink
Flip functions to arrow functions and fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
majgis committed Aug 1, 2016
1 parent 736161e commit 0708e40
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,13 +560,13 @@ controller.restoreTessel = function(opts) {
opts.usb = true;
opts.lan = false;
opts.altSetting = 1;
return controller.get(opts).then(function(tessel) {
return new Promise(function(resolve, reject) {
return controller.get(opts).then((tessel) => {
return new Promise((resolve, reject) => {
tessel.restore(opts)
.then(function(result) {
.then((result) => {
resolve(result);
})
.catch(function(err) {
.catch((err) => {
reject(err);
});
});
Expand Down
8 changes: 4 additions & 4 deletions lib/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function transaction(usbConnection, write, read, status_poll, wren, next) {

var data = concatToBuffer(hdr, write);

usbConnection.epOut.transfer(data, function(err) {
usbConnection.epOut.transfer(data, (err) => {
if (err) {
return next(err);
}
Expand Down Expand Up @@ -71,7 +71,7 @@ function eraseChip(usbConnection, next) {
// Poll for the WIP bit in the status register to go low
function waitTransactionComplete(usbConnection, next) {
setTimeout(function onWait() {
getStatus(usbConnection, function onGetStatus(err, status) {
getStatus(usbConnection, (err, status) => {
if (err) {
return next(err);
}
Expand All @@ -85,7 +85,7 @@ function waitTransactionComplete(usbConnection, next) {

// Read the status register
function getStatus(usbConnection, next) {
transaction(usbConnection, [0x05], 1, null, null, function onGetStatus(err, data) {
transaction(usbConnection, [0x05], 1, null, null,(err, data) => {
next(err, data ? data[0] : data);
});
}
Expand All @@ -101,7 +101,7 @@ function write(usbConnection, writeAddress, data, sliceStart, next) {

var sliceEnd = sliceStart + PAGE;
var pageData = data.slice(sliceStart, sliceEnd);
writePage(usbConnection, writeAddress, pageData, function onWrite(err) {
writePage(usbConnection, writeAddress, pageData, (err) => {
if (err) {
return next(err);
}
Expand Down
22 changes: 10 additions & 12 deletions lib/tessel/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@ Tessel.prototype.restore = function restore() {
var usbConnection = this.connection;
return new Promise((resolve, reject) => {

log.info('Proceeding with updating OpenWrt...');
log.info('Proceeding with updating OpenWrt...');

// download images
return update.fetchRestore()
.then((result) => {
flash(usbConnection, result.uboot, result.squashfs, (err) => {
if (err) {
return reject(err);
}
resolve();
});
// download images
return update.fetchRestore()
.then((result) => {
flash(usbConnection, result.uboot, result.squashfs, (err) => {
if (err) {
return reject(err);
}
resolve();
});


});
});
};

0 comments on commit 0708e40

Please sign in to comment.