diff --git a/ChangeLog.txt b/ChangeLog.txt index c96088e12..d5fa557e7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -9,6 +9,9 @@ Alter loop counters to be more pythonic (starting at 0) Minor Changes: Defines loop counters in the loop +Patches and Bug Fixes: +Tinker blocks in loops no longer generate functions + ========== Version 1.1.0 ========== Major Changes: @@ -25,4 +28,4 @@ Rename 'Tests' to 'Logical Operators' ========== Version 1.0.0 ========== -First Release (of this fork) \ No newline at end of file +First Release (of this fork) diff --git a/src/main/java/com/ardublock/translator/block/tinker/AbstractTinkerWriteDigitalBlock.java b/src/main/java/com/ardublock/translator/block/tinker/AbstractTinkerWriteDigitalBlock.java index 374041ba2..210f47571 100644 --- a/src/main/java/com/ardublock/translator/block/tinker/AbstractTinkerWriteDigitalBlock.java +++ b/src/main/java/com/ardublock/translator/block/tinker/AbstractTinkerWriteDigitalBlock.java @@ -22,22 +22,16 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0); String ret = ""; - if (translatorBlock instanceof NumberBlock || translatorBlock instanceof TinkerOutputPortBlock) + String number = translatorBlock.toCode(); + + if (translatorBlock instanceof NumberBlock) { - String number = translatorBlock.toCode(); String setupCode = "pinMode( " + number + " , OUTPUT);"; translator.addSetupCommand(setupCode); - - ret = "digitalWrite( "; - ret = ret + number; - } - else - { - translator.addDefinitionCommand(DigitalOutputBlock.ARDUBLOCK_DIGITAL_WRITE_DEFINE); - ret = "__ardublockDigitalWrite("; - - ret = ret + translatorBlock.toCode(); } + + ret = "digitalWrite( "; + ret = ret + number; ret = ret + " , "; translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 626e36517..dc33ee5a0 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1505,4 +1505,4 @@ bg.FaireBot_AddRight.description=Save "right" in memory bg.FaireBot_Go.description=Run saved commands bg.FaireBot_Distance.description=Set the forward/back distance of the FaireBot -bg.FaireBot_Turn.description=Set the turn of the FaireBot \ No newline at end of file +bg.FaireBot_Turn.description=Set the turn of the FaireBot