Skip to content

Commit c7835d0

Browse files
authored
Merge pull request #2472 from RoboroboLab/develop-hw
Dotmatrix 블록 형태 변경
2 parents 1558968 + 60254e2 commit c7835d0

File tree

1 file changed

+49
-16
lines changed

1 file changed

+49
-16
lines changed

src/playground/blocks/hardware/block_roborobo_robokit_rs.js

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class RobokitRS extends ArduinoBase {
103103
robokit_rs_menu_pin: '%1',
104104
robokit_rs_menu_digital_value: '%1',
105105
robokit_rs_menu_motor_number: '%1',
106+
robokit_rs_menu_dotmatrix_row: '%1',
106107

107108
robokit_rs_set_digital: '%1 번 핀 디지털 값을 %2 (으)로 정하기 %3',
108109
robokit_rs_set_motor: '%1 번 모터를 속도 %2 (으)로 %3 %4',
@@ -163,6 +164,7 @@ class RobokitRS extends ArduinoBase {
163164
robokit_rs_mecanumwheels_state_ccw: '시계 반대 방향 회전',
164165
robokit_rs_mecanumwheels_state_stop: '정지',
165166

167+
robokit_rs_dotmatrix_example_all: '모두',
166168
robokit_rs_dotmatrix_example_eighth_note: '8분 음표',
167169
robokit_rs_dotmatrix_example_sixteenth_note: '16분 음표',
168170
robokit_rs_dotmatrix_example_square: '네모',
@@ -250,6 +252,7 @@ class RobokitRS extends ArduinoBase {
250252
robokit_rs_menu_pin: '%1',
251253
robokit_rs_menu_digital_value: '%1',
252254
robokit_rs_menu_motor_number: '%1',
255+
robokit_rs_menu_dotmatrix_row: '%1',
253256

254257
robokit_rs_set_digital: 'set pin %1 digital value to %2 %3',
255258
robokit_rs_set_motor: 'set motor %1 speed to %2 %3 %4',
@@ -310,6 +313,7 @@ class RobokitRS extends ArduinoBase {
310313
robokit_rs_mecanumwheels_state_ccw: 'rotate counterclockwise',
311314
robokit_rs_mecanumwheels_state_stop: 'stop',
312315

316+
robokit_rs_dotmatrix_example_all: 'all',
313317
robokit_rs_dotmatrix_example_eighth_note: 'eighth note',
314318
robokit_rs_dotmatrix_example_sixteenth_note: 'sixteenth note',
315319
robokit_rs_dotmatrix_example_square: 'square',
@@ -572,6 +576,40 @@ class RobokitRS extends ArduinoBase {
572576
return script.getStringField('NUM');
573577
},
574578
},
579+
robokit_rs_menu_dotmatrix_row: {
580+
color: EntryStatic.colorSet.block.default.HARDWARE,
581+
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
582+
skeleton: 'basic_string_field',
583+
statements: [],
584+
params: [
585+
{
586+
type: 'Dropdown',
587+
options: [
588+
['0', '0'],
589+
['1', '1'],
590+
['2', '2'],
591+
['3', '3'],
592+
['4', '4'],
593+
['5', '5'],
594+
['6', '6'],
595+
],
596+
value: '0',
597+
fontSize: 11,
598+
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
599+
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
600+
},
601+
],
602+
events: {},
603+
def: {
604+
params: [null],
605+
},
606+
paramsKeyMap: {
607+
Y: 0,
608+
},
609+
func: (sprite, script) => {
610+
return script.getStringField('Y');
611+
},
612+
},
575613
robokit_rs_set_digital: {
576614
color: EntryStatic.colorSet.block.default.HARDWARE,
577615
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
@@ -585,6 +623,7 @@ class RobokitRS extends ArduinoBase {
585623
{
586624
type: 'Block',
587625
accept: 'string',
626+
defualtType: 'number',
588627
},
589628
{
590629
type: 'Indicator',
@@ -1036,20 +1075,9 @@ class RobokitRS extends ArduinoBase {
10361075
statements: [],
10371076
params: [
10381077
{
1039-
type: 'Dropdown',
1040-
options: [
1041-
['0', '0'],
1042-
['1', '1'],
1043-
['2', '2'],
1044-
['3', '3'],
1045-
['4', '4'],
1046-
['5', '5'],
1047-
['6', '6'],
1048-
],
1049-
value: '0',
1050-
fontSize: 11,
1051-
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
1052-
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
1078+
type: 'Block',
1079+
accept: 'string',
1080+
defualtType: 'number',
10531081
},
10541082
{
10551083
type: 'Block',
@@ -1135,7 +1163,9 @@ class RobokitRS extends ArduinoBase {
11351163
events: {},
11361164
def: {
11371165
params: [
1138-
null,
1166+
{
1167+
type: 'robokit_rs_menu_dotmatrix_row'
1168+
},
11391169
{
11401170
type: 'number',
11411171
params: ['0'],
@@ -1218,6 +1248,7 @@ class RobokitRS extends ArduinoBase {
12181248
{
12191249
type: 'Dropdown',
12201250
options: [
1251+
[Lang.Blocks.robokit_rs_dotmatrix_example_all, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'],
12211252
[Lang.Blocks.robokit_rs_dotmatrix_example_eighth_note, '000000000000000000000011000000000000010100000000000010100000000001110100000000011110000000000001100000000'],
12221253
[Lang.Blocks.robokit_rs_dotmatrix_example_sixteenth_note, '000000001111000000000011001000000000010001000000000010011000000001110111000000011110111000000001100000000'],
12231254
[Lang.Blocks.robokit_rs_dotmatrix_example_square, '000111111111000000111111111000000110000011000000110000011000000110000011000000111111111000000111111111000'],
@@ -1281,7 +1312,7 @@ class RobokitRS extends ArduinoBase {
12811312
['←', '000000000000000000000100000000000001000000000000011111110000000001000000000000000100000000000000000000000'],
12821313
['↖', '000011110000000000011000000000000010100000000000010010000000000000001000000000000000100000000000000010000'],
12831314
],
1284-
value: '000000000000000000000011000000000000010100000000000010100000000001110100000000011110000000000001100000000',
1315+
value: '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
12851316
fontSize: 11,
12861317
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
12871318
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
@@ -2068,6 +2099,8 @@ class RobokitRS extends ArduinoBase {
20682099

20692100
set_dotmatrix_row (sprite, script) {
20702101
const y = script.getNumberValue('Y');
2102+
if (y < 0 || y > 6) return script.callReturn();
2103+
20712104
let dots = '';
20722105
for (let i = 0; i < 16; i++) {
20732106
const value = script.getNumberValue('X' + i);

0 commit comments

Comments
 (0)