From d69bd0e0e48fd68dbac2cdcdef4e0292394e6f92 Mon Sep 17 00:00:00 2001 From: thinkberg Date: Sun, 19 Feb 2017 11:19:26 +0100 Subject: [PATCH] fix play ringtone (#MINI-32) --- libs/core/_locales/core-strings.json | 2 -- libs/core/music.cpp | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 33649d06..e0ef32da 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -94,9 +94,7 @@ "Rotation.Roll|block": "roll", "String.charAt|block": "char from %this=text|at %pos", "String.compare|block": "compare %this=text| to %that", - "String.concat|block": "join %this=text|%other", "String.fromCharCode|block": "text from char code %code", - "String.isEmpty|block": "%this=text| is empty", "String.length|block": "length of %VALUE", "String.substr|block": "substring of %this=text|from %start|of length %length", "String|block": "String", diff --git a/libs/core/music.cpp b/libs/core/music.cpp index 5154b9b4..b78557bd 100644 --- a/libs/core/music.cpp +++ b/libs/core/music.cpp @@ -9,9 +9,13 @@ namespace music { //% help=music/play-tone weight=90 //% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8 //% parts="speaker" async - void playTone(int freqency, int ms) { - uBit.soundmotor.soundOn(freqency); - if(ms > 0) uBit.sleep(ms); - uBit.soundmotor.soundOff(); + void playTone(int frequency, int ms) { + if(frequency > 0) uBit.soundmotor.soundOn(frequency); + else uBit.soundmotor.soundOff(); + if(ms > 0) { + uBit.sleep(ms); + uBit.soundmotor.soundOff(); + } + } }