Skip to content

Commit

Permalink
Fix to wait the commands was sent at setPullMode(), setDigitalOut()
Browse files Browse the repository at this point in the history
  • Loading branch information
yokobond committed Sep 7, 2021
1 parent b2afae6 commit 14a4a79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3087,10 +3087,11 @@ class MbitMoreBlocks {
* @param {number} args.PIN - pin ID.
* @param {MbitMorePullModeName} args.MODE - mode to set.
* @param {BlockUtility} util - utility object provided by the runtime.
* @return {undefined}
* @return {promise | undefined} - a Promise that resolves when the command was sent
* or undefined if this process was yield.
*/
setPullMode (args, util) {
this._peripheral.setPullMode(parseInt(args.PIN, 10), MbitMorePullModeID[args.MODE], util);
return this._peripheral.setPullMode(parseInt(args.PIN, 10), MbitMorePullModeID[args.MODE], util);
}

/**
Expand All @@ -3099,7 +3100,8 @@ class MbitMoreBlocks {
* @param {number} args.PIN - pin ID.
* @param {boolean | string | number} args.LEVEL - value to be set.
* @param {object} util - utility object provided by the runtime.
* @return {undefined}
* @return {promise | undefined} - a Promise that resolves when the command was sent
* or undefined if this process was yield.
*/
setDigitalOut (args, util) {
let level = (args.LEVEL === true);
Expand All @@ -3110,7 +3112,7 @@ class MbitMoreBlocks {
level = (num > 0);
}
}
this._peripheral.setPinOutput(parseInt(args.PIN, 10), level, util);
return this._peripheral.setPinOutput(parseInt(args.PIN, 10), level, util);
}

/**
Expand Down

0 comments on commit 14a4a79

Please sign in to comment.