From 30f23827fa8bdf0198dbf801baf9c203dcf41dc4 Mon Sep 17 00:00:00 2001 From: Christian Poulter Date: Mon, 20 Dec 2021 08:26:02 +0100 Subject: [PATCH] #1173 includes dcmotor libray and adds block to toolbox --- .../java/de/fhg/iais/roberta/syntax/SC.java | 2 + .../robotSpecific/calliope/callibot.xml | 2 +- .../blockly/blockly_compressed.js | 56 ++++++------- .../staticResources/blockly/msg/js/ar.js | 4 + .../staticResources/blockly/msg/js/az.js | 4 + .../staticResources/blockly/msg/js/ba.js | 4 + .../staticResources/blockly/msg/js/bcc.js | 4 + .../blockly/msg/js/be-tarask.js | 4 + .../staticResources/blockly/msg/js/be.js | 4 + .../staticResources/blockly/msg/js/bg.js | 4 + .../staticResources/blockly/msg/js/bn.js | 4 + .../staticResources/blockly/msg/js/br.js | 4 + .../staticResources/blockly/msg/js/ca.js | 4 + .../staticResources/blockly/msg/js/cs.js | 4 + .../staticResources/blockly/msg/js/da.js | 4 + .../staticResources/blockly/msg/js/de.js | 4 + .../staticResources/blockly/msg/js/el.js | 4 + .../staticResources/blockly/msg/js/en.js | 4 + .../staticResources/blockly/msg/js/es.js | 4 + .../staticResources/blockly/msg/js/eu.js | 4 + .../staticResources/blockly/msg/js/fa.js | 4 + .../staticResources/blockly/msg/js/fi.js | 4 + .../staticResources/blockly/msg/js/fr.js | 4 + .../staticResources/blockly/msg/js/he.js | 4 + .../staticResources/blockly/msg/js/hi.js | 4 + .../staticResources/blockly/msg/js/hrx.js | 4 + .../staticResources/blockly/msg/js/hu.js | 4 + .../staticResources/blockly/msg/js/ia.js | 4 + .../staticResources/blockly/msg/js/id.js | 4 + .../staticResources/blockly/msg/js/is.js | 4 + .../staticResources/blockly/msg/js/it.js | 4 + .../staticResources/blockly/msg/js/ja.js | 4 + .../staticResources/blockly/msg/js/ko.js | 4 + .../staticResources/blockly/msg/js/lb.js | 4 + .../staticResources/blockly/msg/js/lki.js | 4 + .../staticResources/blockly/msg/js/lrc.js | 4 + .../staticResources/blockly/msg/js/lt.js | 4 + .../staticResources/blockly/msg/js/mk.js | 4 + .../staticResources/blockly/msg/js/ms.js | 4 + .../staticResources/blockly/msg/js/nb.js | 4 + .../staticResources/blockly/msg/js/nl.js | 4 + .../staticResources/blockly/msg/js/oc.js | 4 + .../staticResources/blockly/msg/js/pl.js | 4 + .../staticResources/blockly/msg/js/pms.js | 4 + .../staticResources/blockly/msg/js/pt-br.js | 4 + .../staticResources/blockly/msg/js/pt.js | 4 + .../staticResources/blockly/msg/js/ro.js | 4 + .../staticResources/blockly/msg/js/ru.js | 4 + .../staticResources/blockly/msg/js/sc.js | 4 + .../staticResources/blockly/msg/js/sd.js | 4 + .../staticResources/blockly/msg/js/shn.js | 4 + .../staticResources/blockly/msg/js/sk.js | 4 + .../staticResources/blockly/msg/js/sl.js | 4 + .../staticResources/blockly/msg/js/sq.js | 4 + .../staticResources/blockly/msg/js/sr.js | 4 + .../staticResources/blockly/msg/js/sv.js | 4 + .../staticResources/blockly/msg/js/ta.js | 4 + .../staticResources/blockly/msg/js/tcy.js | 4 + .../staticResources/blockly/msg/js/th.js | 4 + .../staticResources/blockly/msg/js/tl.js | 4 + .../staticResources/blockly/msg/js/tlh.js | 4 + .../staticResources/blockly/msg/js/tr.js | 4 + .../staticResources/blockly/msg/js/uk.js | 4 + .../staticResources/blockly/msg/js/vi.js | 4 + .../staticResources/blockly/msg/js/zh-hans.js | 4 + .../staticResources/blockly/msg/js/zh-hant.js | 4 + .../staticResources/blockly/msg/json/en.json | 8 +- .../staticResources/blockly/msg/json/qqq.json | 6 +- .../visitor/IMbedTransformerVisitor.java | 12 +++ .../iais/roberta/visitor/IMbedVisitor.java | 6 ++ .../visitor/IMbedVisitorWithoutDefault.java | 3 + .../visitor/codegen/CalliopeCppVisitor.java | 26 +++++++ .../codegen/MbedStackMachineVisitor.java | 7 ++ ...lliopeSimValidatorAndCollectorVisitor.java | 7 ++ .../MbedValidatorAndCollectorVisitor.java | 11 +++ .../syntax/action/mbed/DcMotorSetAction.java | 78 +++++++++++++++++++ .../calliope/program.toolbox.expert.xml | 4 + RobotMbed/src/main/resources/mbed.yml | 5 ++ 78 files changed, 453 insertions(+), 32 deletions(-) create mode 100644 RobotMbed/src/main/java/de/poulter/roberta/syntax/action/mbed/DcMotorSetAction.java diff --git a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/syntax/SC.java b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/syntax/SC.java index 7cc9a82146..6038340f97 100644 --- a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/syntax/SC.java +++ b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/syntax/SC.java @@ -136,5 +136,7 @@ public interface SC { String HTS221 = "HTS221"; String OLEDSSD1306I2C = "OLEDSSD1306I2C"; + + String DCMOTOR = "DCMOTOR"; } diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/callibot.xml b/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/callibot.xml index f702b44953..bd8c865c2d 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/callibot.xml +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/callibot.xml @@ -1 +1 @@ -lineBooleanTRUEdistNumber0MM3010R#ff0000RR2R3R4R5LONL2ONL3ONMM33010M30M3FLOATS90S545C17FOREWARDC16BACKWARDBOTHOFFFOREWARDFOREWARDFOREWARDBACKWARDlineLINEIlineLINEI2distDISTANCEUCMM3RR2R3R4R5LL2L3II2USS5BB_S_L_G_CundefinedAA_A_T_R_B \ No newline at end of file +lineBooleanTRUEdistNumber0MM3010R#ff0000RR2R3R4R5LONL2ONL3ONMM33010M30M3FLOATS90S545C17FOREWARDC16BACKWARDBOTHOFFFOREWARDFOREWARDFOREWARDBACKWARDlineLINEIlineLINEI2distDISTANCEUCMM3RR2R3R4R5LL2L3II2USS5BB_S_L_G_CundefinedAA_A_T_R_B1FOREWARD \ No newline at end of file diff --git a/OpenRobertaServer/staticResources/blockly/blockly_compressed.js b/OpenRobertaServer/staticResources/blockly/blockly_compressed.js index d6d39472a3..39870f55a1 100644 --- a/OpenRobertaServer/staticResources/blockly/blockly_compressed.js +++ b/OpenRobertaServer/staticResources/blockly/blockly_compressed.js @@ -6,20 +6,20 @@ Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE? -$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+c+"$"+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("Array.prototype.findIndex",function(a){return a?a:function(b,c){return $jscomp.findInternal(this,b,c).i}},"es6","es3");$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(b,c){return $jscomp.findInternal(this,b,c).v}},"es6","es3"); +$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var f=0;f=e}},"es6","es3"); $jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(b,c){var d=$jscomp.checkStringArgs(this,b,"startsWith");b+="";var e=d.length,f=b.length;c=Math.max(0,Math.min(c|0,d.length));for(var g=0;g=f}},"es6","es3"); $jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(b){var c=$jscomp.checkStringArgs(this,null,"repeat");if(0>b||1342177279>>=1)c+=c;return d}},"es6","es3");$jscomp.polyfill("String.prototype.trimLeft",function(a){function b(){return this.replace(/^[\s\xa0]+/,"")}return a||b},"es_2019","es3"); $jscomp.checkEs6ConformanceViaProxy=function(){try{var a={},b=Object.create(new $jscomp.global.Proxy(a,{get:function(c,d,e){return c==a&&"q"==d&&e==b}}));return!0===b.q}catch(c){return!1}};$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b>>0)+"_",d=0,e=function(f){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new b(c+(f||"")+"_"+d++,f)};return e},"es6","es3"); +$jscomp.initSymbol=function(){};$jscomp.polyfill("Symbol",function(a){if(a)return a;var b=function(e,f){this.$jscomp$symbol$id_=e;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:f})};b.prototype.toString=function(){return this.$jscomp$symbol$id_};var c=0,d=function(e){if(this instanceof d)throw new TypeError("Symbol is not a constructor");return new b("jscomp_symbol_"+(e||"")+"_"+c++,e)};return d},"es6","es3");$jscomp.initSymbolIterator=function(){}; $jscomp.polyfill("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;ca.aspectRatio()?a.width/this.width:a.height/this.height;return this.scale(a)};goog.dom.Appendable={};goog.dom.ASSUME_QUIRKS_MODE=!1;goog.dom.ASSUME_STANDARDS_MODE=!1;goog.dom.COMPAT_MODE_KNOWN_=goog.dom.ASSUME_QUIRKS_MODE||goog.dom.ASSUME_STANDARDS_MODE;goog.dom.getDomHelper=function(a){return a?new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)):goog.dom.defaultDomHelper_||(goog.dom.defaultDomHelper_=new goog.dom.DomHelper)};goog.dom.getDocument=function(){return document};goog.dom.getElement=function(a){return goog.dom.getElementHelper_(document,a)}; +goog.math.Size.prototype.scaleToCover=function(a){a=this.aspectRatio()<=a.aspectRatio()?a.width/this.width:a.height/this.height;return this.scale(a)};goog.math.Size.prototype.scaleToFit=function(a){a=this.aspectRatio()>a.aspectRatio()?a.width/this.width:a.height/this.height;return this.scale(a)};goog.dom.ASSUME_QUIRKS_MODE=!1;goog.dom.ASSUME_STANDARDS_MODE=!1;goog.dom.COMPAT_MODE_KNOWN_=goog.dom.ASSUME_QUIRKS_MODE||goog.dom.ASSUME_STANDARDS_MODE;goog.dom.getDomHelper=function(a){return a?new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)):goog.dom.defaultDomHelper_||(goog.dom.defaultDomHelper_=new goog.dom.DomHelper)};goog.dom.getDocument=function(){return document};goog.dom.getElement=function(a){return goog.dom.getElementHelper_(document,a)}; goog.dom.getElementHelper_=function(a,b){return"string"===typeof b?a.getElementById(b):b};goog.dom.getRequiredElement=function(a){return goog.dom.getRequiredElementHelper_(document,a)};goog.dom.getRequiredElementHelper_=function(a,b){goog.asserts.assertString(b);a=goog.dom.getElementHelper_(a,b);return a=goog.asserts.assertElement(a,"No element found with id: "+b)};goog.dom.$=goog.dom.getElement;goog.dom.getElementsByTagName=function(a,b){return(b||document).getElementsByTagName(String(a))}; goog.dom.getElementsByTagNameAndClass=function(a,b,c){return goog.dom.getElementsByTagNameAndClass_(document,a,b,c)};goog.dom.getElementByTagNameAndClass=function(a,b,c){return goog.dom.getElementByTagNameAndClass_(document,a,b,c)};goog.dom.getElementsByClass=function(a,b){var c=b||document;return goog.dom.canUseQuerySelector_(c)?c.querySelectorAll("."+a):goog.dom.getElementsByTagNameAndClass_(document,"*",a,b)}; goog.dom.getElementByClass=function(a,b){var c=b||document;return(c.getElementsByClassName?c.getElementsByClassName(a)[0]:goog.dom.getElementByTagNameAndClass_(document,"*",a,b))||null};goog.dom.getRequiredElementByClass=function(a,b){b=goog.dom.getElementByClass(a,b);return goog.asserts.assert(b,"No element found with className: "+a)};goog.dom.canUseQuerySelector_=function(a){return!(!a.querySelectorAll||!a.querySelector)}; @@ -627,7 +627,7 @@ goog.dom.append_(a,c,b,2);return c};goog.dom.append_=function(a,b,c,d){function goog.dom.createElement_=function(a,b){b=String(b);"application/xhtml+xml"===a.contentType&&(b=b.toLowerCase());return a.createElement(b)};goog.dom.createTextNode=function(a){return document.createTextNode(String(a))};goog.dom.createTable=function(a,b,c){return goog.dom.createTable_(document,a,b,!!c)}; goog.dom.createTable_=function(a,b,c,d){for(var e=goog.dom.createElement_(a,goog.dom.TagName.TABLE),f=e.appendChild(goog.dom.createElement_(a,goog.dom.TagName.TBODY)),g=0;g=a.keyCode)a.keyCode=-1}catch(b){}};goog.events.BrowserEvent.prototype.getBrowserEvent=function(){return this.event_}; goog.events.BrowserEvent.getPointerType_=function(a){return"string"===typeof a.pointerType?a.pointerType:goog.events.BrowserEvent.IE_POINTER_TYPE_MAP[a.pointerType]||""};goog.events.Listenable=function(){};goog.events.Listenable.IMPLEMENTED_BY_PROP="closure_listenable_"+(1E6*Math.random()|0);goog.events.Listenable.addImplementation=function(a){a.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP]=!0};goog.events.Listenable.isImplementedBy=function(a){return!(!a||!a[goog.events.Listenable.IMPLEMENTED_BY_PROP])};goog.events.ListenableKey=function(){};goog.events.ListenableKey.counter_=0;goog.events.ListenableKey.reserveKey=function(){return++goog.events.ListenableKey.counter_};goog.events.Listener=function(a,b,c,d,e,f){goog.events.Listener.ENABLE_MONITORING&&(this.creationStack=Error().stack);this.listener=a;this.proxy=b;this.src=c;this.type=d;this.capture=!!e;this.handler=f;this.key=goog.events.ListenableKey.reserveKey();this.removed=this.callOnce=!1};goog.events.Listener.ENABLE_MONITORING=!1;goog.events.Listener.prototype.markAsRemoved=function(){this.removed=!0;this.handler=this.src=this.proxy=this.listener=null};goog.events.ListenerMap=function(a){this.src=a;this.listeners={};this.typeCount_=0};goog.events.ListenerMap.prototype.getTypeCount=function(){return this.typeCount_};goog.events.ListenerMap.prototype.getListenerCount=function(){var a=0,b;for(b in this.listeners)a+=this.listeners[b].length;return a}; @@ -940,7 +940,7 @@ goog.events.ListenerMap.prototype.add=function(a,b,c,d,e){var f=a.toString();a=t goog.events.ListenerMap.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.listeners))return!1;var e=this.listeners[a];b=goog.events.ListenerMap.findListenerIndex_(e,b,c,d);return-1b||b>this.getChildCount())throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);this.childIndex_&&this.children_||(this.childIndex_={},this.children_=[]);a.getParent()==this?(goog.object.set(this.childIndex_,a.getId(),a),goog.array.remove(this.children_,a)):goog.object.add(this.childIndex_, -a.getId(),a);a.setParent(this);goog.array.insertAt(this.children_,a,b);a.inDocument_&&this.inDocument_&&a.getParent()==this?(c=this.getContentElement(),c.contains(a.getElement())&&c.removeChild(a.getElement()),b=c.childNodes[b]||null,c.insertBefore(a.getElement(),b)):c?(this.element_||this.createDom(),b=this.getChildAt(b+1),a.render_(this.getContentElement(),b?b.element_:null)):this.inDocument_&&!a.inDocument_&&a.element_&&a.element_.parentNode&&a.element_.parentNode.nodeType==goog.dom.NodeType.ELEMENT&& -a.enterDocument()};goog.ui.Component.prototype.getContentElement=function(){return this.element_};goog.ui.Component.prototype.isRightToLeft=function(){null==this.rightToLeft_&&(this.rightToLeft_=goog.style.isRightToLeft(this.inDocument_?this.element_:this.dom_.getDocument().body));return this.rightToLeft_};goog.ui.Component.prototype.setRightToLeft=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.rightToLeft_=a}; +a.getId(),a);a.setParent(this);goog.array.insertAt(this.children_,a,b);a.inDocument_&&this.inDocument_&&a.getParent()==this?(c=this.getContentElement(),b=c.childNodes[b]||null,b!=a.getElement()&&c.insertBefore(a.getElement(),b)):c?(this.element_||this.createDom(),b=this.getChildAt(b+1),a.render_(this.getContentElement(),b?b.element_:null)):this.inDocument_&&!a.inDocument_&&a.element_&&a.element_.parentNode&&a.element_.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&a.enterDocument()}; +goog.ui.Component.prototype.getContentElement=function(){return this.element_};goog.ui.Component.prototype.isRightToLeft=function(){null==this.rightToLeft_&&(this.rightToLeft_=goog.style.isRightToLeft(this.inDocument_?this.element_:this.dom_.getDocument().body));return this.rightToLeft_};goog.ui.Component.prototype.setRightToLeft=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.rightToLeft_=a}; goog.ui.Component.prototype.hasChildren=function(){return!!this.children_&&0!=this.children_.length};goog.ui.Component.prototype.getChildCount=function(){return this.children_?this.children_.length:0};goog.ui.Component.prototype.getChildIds=function(){var a=[];this.forEachChild(function(b){a.push(b.getId())});return a};goog.ui.Component.prototype.getChild=function(a){return this.childIndex_&&a?goog.object.get(this.childIndex_,a)||null:null}; goog.ui.Component.prototype.getChildAt=function(a){return this.children_?this.children_[a]||null:null};goog.ui.Component.prototype.forEachChild=function(a,b){this.children_&&goog.array.forEach(this.children_,a,b)};goog.ui.Component.prototype.indexOfChild=function(a){return this.children_&&a?goog.array.indexOf(this.children_,a):-1}; goog.ui.Component.prototype.removeChild=function(a,b){if(a){var c="string"===typeof a?a:a.getId();a=this.getChild(c);c&&a&&(goog.object.remove(this.childIndex_,c),goog.array.remove(this.children_,a),b&&(a.exitDocument(),a.element_&&goog.dom.removeNode(a.element_)),a.setParent(null))}if(!a)throw Error(goog.ui.Component.Error.NOT_OUR_CHILD);return a};goog.ui.Component.prototype.removeChildAt=function(a,b){return this.removeChild(this.getChildAt(a),b)}; @@ -1233,7 +1233,7 @@ goog.ui.ContainerRenderer.prototype.decorate=function(a,b){b.id&&a.setId(b.id);v goog.ui.ContainerRenderer.prototype.setStateFromClassName=function(a,b,c){b==c+"-disabled"?a.setEnabled(!1):b==c+"-horizontal"?a.setOrientation(goog.ui.Container.Orientation.HORIZONTAL):b==c+"-vertical"&&a.setOrientation(goog.ui.Container.Orientation.VERTICAL)}; goog.ui.ContainerRenderer.prototype.decorateChildren=function(a,b,c){if(b){c=c||b.firstChild;for(var d;c&&c.parentNode==b;){d=c.nextSibling;if(c.nodeType==goog.dom.NodeType.ELEMENT){var e=this.getDecoratorForChild(c);e&&(e.setElementInternal(c),a.isEnabled()||e.setEnabled(!1),a.addChild(e),e.decorate(c))}else c.nodeValue&&""!=goog.string.trim(c.nodeValue)||b.removeChild(c);c=d}}};goog.ui.ContainerRenderer.prototype.getDecoratorForChild=function(a){return goog.ui.registry.getDecorator(a)}; goog.ui.ContainerRenderer.prototype.initializeDom=function(a){a=a.getElement();goog.asserts.assert(a,"The container DOM element cannot be null.");goog.style.setUnselectable(a,!0,goog.userAgent.GECKO);goog.userAgent.IE&&(a.hideFocus=!0);var b=this.getAriaRole();b&&goog.a11y.aria.setRole(a,b)};goog.ui.ContainerRenderer.prototype.getKeyEventTarget=function(a){return a.getElement()};goog.ui.ContainerRenderer.prototype.getCssClass=function(){return goog.ui.ContainerRenderer.CSS_CLASS}; -goog.ui.ContainerRenderer.prototype.getClassNames=function(a){var b=this.getCssClass(),c=a.getOrientation()==goog.ui.Container.Orientation.HORIZONTAL;c=[b,c?b+"-horizontal":b+"-vertical"];a.isEnabled()||c.push(b+"-disabled");return c};goog.ui.ContainerRenderer.prototype.getDefaultOrientation=function(){return goog.ui.Container.Orientation.VERTICAL};goog.ui.ControlContent={};goog.ui.ControlRenderer=function(){};goog.addSingletonGetter(goog.ui.ControlRenderer);goog.ui.ControlRenderer.getCustomRenderer=function(a,b){a=new a;a.getCssClass=function(){return b};return a};goog.ui.ControlRenderer.CSS_CLASS="goog-control";goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS=[]; +goog.ui.ContainerRenderer.prototype.getClassNames=function(a){var b=this.getCssClass(),c=a.getOrientation()==goog.ui.Container.Orientation.HORIZONTAL;c=[b,c?b+"-horizontal":b+"-vertical"];a.isEnabled()||c.push(b+"-disabled");return c};goog.ui.ContainerRenderer.prototype.getDefaultOrientation=function(){return goog.ui.Container.Orientation.VERTICAL};goog.ui.ControlRenderer=function(){};goog.addSingletonGetter(goog.ui.ControlRenderer);goog.ui.ControlRenderer.getCustomRenderer=function(a,b){a=new a;a.getCssClass=function(){return b};return a};goog.ui.ControlRenderer.CSS_CLASS="goog-control";goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS=[]; goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_=goog.object.create(goog.a11y.aria.Role.BUTTON,goog.a11y.aria.State.PRESSED,goog.a11y.aria.Role.CHECKBOX,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.MENU_ITEM,goog.a11y.aria.State.SELECTED,goog.a11y.aria.Role.MENU_ITEM_CHECKBOX,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.MENU_ITEM_RADIO,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.RADIO,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.TAB,goog.a11y.aria.State.SELECTED,goog.a11y.aria.Role.TREEITEM, goog.a11y.aria.State.SELECTED);goog.ui.ControlRenderer.prototype.getAriaRole=function(){};goog.ui.ControlRenderer.prototype.createDom=function(a){return a.getDomHelper().createDom(goog.dom.TagName.DIV,this.getClassNames(a).join(" "),a.getContent())};goog.ui.ControlRenderer.prototype.getContentElement=function(a){return a}; goog.ui.ControlRenderer.prototype.enableClassName=function(a,b,c){if(a=a.getElement?a.getElement():a){var d=[b];goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")&&(d=this.getAppliedCombinedClassNames_(goog.dom.classlist.get(a),b),d.push(b));goog.dom.classlist.enableAll(a,d,c)}};goog.ui.ControlRenderer.prototype.enableExtraClassName=function(a,b,c){this.enableClassName(a,b,c)};goog.ui.ControlRenderer.prototype.canDecorate=function(a){return!0}; @@ -1519,7 +1519,7 @@ darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#55 ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a", lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1", moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57", -seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};goog.color.Hsl={};goog.color.Hsv={};goog.color.Rgb={};goog.color.parse=function(a){var b={};a=String(a);var c=goog.color.prependHashIfNecessaryHelper(a);if(goog.color.isValidHexColor_(c))return b.hex=goog.color.normalizeHex(c),b.type="hex",b;c=goog.color.isValidRgbColor_(a);if(c.length)return b.hex=goog.color.rgbArrayToHex(c),b.type="rgb",b;if(goog.color.names&&(c=goog.color.names[a.toLowerCase()]))return b.hex=c,b.type="named",b;throw Error(a+" is not a valid color string");}; +seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};goog.color.parse=function(a){var b={};a=String(a);var c=goog.color.prependHashIfNecessaryHelper(a);if(goog.color.isValidHexColor_(c))return b.hex=goog.color.normalizeHex(c),b.type="hex",b;c=goog.color.isValidRgbColor_(a);if(c.length)return b.hex=goog.color.rgbArrayToHex(c),b.type="rgb",b;if(goog.color.names&&(c=goog.color.names[a.toLowerCase()]))return b.hex=c,b.type="named",b;throw Error(a+" is not a valid color string");}; goog.color.isValidColor=function(a){var b=goog.color.prependHashIfNecessaryHelper(a);return!!(goog.color.isValidHexColor_(b)||goog.color.isValidRgbColor_(a).length||goog.color.names&&goog.color.names[a.toLowerCase()])};goog.color.parseRgb=function(a){var b=goog.color.isValidRgbColor_(a);if(!b.length)throw Error(a+" is not a valid RGB color");return b};goog.color.hexToRgbStyle=function(a){return goog.color.rgbStyle_(goog.color.hexToRgb(a))};goog.color.hexTripletRe_=/#(.)(.)(.)/; goog.color.normalizeHex=function(a){if(!goog.color.isValidHexColor_(a))throw Error("'"+a+"' is not a valid hex color");4==a.length&&(a=a.replace(goog.color.hexTripletRe_,"#$1$1$2$2$3$3"));return a.toLowerCase()};goog.color.hexToRgb=function(a){a=goog.color.normalizeHex(a);a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; goog.color.rgbToHex=function(a,b,c){a=Number(a);b=Number(b);c=Number(c);if(a!=(a&255)||b!=(b&255)||c!=(c&255))throw Error('"('+a+","+b+","+c+'") is not a valid RGB color');b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};goog.color.rgbArrayToHex=function(a){return goog.color.rgbToHex(a[0],a[1],a[2])}; @@ -1531,7 +1531,7 @@ goog.color.rgbToHsv=function(a,b,c){var d=Math.max(Math.max(a,b),c),e=Math.min(M goog.color.hslToHex=function(a,b,c){return goog.color.rgbArrayToHex(goog.color.hslToRgb(a,b,c))};goog.color.hslArrayToHex=function(a){return goog.color.rgbArrayToHex(goog.color.hslToRgb(a[0],a[1],a[2]))};goog.color.hexToHsv=function(a){return goog.color.rgbArrayToHsv(goog.color.hexToRgb(a))};goog.color.hsvToHex=function(a,b,c){return goog.color.rgbArrayToHex(goog.color.hsvToRgb(a,b,c))};goog.color.hsvArrayToHex=function(a){return goog.color.hsvToHex(a[0],a[1],a[2])}; goog.color.hslDistance=function(a,b){var c=.5>=a[2]?a[1]*a[2]:a[1]*(1-a[2]);var d=.5>=b[2]?b[1]*b[2]:b[1]*(1-b[2]);return(a[2]-b[2])*(a[2]-b[2])+c*c+d*d-2*c*d*Math.cos(2*(a[0]/360-b[0]/360)*Math.PI)};goog.color.blend=function(a,b,c){c=goog.math.clamp(c,0,1);return[Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2]))]};goog.color.darken=function(a,b){return goog.color.blend([0,0,0],a,b)}; goog.color.lighten=function(a,b){return goog.color.blend([255,255,255],a,b)};goog.color.highContrast=function(a,b){for(var c=[],d=0;d=a.length)throw goog.iter.StopIteration;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");}; goog.iter.forEach=function(a,b,c){if(goog.isArrayLike(a))try{goog.array.forEach(a,b,c)}catch(d){if(d!==goog.iter.StopIteration)throw d;}else{a=goog.iter.toIterator(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==goog.iter.StopIteration)throw d;}}};goog.iter.filter=function(a,b,c){var d=goog.iter.toIterator(a);a=new goog.iter.Iterator;a.next=function(){for(;;){var e=d.next();if(b.call(c,e,void 0,d))return e}};return a}; goog.iter.filterFalse=function(a,b,c){return goog.iter.filter(a,goog.functions.not(b),c)};goog.iter.range=function(a,b,c){var d=0,e=a,f=c||1;1=e||0>f&&d<=e)throw goog.iter.StopIteration;var h=d;d+=f;return h};return g};goog.iter.join=function(a,b){return goog.iter.toArray(a).join(b)}; @@ -1695,10 +1695,10 @@ Blockly.Msg.CONTROLS_IF_TOOLTIP_2="If a value is true, then do the first block o Blockly.Msg.CONTROLS_REPEAT_HELPURL="https://en.wikipedia.org/wiki/For_loop";Blockly.Msg.CONTROLS_REPEAT_INPUT_DO="do";Blockly.Msg.CONTROLS_REPEAT_TITLE="repeat %1 times";Blockly.Msg.CONTROLS_REPEAT_TOOLTIP="Do some statements several times.";Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat";Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repeat until";Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repeat while"; Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="While a value is false, then do some statements.";Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="While a value is true, then do some statements.";Blockly.Msg.DATATABLE_ACTUALIZATION="Modification date";Blockly.Msg.DATATABLE_CONFIGURATIONS="configurations";Blockly.Msg.DATATABLE_CONFIGURATION_NAME="Configuration name";Blockly.Msg.DATATABLE_CREATED_BY="Creator";Blockly.Msg.DATATABLE_CREATED_ON="Creation date";Blockly.Msg.DATATABLE_MEMBERS="members"; Blockly.Msg.DATATABLE_PROGRAMS="programs";Blockly.Msg.DATATABLE_PROGRAM_NAME="Program name";Blockly.Msg.DATATABLE_SHARED="Shared";Blockly.Msg.DATATABLE_SHARED_PROGRAMS="shared programs";Blockly.Msg.DATATABLE_SHARED_WITH="Shared with";Blockly.Msg.DATATABLE_USERGROUP="user group";Blockly.Msg.DATATABLE_USERGROUPS="user groups";Blockly.Msg.DATATABLE_USERGROUP_NAME="Name of the user group";Blockly.Msg.DATATABLE_USERGROUP_NAME_CREATE_HINT="The name of the user group. Kepp in mind, that the members will have to type it in each time they log in."; -Blockly.Msg.DATATABLE_USERGROUP_OWNER="Name of the owner of the user group";Blockly.Msg.DELETE_ALL_BLOCKS="Delete all %1 blocks?";Blockly.Msg.DELETE_BLOCK="Delete Block";Blockly.Msg.DELETE_USERGROUP_MEMBER_AFTER_LOGIN_WARNING="A member you want to delete did already log in and might have create own programs. Are you sure that you want to delete the selected member(s)?";Blockly.Msg.DELETE_USERGROUP_MEMBER_WARNING="Are you sure that you want to delete the selected member(s)?"; -Blockly.Msg.DELETE_X_BLOCKS="Delete %1 Blocks";Blockly.Msg.DIGITAL="digital";Blockly.Msg.DIGITALIN_TOOLTIP="Represents any actuator connected to a digital pin.";Blockly.Msg.DIGITALOUT_TOOLTIP="Represents any sensor connected to a digital.";Blockly.Msg.DISABLE_BLOCK="Disable Block";Blockly.Msg.DISPLAY_ANIMATION="animation";Blockly.Msg.DISPLAY_CHARACTER="character";Blockly.Msg.DISPLAY_CLEAR="clear display";Blockly.Msg.DISPLAY_CLEAR_TOOLTIP="Clears the display.";Blockly.Msg.DISPLAY_COL="in column"; -Blockly.Msg.DISPLAY_GET_BRIGHTNESS_TOOLTIP="Returns the brightness for all leds of the display. 0 means all leds are turned off, 9 is the brightest value.";Blockly.Msg.DISPLAY_GET_PIXEL_TOOLTIP="Returns the brightness for this led. 0 means the led is turned off, 9 is the brightest value.";Blockly.Msg.DISPLAY_IMAGE="image";Blockly.Msg.DISPLAY_PICTURE="picture";Blockly.Msg.DISPLAY_PICTURE_EYES_CLOSED="eyes closed";Blockly.Msg.DISPLAY_PICTURE_EYES_OPEN="eyes open"; -Blockly.Msg.DISPLAY_PICTURE_FLOWERS="flowers";Blockly.Msg.DISPLAY_PICTURE_GLASSES="glasses";Blockly.Msg.DISPLAY_PICTURE_TACHO="speedo";Blockly.Msg.DISPLAY_PICTURE_TOOLTIP="Displays a picture on the screen.";Blockly.Msg.DISPLAY_PIXEL_BRIGHTNESS="brightness";Blockly.Msg.DISPLAY_PIXEL_TITLE="LED";Blockly.Msg.DISPLAY_ROW="in row";Blockly.Msg.DISPLAY_SET_BRIGHTNESS_TOOLTIP="Sets the brightness for all leds of the display. 0 means all leds are turned off, 9 is the brightest value."; +Blockly.Msg.DATATABLE_USERGROUP_OWNER="Name of the owner of the user group";Blockly.Msg.DCMOTOR_M1="Motor port 1";Blockly.Msg.DCMOTOR_M2="Motor port 2";Blockly.Msg.DCMOTOR_M3="Motor port 3";Blockly.Msg.DCMOTOR_M4="Motor port 4";Blockly.Msg.DELETE_ALL_BLOCKS="Delete all %1 blocks?";Blockly.Msg.DELETE_BLOCK="Delete Block";Blockly.Msg.DELETE_USERGROUP_MEMBER_AFTER_LOGIN_WARNING="A member you want to delete did already log in and might have create own programs. Are you sure that you want to delete the selected member(s)?"; +Blockly.Msg.DELETE_USERGROUP_MEMBER_WARNING="Are you sure that you want to delete the selected member(s)?";Blockly.Msg.DELETE_X_BLOCKS="Delete %1 Blocks";Blockly.Msg.DIGITAL="digital";Blockly.Msg.DIGITALIN_TOOLTIP="Represents any actuator connected to a digital pin.";Blockly.Msg.DIGITALOUT_TOOLTIP="Represents any sensor connected to a digital.";Blockly.Msg.DISABLE_BLOCK="Disable Block";Blockly.Msg.DISPLAY_ANIMATION="animation";Blockly.Msg.DISPLAY_CHARACTER="character";Blockly.Msg.DISPLAY_CLEAR="clear display"; +Blockly.Msg.DISPLAY_CLEAR_TOOLTIP="Clears the display.";Blockly.Msg.DISPLAY_COL="in column";Blockly.Msg.DISPLAY_GET_BRIGHTNESS_TOOLTIP="Returns the brightness for all leds of the display. 0 means all leds are turned off, 9 is the brightest value.";Blockly.Msg.DISPLAY_GET_PIXEL_TOOLTIP="Returns the brightness for this led. 0 means the led is turned off, 9 is the brightest value.";Blockly.Msg.DISPLAY_IMAGE="image";Blockly.Msg.DISPLAY_PICTURE="picture";Blockly.Msg.DISPLAY_PICTURE_EYES_CLOSED="eyes closed"; +Blockly.Msg.DISPLAY_PICTURE_EYES_OPEN="eyes open";Blockly.Msg.DISPLAY_PICTURE_FLOWERS="flowers";Blockly.Msg.DISPLAY_PICTURE_GLASSES="glasses";Blockly.Msg.DISPLAY_PICTURE_TACHO="speedo";Blockly.Msg.DISPLAY_PICTURE_TOOLTIP="Displays a picture on the screen.";Blockly.Msg.DISPLAY_PIXEL_BRIGHTNESS="brightness";Blockly.Msg.DISPLAY_PIXEL_TITLE="LED";Blockly.Msg.DISPLAY_ROW="in row";Blockly.Msg.DISPLAY_SET_BRIGHTNESS_TOOLTIP="Sets the brightness for all leds of the display. 0 means all leds are turned off, 9 is the brightest value."; Blockly.Msg.DISPLAY_SET_PIXEL_TOOLTIP="Sets the brightness for this led. 0 means the led is turned off, 9 is the brightest value. With x and y you can determine the position of the led you would like to change.";Blockly.Msg.DISPLAY_SHOW="show";Blockly.Msg.DISPLAY_TEXT="text";Blockly.Msg.DISPLAY_TEXT_TOOLTIP="Displays a text on the screen.";Blockly.Msg.DROP_TOOLTIP="Represents a drop sensor.";Blockly.Msg.DUPLICATE_BLOCK="Duplicate";Blockly.Msg.ENABLE_BLOCK="Enable Block"; Blockly.Msg.ENCODER_GETSAMPLE_TOOLTIP="Gets the current reading from the motor encoder.";Blockly.Msg.ENCODER_RESET_TOOLTIP="Resets the motor encoder.";Blockly.Msg.ENCODER_TOOLTIP="Represents an encoder.";Blockly.Msg.ENVIRONMENTAL_TOOLTIP="Represents an environmental sensor.";Blockly.Msg.ENVIRONMENTAL_TOOLTIP_SENSEBOX="Represents the BME680 environmental sensor.";Blockly.Msg.ERROR_MISSING_PARAMETER="An input value is missing!";Blockly.Msg.ERROR_MISSING_RETURN="The function return value is missing!"; Blockly.Msg.EV3BRICK_TOOLTIP="Represents the EV3 brick with connected actors and sensors. There are also inbuilt actors and sensors available, e.g. buttons, display ...";Blockly.Msg.EXPAND_ALL="Expand Blocks";Blockly.Msg.EXPAND_BLOCK="Expand Block";Blockly.Msg.EXTERNAL_INPUTS="External Inputs";Blockly.Msg.FLAME_GETSAMPLE_TOOLTIP="Gets the current reading from the flame sensor.";Blockly.Msg.FLAME_TOOLTIP="Represents a flame sensor.";Blockly.Msg.FLYOUT_VARIABLE_TEXT="You need a variable? Please declare it first with a click on the + sign at the \u00bbstart\u00ab\u00a0block."; @@ -1984,11 +1984,10 @@ goog.debug.LogRecord.prototype.reset=function(a,b,c,d,e){goog.debug.LogRecord.EN goog.debug.LogRecord.prototype.setException=function(a){this.exception_=a};goog.debug.LogRecord.prototype.setLoggerName=function(a){this.loggerName_=a};goog.debug.LogRecord.prototype.getLevel=function(){return this.level_};goog.debug.LogRecord.prototype.setLevel=function(a){this.level_=a};goog.debug.LogRecord.prototype.getMessage=function(){return this.msg_};goog.debug.LogRecord.prototype.setMessage=function(a){this.msg_=a};goog.debug.LogRecord.prototype.getMillis=function(){return this.time_}; goog.debug.LogRecord.prototype.setMillis=function(a){this.time_=a};goog.debug.LogRecord.prototype.getSequenceNumber=function(){return this.sequenceNumber_};goog.debug.LogBuffer=function(){goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(),"Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY.");this.clear()};goog.debug.LogBuffer.getInstance=function(){goog.debug.LogBuffer.instance_||(goog.debug.LogBuffer.instance_=new goog.debug.LogBuffer);return goog.debug.LogBuffer.instance_};goog.debug.LogBuffer.CAPACITY=0; goog.debug.LogBuffer.prototype.addRecord=function(a,b,c){var d=(this.curIndex_+1)%goog.debug.LogBuffer.CAPACITY;this.curIndex_=d;if(this.isFull_)return d=this.buffer_[d],d.reset(a,b,c),d;this.isFull_=d==goog.debug.LogBuffer.CAPACITY-1;return this.buffer_[d]=new goog.debug.LogRecord(a,b,c)};goog.debug.LogBuffer.isBufferingEnabled=function(){return 0", - "lastupdated": "2021-12-01 11:09:28.460337", + "lastupdated": "2021-12-19 21:34:24.883947", "locale": "en", "messagedocumentation" : "qqq" }, @@ -1775,5 +1775,9 @@ "POPUP_REPLACE": "Replace", "POPUP_BACKGROUND_REPLACE": "A program with the same name already exists.
Would you like to replace it?", "POPUP_BACKGROUND_REPLACE_CONFIGURATION": "A configuration with the same name already exists.
Would you like to replace it?", - "ORA_CONFIGURATION_SAVE_AS_ERROR_CONFIGURATION_EXISTS": "This configuration already exists." + "ORA_CONFIGURATION_SAVE_AS_ERROR_CONFIGURATION_EXISTS": "This configuration already exists.", + "DCMOTOR_M1": "Motor port 1", + "DCMOTOR_M2": "Motor port 2", + "DCMOTOR_M3": "Motor port 3", + "DCMOTOR_M4": "Motor port 4" } diff --git a/OpenRobertaServer/staticResources/blockly/msg/json/qqq.json b/OpenRobertaServer/staticResources/blockly/msg/json/qqq.json index db898e4d81..63c0a00215 100644 --- a/OpenRobertaServer/staticResources/blockly/msg/json/qqq.json +++ b/OpenRobertaServer/staticResources/blockly/msg/json/qqq.json @@ -1769,5 +1769,9 @@ "POPUP_REPLACE": "", "POPUP_BACKGROUND_REPLACE": "", "POPUP_BACKGROUND_REPLACE_CONFIGURATION": "", - "ORA_CONFIGURATION_SAVE_AS_ERROR_CONFIGURATION_EXISTS": "" + "ORA_CONFIGURATION_SAVE_AS_ERROR_CONFIGURATION_EXISTS": "", + "DCMOTOR_M1": "", + "DCMOTOR_M2": "", + "DCMOTOR_M3": "", + "DCMOTOR_M4": "" } diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedTransformerVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedTransformerVisitor.java index af5323821b..a03ec101d3 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedTransformerVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedTransformerVisitor.java @@ -31,6 +31,8 @@ import de.fhg.iais.roberta.syntax.lang.expr.Expr; import de.fhg.iais.roberta.syntax.sensor.mbed.RadioRssiSensor; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; + public interface IMbedTransformerVisitor extends ITransformerVisitor, IMbedVisitor> { @Override @@ -242,4 +244,14 @@ default Phrase visitShowTextAction(ShowTextAction> showTextAction) default Phrase visitPlayFileAction(PlayFileAction> playFileAction) { return IMbedVisitor.super.visitPlayFileAction(playFileAction); } + + @Override + default Phrase visitDcMotorSetAction(DcMotorSetAction> dcMotorSetAction) { + return DcMotorSetAction.make( + dcMotorSetAction.getPort(), + (Expr) dcMotorSetAction.getSpeed().modify(this), + dcMotorSetAction.getProperty(), + dcMotorSetAction.getComment() + ); + } } diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitor.java index 78d6540019..505c637b55 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitor.java @@ -39,6 +39,8 @@ import de.fhg.iais.roberta.visitor.hardware.actor.ISoundVisitor; import de.fhg.iais.roberta.visitor.hardware.sensor.ISensorVisitor; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; + /** * Interface to be used with the visitor pattern to traverse an AST (and generate code, e.g.). */ @@ -306,5 +308,9 @@ default V visitVolumeAction(VolumeAction volumeAction) { default V visitPlayFileAction(PlayFileAction playFileAction) { throw new DbcException("Block is not implemented!"); } + + default V visitDcMotorSetAction(DcMotorSetAction dcMotorSetAction) { + throw new DbcException("Block is not implemented!"); + } } \ No newline at end of file diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitorWithoutDefault.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitorWithoutDefault.java index cc98f9960f..a397071c01 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitorWithoutDefault.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/IMbedVisitorWithoutDefault.java @@ -49,6 +49,7 @@ import de.fhg.iais.roberta.visitor.hardware.actor.IPinVisitor; import de.fhg.iais.roberta.visitor.hardware.actor.ISerialVisitor; import de.fhg.iais.roberta.visitor.hardware.actor.ISimpleSoundVisitor; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; /** * Interface to be used with the visitor pattern to traverse an AST (and generate code, e.g.). @@ -145,4 +146,6 @@ public interface IMbedVisitorWithoutDefault V visitHumiditySensor(HumiditySensor humiditySensor); V visitInfraredSensor(InfraredSensor infraredSensor); + + V visitDcMotorSetAction(DcMotorSetAction dcMotorSetAction); } \ No newline at end of file diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeCppVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeCppVisitor.java index 99351dfab7..a8aac6b53c 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeCppVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeCppVisitor.java @@ -106,6 +106,8 @@ import de.fhg.iais.roberta.visitor.IVisitor; import de.fhg.iais.roberta.visitor.lang.codegen.prog.AbstractCppVisitor; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; + /** * This class is implementing {@link IVisitor}. All methods are implemented and they append a human-readable C++ code representation of a phrase to a * StringBuilder. This representation is correct C++ code for Calliope systems.
@@ -705,6 +707,10 @@ public Void visitMainTask(MainTask mainTask) { nlIndent(); this.sb.append("_uBit.accelerometer.updateSample();"); } + if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DCMOTOR)) { + nlIndent(); + this.sb.append("dcMotor.init();"); + } return null; } @@ -1082,6 +1088,10 @@ protected void generateProgramSuffix(boolean withWrapping) { nlIndent(); this.sb.append("_cbStop(_buf, &_i2c);"); } + if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DCMOTOR) ) { + nlIndent(); + this.sb.append("dcMotor.release();"); + } nlIndent(); this.sb.append("release_fiber();"); decrIndentation(); @@ -1213,6 +1223,10 @@ private void addIncludes() { nlIndent(); this.sb.append("char _TCS3472_time = 0xff;"); } + if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DCMOTOR)) { + sb.append("#include \"DcMotor.h\"\n"); + sb.append("DcMotor dcMotor;\n"); + } } @Override @@ -1527,4 +1541,16 @@ private boolean isDualMode() { Set motorPins = getMotorPins(); return motorPins.stream().filter(s -> s.equals("A") || s.equals("B")).count() > 1; } + + @Override + public Void visitDcMotorSetAction(DcMotorSetAction dcMotorSetAction) { + String port = dcMotorSetAction.getPort(); + + this.sb.append("dcMotor.set(Motor::M").append(port).append(", "); + dcMotorSetAction.getSpeed().accept(this); + this.sb.append(");"); + + return null; + } + } \ No newline at end of file diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedStackMachineVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedStackMachineVisitor.java index 4a82e85147..67d32faf43 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedStackMachineVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedStackMachineVisitor.java @@ -69,6 +69,8 @@ import de.fhg.iais.roberta.visitor.IMbedVisitor; import de.fhg.iais.roberta.visitor.lang.codegen.AbstractStackMachineVisitor; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; + public class MbedStackMachineVisitor extends AbstractStackMachineVisitor implements IMbedVisitor { public MbedStackMachineVisitor(ConfigurationAst configuration, List>> phrases) { @@ -469,4 +471,9 @@ public V visitMotionKitSingleSetAction(MotionKitSingleSetAction motionKitSing public V visitMotionKitDualSetAction(MotionKitDualSetAction motionKitDualSetAction) { return null; } + + @Override + public V visitDcMotorSetAction(DcMotorSetAction dcMotorSetAction) { + return null; + } } diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/CalliopeSimValidatorAndCollectorVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/CalliopeSimValidatorAndCollectorVisitor.java index eacc0bb6eb..7ef529492f 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/CalliopeSimValidatorAndCollectorVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/CalliopeSimValidatorAndCollectorVisitor.java @@ -25,6 +25,7 @@ import de.fhg.iais.roberta.syntax.sensor.generic.UltrasonicSensor; import de.fhg.iais.roberta.syntax.sensor.mbed.RadioRssiSensor; import de.fhg.iais.roberta.visitor.IMbedVisitorWithoutDefault; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; public final class CalliopeSimValidatorAndCollectorVisitor extends MbedValidatorAndCollectorVisitor implements IMbedVisitorWithoutDefault { @@ -146,4 +147,10 @@ public Void visitMotionKitDualSetAction(MotionKitDualSetAction motionKitDu addWarningToPhrase(motionKitDualSetAction, "SIM_BLOCK_NOT_SUPPORTED"); return super.visitMotionKitDualSetAction(motionKitDualSetAction); } + + @Override + public Void visitDcMotorSetAction(DcMotorSetAction dcMotorSetAction) { + addWarningToPhrase(dcMotorSetAction, "SIM_BLOCK_NOT_SUPPORTED"); + return super.visitDcMotorSetAction(dcMotorSetAction); + } } diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/MbedValidatorAndCollectorVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/MbedValidatorAndCollectorVisitor.java index 809edd2bce..5b89c4bfcd 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/MbedValidatorAndCollectorVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/validate/MbedValidatorAndCollectorVisitor.java @@ -75,6 +75,8 @@ import de.fhg.iais.roberta.visitor.CalliopeMethods; import de.fhg.iais.roberta.visitor.IMbedVisitorWithoutDefault; +import de.poulter.roberta.syntax.action.mbed.DcMotorSetAction; + public class MbedValidatorAndCollectorVisitor extends CommonNepoValidatorAndCollectorVisitor implements IMbedVisitorWithoutDefault { public static final double DOUBLE_EPS = 1E-7; @@ -577,4 +579,13 @@ private Void addActorMaybeCallibot(WithUserDefinedPort phrase, String comp } return null; } + + @Override + public Void visitDcMotorSetAction(DcMotorSetAction dcMotorSetAction) { + requiredComponentVisited(dcMotorSetAction, dcMotorSetAction.getSpeed()); + usedHardwareBuilder.addUsedActor(new UsedActor("", SC.DCMOTOR)); + + return null; + } + } diff --git a/RobotMbed/src/main/java/de/poulter/roberta/syntax/action/mbed/DcMotorSetAction.java b/RobotMbed/src/main/java/de/poulter/roberta/syntax/action/mbed/DcMotorSetAction.java new file mode 100644 index 0000000000..52786141ff --- /dev/null +++ b/RobotMbed/src/main/java/de/poulter/roberta/syntax/action/mbed/DcMotorSetAction.java @@ -0,0 +1,78 @@ +package de.poulter.roberta.syntax.action.mbed; + +import java.util.List; + +import de.fhg.iais.roberta.blockly.generated.Block; +import de.fhg.iais.roberta.blockly.generated.Field; +import de.fhg.iais.roberta.blockly.generated.Value; +import de.fhg.iais.roberta.syntax.BlockTypeContainer; +import de.fhg.iais.roberta.syntax.BlocklyBlockProperties; +import de.fhg.iais.roberta.syntax.BlocklyComment; +import de.fhg.iais.roberta.syntax.Phrase; +import de.fhg.iais.roberta.syntax.action.Action; +import de.fhg.iais.roberta.syntax.lang.expr.Expr; +import de.fhg.iais.roberta.transformer.Ast2Jaxb; +import de.fhg.iais.roberta.transformer.ExprParam; +import de.fhg.iais.roberta.transformer.Jaxb2Ast; +import de.fhg.iais.roberta.transformer.Jaxb2ProgramAst; +import de.fhg.iais.roberta.typecheck.BlocklyType; +import de.fhg.iais.roberta.util.dbc.Assert; + +public final class DcMotorSetAction extends Action { + + private final String port; + private final Expr speed; + + private DcMotorSetAction(String port, Expr speed, BlocklyBlockProperties properties, BlocklyComment comment) { + super(BlockTypeContainer.getByName("DC_MOTOR_SET_ACTION"), properties, comment); + + Assert.notNull(port); + Assert.notNull(speed); + + this.port = port; + this.speed = speed; + + setReadOnly(); + } + + public static DcMotorSetAction make(String port, Expr speed, BlocklyBlockProperties properties, BlocklyComment comment) { + return new DcMotorSetAction<>(port, speed, properties, comment); + } + + public String getPort() { + return this.port; + } + + public Expr getSpeed() { + return this.speed; + } + + @Override + public String toString() { + return "DcMotorSetAction [" + this.port + ", " + this.speed + "]"; + } + + public static Phrase jaxbToAst(Block block, Jaxb2ProgramAst helper) { + List values = Jaxb2Ast.extractValues(block, (short) 2); + List fields = Jaxb2Ast.extractFields(block, (short) 2); + Phrase speed = helper.extractValue(values, new ExprParam("POWER", BlocklyType.NUMBER_INT)); + String port = Jaxb2Ast.extractField(fields, "PORT"); + + return DcMotorSetAction.make( + port, + Jaxb2Ast.convertPhraseToExpr(speed), + Jaxb2Ast.extractBlockProperties(block), + Jaxb2Ast.extractComment(block) + ); + } + + @Override + public Block astToBlock() { + Block jaxbDestination = new Block(); + Ast2Jaxb.setBasicProperties(this, jaxbDestination); + Ast2Jaxb.addField(jaxbDestination, "PORT", this.port); + Ast2Jaxb.addValue(jaxbDestination, "POWER", this.speed); + + return jaxbDestination; + } +} \ No newline at end of file diff --git a/RobotMbed/src/main/resources/calliope/program.toolbox.expert.xml b/RobotMbed/src/main/resources/calliope/program.toolbox.expert.xml index 529c02cf31..97de84e60a 100644 --- a/RobotMbed/src/main/resources/calliope/program.toolbox.expert.xml +++ b/RobotMbed/src/main/resources/calliope/program.toolbox.expert.xml @@ -142,6 +142,10 @@ FOREWARD FOREWARD + + 1 + 0 + diff --git a/RobotMbed/src/main/resources/mbed.yml b/RobotMbed/src/main/resources/mbed.yml index 2446e54f3f..98b46c5218 100644 --- a/RobotMbed/src/main/resources/mbed.yml +++ b/RobotMbed/src/main/resources/mbed.yml @@ -108,6 +108,11 @@ block: category: ACTOR implementor: de.fhg.iais.roberta.syntax.action.mbed.MotionKitDualSetAction type: [mbedActions_motionkit_dual_set] + DC_MOTOR_SET_ACTION: + category: ACTOR + implementor: de.poulter.roberta.syntax.action.mbed.DcMotorSetAction + type: [mbedActions_dcmotor_set] + mode: motionkit: [FOREWARD, BACKWARD, 'OFF']