Skip to content

Commit

Permalink
更新 _locales/zh-cn/maqueenPlusV2-strings.json, maqueenPlusV2.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
LinDong88 committed Dec 24, 2024
1 parent f4f974f commit fd52c73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions _locales/zh-cn/maqueenPlusV2-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": "全部",
Expand Down
14 changes: 8 additions & 6 deletions maqueenPlusV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}

/**
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit fd52c73

Please sign in to comment.