From fd52c73ab4ea6452efe979199e81ffea8e38e6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=8D=A3?= <1595243018@qq.com> Date: Tue, 24 Dec 2024 14:42:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=5Flocales/zh-cn/maqueenPl?= =?UTF-8?q?usV2-strings.json,=20maqueenPlusV2.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _locales/zh-cn/maqueenPlusV2-strings.json | 16 ++++++++-------- maqueenPlusV2.ts | 14 ++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/_locales/zh-cn/maqueenPlusV2-strings.json b/_locales/zh-cn/maqueenPlusV2-strings.json index a83a5c3..a1885cb 100644 --- a/_locales/zh-cn/maqueenPlusV2-strings.json +++ b/_locales/zh-cn/maqueenPlusV2-strings.json @@ -48,10 +48,10 @@ "maqueenPlusV2.CarLightColors.Black|block": "熄灭", "maqueenPlusV2.setPatrolSpeed|block": "巡线设置 速度%speed=PatrolSpeed_conv", "maqueenPlusV2.setMotorType|block": "电机类型 %type", - "maqueenPlusV2.setIntersectionRunMode|block": "十字路口时 %mode", - "maqueenPlusV2.setTRordRunMode|block": "T字路口时 %mode", - "maqueenPlusV2.setLeftOrStraightRunMode|block": "左转及直行路口时 %mode", - "maqueenPlusV2.setRightOrStraightRunMode|block": "右转及直行路口时 %mode", + "maqueenPlusV2.setIntersectionRunMode|block": "下个十字路口时 %mode", + "maqueenPlusV2.setTRordRunMode|block": "下个T字路口时 %mode", + "maqueenPlusV2.setLeftOrStraightRunMode|block": "下个左转及直行路口时 %mode", + "maqueenPlusV2.setRightOrStraightRunMode|block": "下个右转及直行路口时 %mode", "maqueenPlusV2.patrolling|block": "巡线 %patrol", "maqueenPlusV2.intersectionDetecting|block": "路口检测", "maqueenPlusV2.readLightIntensity|block": "读取光线值 %type", @@ -68,15 +68,15 @@ "maqueenPlusV2.Intersection.Stop|block": "停止", "maqueenPlusV2.Trord.Left|block": "左转", "maqueenPlusV2.Trord.Right|block": "右转", - "maqueenPlusV2.Trord.Stop|block": "停止", + "maqueenPlusV2.Trord.Stop|block": "停止巡线", "maqueenPlusV2.LeftOrStraight.Straight|block": "直行", "maqueenPlusV2.LeftOrStraight.Left|block": "左转", - "maqueenPlusV2.LeftOrStraight.Stop|block": "停止", + "maqueenPlusV2.LeftOrStraight.Stop|block": "停止巡线", "maqueenPlusV2.RightOrStraight.Straight|block": "直行", "maqueenPlusV2.RightOrStraight.Right|block": "右转", - "maqueenPlusV2.RightOrStraight.Stop|block": "停止", + "maqueenPlusV2.RightOrStraight.Stop|block": "停止巡线", "maqueenPlusV2.Patrolling.ON|block": "开启", - "maqueenPlusV2.Patrolling.OFF|block": "停止", + "maqueenPlusV2.Patrolling.OFF|block": "停止巡线", "maqueenPlusV2.DirectionType.Left|block": "左", "maqueenPlusV2.DirectionType.Right|block": "右", "maqueenPlusV2.DirectionType.All|block": "全部", diff --git a/maqueenPlusV2.ts b/maqueenPlusV2.ts index e954efb..dee8f3d 100644 --- a/maqueenPlusV2.ts +++ b/maqueenPlusV2.ts @@ -143,6 +143,13 @@ namespace maqueenPlusV2 { //%block="initialize via I2C until success" export function I2CInit(): void { let Version_v = 0; + //V3 systemReset + let allBuffer = pins.createBuffer(2); + allBuffer[0] = 0x49; + allBuffer[1] = 1; + pins.i2cWriteBuffer(I2CADDR, allBuffer); + basic.pause(100);//waiting reset + pins.i2cWriteNumber(I2CADDR, 0x32, NumberFormat.Int8LE); Version_v = pins.i2cReadNumber(I2CADDR, NumberFormat.Int8LE); while (Version_v == 0) { @@ -167,11 +174,6 @@ namespace maqueenPlusV2 { `, 10) basic.pause(500) basic.clearScreen() - //V3 systemInit - let allBuffer = pins.createBuffer(2); - allBuffer[0] = 73; - allBuffer[1] = 1; - pins.i2cWriteBuffer(I2CADDR, allBuffer) } /** @@ -872,7 +874,7 @@ namespace maqueenPlusV2 { let allBuffer = pins.createBuffer(4); pins.i2cWriteNumber(I2CADDR, 78, NumberFormat.Int8LE); allBuffer = pins.i2cReadBuffer(I2CADDR, 4); - if(type==DirectionType2.Left) + if (type == DirectionType2.Left) return allBuffer[0] << 8 | allBuffer[1]; else return allBuffer[2] << 8 | allBuffer[3];