not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

159 lines
26 KiB

{
"HIGHLIGHTSTROKECOLORS": [
[
"rodi",
"#000000"
]
],
"ARGPLUGINS": [
[
"rodisenselight",
"var block = logo.blocks.blockList[blk];block.value = doRodiGetLightSensor(logo, blk);"
],
[
"rodisenseleft",
"var block = logo.blocks.blockList[blk];block.value = doRodiGetSensor(logo, blk, 0);"
],
[
"rodisenseright",
"var block = logo.blocks.blockList[blk];block.value = doRodiGetSensor(logo, blk, 1);"
],
[
"rodisee",
"var block = logo.blocks.blockList[blk];block.value = doRodiGetDistance(logo, blk);"
],
[
"rodimovestatus",
"var block = logo.blocks.blockList[blk];block.value = doRodiGetMoveStatus(logo, blk);"
]
],
"GLOBALS": "RODI_BASE_URL = 'http://192.168.4.1:1234';rodiSensorsCache = null;rodiSensorsValidFor = 100;rodiSensorsCacheExpires = 0;rodiLightSensorCache = null;rodiLightSensorValidFor = 100;rodiLightSensorCacheExpires = 0;rodiMoveStatus = _('stop');rodiDistanceCache = null;rodiDistanceValidFor = 100;rodiDistanceCacheExpires = 0;doRodiGetDistance = function (logo, blk) { if (logo.inStatusMatrix) { logo.statusFields.push([blk, logo.blocks.blockList[blk].name]); } else { if (Date.now() > rodiDistanceCacheExpires) { apiUrl = RODI_BASE_URL + '/5/'; distance = doSyncCall(logo, blk, apiUrl); if (distance != null) { rodiDistanceCacheExpires = Date.now() + rodiDistanceValidFor; rodiDistanceCache = distance; return distance; } else { return 100; } } else { return rodiDistanceCache; } }};doRodiGetMoveStatus = function (logo, blk) { if (logo.inStatusMatrix) { logo.statusFields.push([blk, logo.blocks.blockList[blk].name]); } else { return rodiMoveStatus; }};doRodiMove = function (logo, blk, left, right) { apiUrl = RODI_BASE_URL + '/3/' + left + '/' + right + '/'; if (left === right) { if (left < 0) { rodiMoveStatus = _('back'); } else if (left > 0) { rodiMoveStatus = _('forward'); } else { rodiMoveStatus = _('stop'); } } else { if (left > right) { rodiMoveStatus = _('right'); } else { rodiMoveStatus = _('left'); } } doAsyncCall(logo, blk, apiUrl)};doRodiGetSensor = function (logo, blk, index) { if (logo.inStatusMatrix) { logo.statusFields.push([blk, logo.blocks.blockList[blk].name]); } else { if (Date.now() > rodiSensorsCacheExpires) { apiUrl = RODI_BASE_URL + '/2/'; sensors = doSyncCall(logo, blk, apiUrl); if (sensors != null) { rodiSensorsCacheExpires = Date.now() + rodiSensorsValidFor; rodiSensorsCache = sensors; return sensors[index]; } else { return -1; } } else { return rodiSensorsCache[index]; } }};doRodiGetLightSensor = function (logo, blk) { if (logo.inStatusMatrix) { logo.statusFields.push([blk, logo.blocks.blockList[blk].name]); } else { if (Date.now() > rodiLightSensorCacheExpires) { apiUrl = RODI_BASE_URL + '/7/'; sensor = doSyncCall(logo, blk, apiUrl); if (sensor != null) { rodiLightSensorCacheExpires = Date.now() + rodiLightSensorValidFor; rodiLightSensorCache = sensor; return sensor; } else { return -1; } } else { return rodiLightSensorCache; } }};doAsyncCall = function (logo, blk, url){ console.log(url); try { request = new XMLHttpRequest(); request.open('GET', url, true); request.send(null); } catch (e) { if (logo != null) { logo.errorMsg(e, blk); } console.log(e); }};doSyncCall = function (logo, blk, url) { console.log(url); request = new XMLHttpRequest(); try { request.open('GET', url, false); request.send(null); return JSON.parse(request.responseText); } catch (e) { if (logo != null) { logo.errorMsg(e, blk); } console.log(e); return null; }};function doRodiStop(){ doRodiMove(null, null, 0, 0);};blocks.logo.stage.addEventListener('__STOP__', doRodiStop, false);",
"PALETTEHIGHLIGHTCOLORS": [
[
"rodi",
"#ced8f8"
]
],
"FLOWPLUGINS": [
[
"rodiblink",
"var block = logo.blocks.blockList[blk];var conns = block.connections;var rate = logo.parseArg(logo, turtle, conns[1]);var apiUrl = RODI_BASE_URL + '/1/' + rate + '/';doAsyncCall(logo, blk, apiUrl);"
],
[
"rodising",
"var block = logo.blocks.blockList[blk];var conns = block.connections;var note = logo.parseArg(logo, turtle, conns[1]);var duration = logo.parseArg(logo, turtle, conns[2]);var apiUrl = RODI_BASE_URL + '/4/' + note + '/' + duration + '/';doAsyncCall(logo, blk, apiUrl);"
],
[
"rodipixel",
"var block = logo.blocks.blockList[blk];var conns = block.connections;var red = logo.parseArg(logo, turtle, conns[1]);var green = logo.parseArg(logo, turtle, conns[2]);var blue = logo.parseArg(logo, turtle, conns[3]);var apiUrl = RODI_BASE_URL + '/6/' + red + '/' + green + '/' + blue + '/';doAsyncCall(logo, blk, apiUrl);"
],
[
"rodiled",
"var block = logo.blocks.blockList[blk];var conns = block.connections;var state = logo.parseArg(logo, turtle, conns[1]);var apiUrl = RODI_BASE_URL + '/8/' + state + '/';doAsyncCall(logo, blk, apiUrl);"
],
[
"rodimove",
"var block = logo.blocks.blockList[blk];var conns = block.connections;var left = logo.parseArg(logo, turtle, conns[1]);var right = logo.parseArg(logo, turtle, conns[2]);doRodiMove(logo, blk, left, right);"
],
[
"rodileft",
"doRodiMove(logo, blk, -100, 100);"
],
[
"rodiright",
"doRodiMove(logo, blk, 100, -100);"
],
[
"rodiback",
"doRodiMove(logo, blk, -100, -100);"
],
[
"rodiforward",
"doRodiMove(logo, blk, 100, 100);"
],
[
"rodistop",
"doRodiMove(logo, blk, 0, 0);"
]
],
"PALETTEPLUGINS": [
[
"rodi",
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><svg xmlns=\"http://www.w3.org/2000/svg\" id=\"svg2\" version=\"1.1\" height=\"55\" width=\"55\"> <path d=\"M 35.516203,8.5290201 C 22.94617,8.4975021 20.536671,8.9380889 15.981939,12.108873 8.040645,17.63697 5.5333178,28.725893 10.310252,37.186933 c 5.057023,8.956964 16.647266,12.342556 25.705513,7.50901 2.79002,-1.488868 6.53595,-5.248313 8.015725,-8.041727 1.480563,-2.794869 2.377437,-4.759722 2.678979,-10.981156 l 0,-17.1440399 -11.194266,0 z M 26.938244,13.920134 A 13.657546,13.657546 0 0 1 40.596015,27.577846 13.657546,13.657546 0 0 1 26.938244,41.235617 13.657546,13.657546 0 0 1 13.280472,27.577846 13.657546,13.657546 0 0 1 26.938244,13.920134 Z M 26.59609,22.93256 a 5.1346998,5.1346998 0 0 0 -5.13424,5.134241 5.1346998,5.1346998 0 0 0 5.13424,5.135393 5.1346998,5.1346998 0 0 0 5.134242,-5.135393 5.1346998,5.1346998 0 0 0 -5.134242,-5.134241 z\" style=\"fill:#009dd8;fill-opacity:1\" /> </svg>"
]
],
"BLOCKPLUGINS": [
[
"rodiblink",
"var rodiBlink = new ProtoBlock('rodiblink');rodiBlink.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodiblink'] = rodiBlink;rodiBlink.staticLabels.push(_('blink'));rodiBlink.adjustWidthToLabel();rodiBlink.oneArgBlock();rodiBlink.defaults.push(1000);"
],
[
"rodising",
"var rodiSing = new ProtoBlock('rodising');rodiSing.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodising'] = rodiSing;rodiSing.staticLabels.push(_('play'));rodiSing.staticLabels.push(_('note'));rodiSing.staticLabels.push(_('duration'));rodiSing.adjustWidthToLabel();rodiSing.twoArgBlock();rodiSing.dockTypes[1] = 'numberin';rodiSing.dockTypes[2] = 'numberin';rodiSing.defaults.push(31);rodiSing.defaults.push(250);"
],
[
"rodipixel",
"var rodiPixel = new ProtoBlock('rodipixel');rodiPixel.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodipixel'] = rodiPixel;rodiPixel.staticLabels.push(_('pixel color'));rodiPixel.staticLabels.push(_('red'));rodiPixel.staticLabels.push(_('green'));rodiPixel.staticLabels.push(_('blue'));rodiPixel.adjustWidthToLabel();rodiPixel.threeArgBlock();rodiPixel.dockTypes[1] = 'numberin';rodiPixel.dockTypes[2] = 'numberin';rodiPixel.dockTypes[3] = 'numberin';rodiPixel.defaults.push(0);rodiPixel.defaults.push(0);rodiPixel.defaults.push(0);"
],
[
"rodiled",
"var rodiLed = new ProtoBlock('rodiled');rodiLed.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodiled'] = rodiLed;rodiLed.staticLabels.push(_('led'));rodiLed.adjustWidthToLabel();rodiLed.oneArgBlock();rodiLed.defaults.push(1);"
],
[
"rodisenselight",
"var rodiSenseLight = new ProtoBlock('rodisenselight');rodiSenseLight.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodisenselight'] = rodiSenseLight;rodiSenseLight.staticLabels.push(_('light intensity'));rodiSenseLight.adjustWidthToLabel();rodiSenseLight.parameterBlock();"
],
[
"rodisenseleft",
"var rodiSenseLeft = new ProtoBlock('rodisenseleft');rodiSenseLeft.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodisenseleft'] = rodiSenseLeft;rodiSenseLeft.staticLabels.push(_('infrared light (left)'));rodiSenseLeft.adjustWidthToLabel();rodiSenseLeft.parameterBlock();"
],
[
"rodisenseright",
"var rodiSenseRight = new ProtoBlock('rodisenseright');rodiSenseRight.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodisenseright'] = rodiSenseRight;rodiSenseRight.staticLabels.push(_('infrared light (right)'));rodiSenseRight.adjustWidthToLabel();rodiSenseRight.parameterBlock();"
],
[
"rodisee",
"var rodiSee = new ProtoBlock('rodisee');rodiSee.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodisee'] = rodiSee;rodiSee.staticLabels.push(_('distance'));rodiSee.adjustWidthToLabel();rodiSee.parameterBlock();"
],
[
"rodimovestatus",
"var rodiMoveStatus = new ProtoBlock('rodimovestatus');rodiMoveStatus.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodimovestatus'] = rodiMoveStatus;rodiMoveStatus.staticLabels.push(_('status'));rodiMoveStatus.adjustWidthToLabel();rodiMoveStatus.parameterBlock();"
],
[
"rodimove",
"var rodiMove = new ProtoBlock('rodimove');rodiMove.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodimove'] = rodiMove;rodiMove.staticLabels.push(_('move'));rodiMove.staticLabels.push(_('left'));rodiMove.staticLabels.push(_('right'));rodiMove.adjustWidthToLabel();rodiMove.twoArgBlock();rodiMove.dockTypes[1] = 'numberin';rodiMove.dockTypes[2] = 'numberin';rodiMove.defaults.push(100);rodiMove.defaults.push(100);"
],
[
"rodileft",
"var rodiLeft = new ProtoBlock('rodileft');rodiLeft.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodileft'] = rodiLeft;rodiLeft.staticLabels.push(_('left'));rodiLeft.adjustWidthToLabel();rodiLeft.zeroArgBlock();"
],
[
"rodiright",
"var rodiRight = new ProtoBlock('rodiright');rodiRight.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodiright'] = rodiRight;rodiRight.staticLabels.push(_('right'));rodiRight.adjustWidthToLabel();rodiRight.zeroArgBlock();"
],
[
"rodiback",
"var rodiBack = new ProtoBlock('rodiback');rodiBack.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodiback'] = rodiBack;rodiBack.staticLabels.push(_('back'));rodiBack.adjustWidthToLabel();rodiBack.zeroArgBlock();"
],
[
"rodiforward",
"var rodiForward = new ProtoBlock('rodiforward');rodiForward.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodiforward'] = rodiForward;rodiForward.staticLabels.push(_('forward'));rodiForward.adjustWidthToLabel();rodiForward.zeroArgBlock();"
],
[
"rodistop",
"var rodiStop = new ProtoBlock('rodistop');rodiStop.palette = palettes.dict['rodi'];blocks.protoBlockDict['rodistop'] = rodiStop;rodiStop.staticLabels.push(_('stop'));rodiStop.adjustWidthToLabel();rodiStop.zeroArgBlock();"
]
],
"PALETTEFILLCOLORS": [
[
"rodi",
"#6a8df6"
]
],
"PALETTESTROKECOLORS": [
[
"rodi",
"#5a7de6"
]
]
}