From eba0e205f52d601a269c79665ca6023605e20e86 Mon Sep 17 00:00:00 2001 From: adambla76 Date: Sun, 10 Nov 2019 14:40:16 +0100 Subject: [PATCH 01/13] Create testy.ts --- testy.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 testy.ts diff --git a/testy.ts b/testy.ts new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/testy.ts @@ -0,0 +1 @@ + From 37bcbb378e34a9a5a155d8f141d3bc65209c8cfa Mon Sep 17 00:00:00 2001 From: adambla76 Date: Sun, 10 Nov 2019 14:42:49 +0100 Subject: [PATCH 02/13] Update main.ts --- main.ts | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/main.ts b/main.ts index 7f72883..0acf2e2 100644 --- a/main.ts +++ b/main.ts @@ -265,12 +265,7 @@ namespace grove { this.bit(dispData, 3); this.bit(0x7f, 2); this.bit(0x7f, 1); - this.bit(0x7f, 0); - - this.buf[3] = dispData; - this.buf[2] = 0x7f; - this.buf[1] = 0x7f; - this.buf[0] = 0x7f; + this.bit(0x7f, 0); } else if(dispData < 100) { @@ -278,11 +273,6 @@ namespace grove { this.bit((dispData / 10) % 10, 2); this.bit(0x7f, 1); this.bit(0x7f, 0); - - this.buf[3] = dispData % 10; - this.buf[2] = (dispData / 10) % 10; - this.buf[1] = 0x7f; - this.buf[0] = 0x7f; } else if(dispData < 1000) { @@ -290,11 +280,6 @@ namespace grove { this.bit((dispData / 10) % 10, 2); this.bit((dispData / 100) % 10, 1); this.bit(0x7f, 0); - - this.buf[3] = dispData % 10; - this.buf[2] = (dispData / 10) % 10; - this.buf[1] = (dispData / 100) % 10; - this.buf[0] = 0x7f; } else { @@ -302,11 +287,6 @@ namespace grove { this.bit((dispData / 10) % 10, 2); this.bit((dispData / 100) % 10, 1); this.bit((dispData / 1000) % 10, 0); - - this.buf[3] = dispData % 10; - this.buf[2] = (dispData / 10) % 10; - this.buf[1] = (dispData / 100) % 10; - this.buf[0] = (dispData / 1000) % 10; } } @@ -583,4 +563,4 @@ namespace grove { }) } -} \ No newline at end of file +} From 48ab57de244214e52042d14f013b1c19664aff42 Mon Sep 17 00:00:00 2001 From: adambla76 Date: Sun, 10 Nov 2019 14:45:08 +0100 Subject: [PATCH 03/13] Update pxt.json new ver --- pxt.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxt.json b/pxt.json index 869fea7..15903fd 100644 --- a/pxt.json +++ b/pxt.json @@ -1,6 +1,6 @@ { "name": "Grove", - "version": "0.1.5", + "version": "0.1.6", "description": "A Microsoft MakeCode package for Seeed Studio Grove module", "license": "MIT", "dependencies": { From f65efbaf40df147204abf32d784d94eb87337612 Mon Sep 17 00:00:00 2001 From: adambla76 Date: Sun, 10 Nov 2019 15:01:17 +0100 Subject: [PATCH 04/13] =?UTF-8?q?ma=C5=82a=20zmiana?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.ts b/main.ts index 0acf2e2..dea58a3 100644 --- a/main.ts +++ b/main.ts @@ -292,7 +292,7 @@ namespace grove { /** * Set the brightness level of display at from 0 to 7 - * @param level value of brightness level + * @param level value of brightness light level */ //% blockId=grove_tm1637_set_display_level block="%strip|brightness level to|%level" //% level.min=0 level.max=7 From f1dba411b06a790b20f5e0540157fd5e62f53dc7 Mon Sep 17 00:00:00 2001 From: adambla76 Date: Sun, 10 Nov 2019 18:37:14 +0100 Subject: [PATCH 05/13] text --- testy.ts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 testy.ts diff --git a/testy.ts b/testy.ts deleted file mode 100644 index 8b13789..0000000 --- a/testy.ts +++ /dev/null @@ -1 +0,0 @@ - From dff3c9bf7689b74e50bf1409886322af76c7d99d Mon Sep 17 00:00:00 2001 From: adambla76 Date: Sun, 10 Nov 2019 19:15:29 +0100 Subject: [PATCH 06/13] math.floor fix --- main.ts | 12 ++++++------ pxt.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.ts b/main.ts index dea58a3..768cb24 100644 --- a/main.ts +++ b/main.ts @@ -270,23 +270,23 @@ namespace grove { else if(dispData < 100) { this.bit(dispData % 10, 3); - this.bit((dispData / 10) % 10, 2); + this.bit(Math.floor(dispData / 10) % 10, 2); this.bit(0x7f, 1); this.bit(0x7f, 0); } else if(dispData < 1000) { this.bit(dispData % 10, 3); - this.bit((dispData / 10) % 10, 2); - this.bit((dispData / 100) % 10, 1); + this.bit(Math.floor(dispData / 10) % 10, 2); + this.bit(Math.floor(dispData / 100) % 10, 1); this.bit(0x7f, 0); } else { this.bit(dispData % 10, 3); - this.bit((dispData / 10) % 10, 2); - this.bit((dispData / 100) % 10, 1); - this.bit((dispData / 1000) % 10, 0); + this.bit(Math.floor(dispData / 10) % 10, 2); + this.bit(Math.floor(dispData / 100) % 10, 1); + this.bit(Math.floor(dispData / 1000) % 10, 0); } } diff --git a/pxt.json b/pxt.json index 15903fd..ba933d7 100644 --- a/pxt.json +++ b/pxt.json @@ -1,6 +1,6 @@ { "name": "Grove", - "version": "0.1.6", + "version": "0.1.7", "description": "A Microsoft MakeCode package for Seeed Studio Grove module", "license": "MIT", "dependencies": { From 90d23f74fd4dd0e3779722f672edd50cd5fcba06 Mon Sep 17 00:00:00 2001 From: Michael Klein <37311672+MKleinSB@users.noreply.github.com> Date: Wed, 13 Nov 2019 15:34:04 +0100 Subject: [PATCH 07/13] add german locale --- _locales/de/Grove-strings.json | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 _locales/de/Grove-strings.json diff --git a/_locales/de/Grove-strings.json b/_locales/de/Grove-strings.json new file mode 100644 index 0000000..d137aff --- /dev/null +++ b/_locales/de/Grove-strings.json @@ -0,0 +1,39 @@ +{ + "{id:category}Grove": "Grove", + "GroveGesture.None|block": "keine", + "GroveGesture.Right|block": "rechts", + "GroveGesture.Left|block": "links", + "GroveGesture.Up|block": "auf", + "GroveGesture.Down|block": "nieder", + "GroveGesture.Forward|block": "vorwärts", + "GroveGesture.Backward|block": "rückwärts", + "GroveGesture.Clockwise|block": "Uhrzeigersinn", + "GroveGesture.Anticlockwise|block": "Gegenuhrzeigersinn", + "GroveGesture.Wave|block": "Welle", + "grove.initGesture|block": "initialisiere Grove Gestenerkennung", + "grove.getGestureModel|block": "hole Geste", + "grove.onGesture|block": "wenn Grove - Gestensensor |%gesture|", + "grove.measureInCentimeters|block": "Ultraschallsensor (in cm) an |%pin", + "grove.measureInInches|block": "Ultraschallsensor (in inch) an |%pin", + "grove.createDisplay|block": "4-Ziffern Display an|%clkPin|und|%dataPin", + "grove.PAJ7620.init|block": "%strip|initialisiere den Gestensensor", + "grove.PAJ7620.read|block": "%strip|erkenne Geste", + "grove.TM1637.show|block": "%strip|zeige Zahl|%dispData|", + "grove.TM1637.set|block": "%strip|setze Helligkeit auf|%level|", + "grove.TM1637.bit|block": "%strip|zeige Ziffer|%dispData|an Stelle|%bitAddr|", + "grove.TM1637.point|block": "%strip|schalte Kommapunkt|%point|", + "grove.TM1637.clear|block": "%strip|lösche 4-Ziffern Display", + "GroveJoystickKey.None|block": "Keiner", + "GroveJoystickKey.Right|block": "Rechts", + "GroveJoystickKey.Left|block": "Links", + "GroveJoystickKey.Up|block": "Hoch", + "GroveJoystickKey.Down|block": "Runter", + "GroveJoystickKey.UL|block": "Oben links", + "GroveJoystickKey.UR|block": "Oben rechts", + "GroveJoystickKey.LL|block": "Unten links", + "GroveJoystickKey.LR|block": "Unten rechts", + "GroveJoystickKey.Press|block": "Gedrückt", + "grove.strip.read|block": "%strip|lies Position von Joystick an|%xpin|und|%ypin", + "grove.onJoystick|block": "wenn Grove - Joysticktaste|%key an|%xpin|und|%ypin", + "grove.getJoystick|block": "hole Joysticktaste an|%xpin|und|%ypin" +} From a97427ee4945138939f587150fecff3754e59243 Mon Sep 17 00:00:00 2001 From: Michael Klein <37311672+MKleinSB@users.noreply.github.com> Date: Wed, 13 Nov 2019 15:39:05 +0100 Subject: [PATCH 08/13] fixed missing arguments for blocks --- main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 768cb24..535bb7c 100644 --- a/main.ts +++ b/main.ts @@ -375,7 +375,7 @@ namespace grove { * @param xPin * @param yPin */ - //% blockId=grove_joystick_read block="%strip|read position of joystick" + //% blockId=grove_joystick_read block="%strip|read position of joystick at|%xpin|and|%ypin" //% advanced=true read(xPin: AnalogPin, yPin: AnalogPin): number { let xdata = 0, ydata = 0, result = 0; @@ -548,7 +548,7 @@ namespace grove { * @param ypin * @param handler code to run */ - //% blockId=grove_joystick_create_event block="on Key|%key" + //% blockId=grove_joystick_create_event block="on Key|%key at |%xpin|and|%ypin" export function onJoystick(key: GroveJoystickKey, xpin: AnalogPin, ypin: AnalogPin, handler: () => void) { control.onEvent(joystickEventID, key, handler); control.inBackground(() => { From f006a8b1156d5a2f2f13e17d86abedbcebba7626 Mon Sep 17 00:00:00 2001 From: Michael Klein <37311672+MKleinSB@users.noreply.github.com> Date: Wed, 13 Nov 2019 15:40:30 +0100 Subject: [PATCH 09/13] added german locale --- pxt.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxt.json b/pxt.json index ba933d7..bbb7d99 100644 --- a/pxt.json +++ b/pxt.json @@ -9,7 +9,8 @@ "files": [ "README.md", "main.ts", - "_locales/ja/Grove-strings.json" + "_locales/ja/Grove-strings.json", + "_locales/de/Grove-strings.json" ], "testFiles": [ "test.ts" From 1d519569600ee82cd69f0041aec6fb277022c5de Mon Sep 17 00:00:00 2001 From: sidikalamini <33785823+sidikalamini@users.noreply.github.com> Date: Mon, 18 Nov 2019 22:16:50 +0800 Subject: [PATCH 10/13] Update main.ts update error of x instead of y --- main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.ts b/main.ts index 535bb7c..d0a7bfe 100644 --- a/main.ts +++ b/main.ts @@ -513,7 +513,7 @@ namespace grove { * get Joystick key * */ - //% blockId=grove_getjoystick block="get joystick key at|%xpin|and|%xpin" + //% blockId=grove_getjoystick block="get joystick key at|%xpin|and|%ypin" export function getJoystick(xpin: AnalogPin, ypin: AnalogPin): number { return joystick.read(xpin, ypin); } From cfeeada678f63e957d1653912316d8a2a2a34215 Mon Sep 17 00:00:00 2001 From: MiroChao <531414952@qq.com> Date: Thu, 2 Jan 2020 10:17:09 +0800 Subject: [PATCH 11/13] Update main.ts --- main.ts | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/main.ts b/main.ts index d0a7bfe..d70f5c6 100644 --- a/main.ts +++ b/main.ts @@ -260,6 +260,10 @@ namespace grove { //% blockId=grove_tm1637_display_number block="%strip|show number|%dispData" show(dispData: number) { + let compare_01:number = Math.floor(dispData / 10); + let compare_001:number = Math.floor(dispData / 100); + let compare_0001:number = Math.floor(dispData / 1000); + if(dispData < 10) { this.bit(dispData, 3); @@ -270,23 +274,48 @@ namespace grove { else if(dispData < 100) { this.bit(dispData % 10, 3); - this.bit(Math.floor(dispData / 10) % 10, 2); + if(dispData > 90){ + this.bit(9, 2); + } else{ + this.bit(Math.floor(dispData / 10) % 10, 2); + } + this.bit(0x7f, 1); this.bit(0x7f, 0); } else if(dispData < 1000) { this.bit(dispData % 10, 3); - this.bit(Math.floor(dispData / 10) % 10, 2); - this.bit(Math.floor(dispData / 100) % 10, 1); + if(compare_01 > 90){ + this.bit(9, 2); + } else{ + this.bit(Math.floor(dispData / 10) % 10, 2); + } + if(compare_001 > 900){ + this.bit(9, 1); + } else{ + this.bit(Math.floor(dispData / 100) % 10, 1); + } this.bit(0x7f, 0); } else { this.bit(dispData % 10, 3); - this.bit(Math.floor(dispData / 10) % 10, 2); - this.bit(Math.floor(dispData / 100) % 10, 1); - this.bit(Math.floor(dispData / 1000) % 10, 0); + if(compare_01 > 90){ + this.bit(9, 2); + } else{ + this.bit(Math.floor(dispData / 10) % 10, 2); + } + if(compare_001 > 900){ + this.bit(9, 1); + } else{ + this.bit(Math.floor(dispData / 100) % 10, 1); + } + if(compare_0001 > 9000){ + this.bit(9, 0); + } else{ + this.bit(Math.floor(dispData / 1000) % 10, 0); + } } } From f2f5a34bd506c7b31ff859838467cebe3cfeb4b7 Mon Sep 17 00:00:00 2001 From: MiroChao <531414952@qq.com> Date: Thu, 2 Jan 2020 10:48:28 +0800 Subject: [PATCH 12/13] Update main.ts --- main.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.ts b/main.ts index d70f5c6..a1e98e1 100644 --- a/main.ts +++ b/main.ts @@ -260,9 +260,8 @@ namespace grove { //% blockId=grove_tm1637_display_number block="%strip|show number|%dispData" show(dispData: number) { - let compare_01:number = Math.floor(dispData / 10); - let compare_001:number = Math.floor(dispData / 100); - let compare_0001:number = Math.floor(dispData / 1000); + let compare_01:number = dispData % 100; + let compare_001:number = dispData % 1000; if(dispData < 10) { @@ -311,7 +310,7 @@ namespace grove { } else{ this.bit(Math.floor(dispData / 100) % 10, 1); } - if(compare_0001 > 9000){ + if(dispData > 9000){ this.bit(9, 0); } else{ this.bit(Math.floor(dispData / 1000) % 10, 0); From 81b6a600cbaf18c485a8c9b9a612f396e0a68609 Mon Sep 17 00:00:00 2001 From: MiroChao <531414952@qq.com> Date: Thu, 2 Jan 2020 10:56:40 +0800 Subject: [PATCH 13/13] Update main.ts --- main.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.ts b/main.ts index a1e98e1..c088082 100644 --- a/main.ts +++ b/main.ts @@ -297,7 +297,7 @@ namespace grove { } this.bit(0x7f, 0); } - else + else if(dispData < 10000) { this.bit(dispData % 10, 3); if(compare_01 > 90){ @@ -316,6 +316,13 @@ namespace grove { this.bit(Math.floor(dispData / 1000) % 10, 0); } } + else + { + this.bit(9, 3); + this.bit(9, 2); + this.bit(9, 1); + this.bit(9, 0); + } } /**