Skip to content

Commit

Permalink
Merge pull request #146 from TonyCallear/master-2016-03
Browse files Browse the repository at this point in the history
Corrected some odd behaviour of ‘Pin’ blocks.

- no longer treat “instance of numberblock” differently.
- Toggle should work correctly now
- Input_pullup block available.

Various typo’s and daft errors corrected.

Some stuff I probably cannot remember after a year

Other ‘Skins’ encouraged/available at compile time, copy from ‘Skins/xxx’ folder.

- I prefer the “Slim” skin and will try to make this available as a built ‘release’
  • Loading branch information
TonyCallear authored Apr 14, 2017
2 parents 6db399b + ef028eb commit b43d3be
Show file tree
Hide file tree
Showing 93 changed files with 41,592 additions and 197 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A0.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A0 extends TranslatorBlock
{

public A0(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A0" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A1 extends TranslatorBlock
{

public A1(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A1" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A10.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A10 extends TranslatorBlock
{

public A10(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A10" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A11.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A11 extends TranslatorBlock
{

public A11(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A11" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A12.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A12 extends TranslatorBlock
{

public A12(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A12" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A13.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A13 extends TranslatorBlock
{

public A13(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A13" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A14.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A14 extends TranslatorBlock
{

public A14(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A14" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A15.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A15 extends TranslatorBlock
{

public A15(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A15" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A2 extends TranslatorBlock
{

public A2(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A2" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A3 extends TranslatorBlock
{

public A3(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A3" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A4 extends TranslatorBlock
{

public A4(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A4" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A5 extends TranslatorBlock
{

public A5(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A5" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A6 extends TranslatorBlock
{

public A6(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A6" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A7.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A7 extends TranslatorBlock
{

public A7(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A7" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A8.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A8 extends TranslatorBlock
{

public A8(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A8" + codeSuffix;
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/ardublock/translator/block/A9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ardublock.translator.block;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class A9 extends TranslatorBlock
{

public A9(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

@Override
public String toCode() throws SocketNullException {
return codePrefix + "A9" + codeSuffix;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@

public class AnalogInputBlock extends TranslatorBlock
{
public static final String ARDUBLOCK_ANALOG_READ_DEFINE =
/* If the pin was previously OUTPUT and is **quickly** analog read, the charge on the pin
* and the lack of "settling time" does affect the likely result of analogRead.
* Always introducing a delay to settle the pin is not done here as it is overwhelmingly
* unnecessary, too slow to do every time and complicated to detect if it is actually needed.
* If this needs to be done then implement https://github.com/arduino/Arduino/issues/4606
* and change to INPUT with a 10ms delay to settle only if the pinMode must be changed.
* Hide the ability to make Analog pins OUTPUT at the end of any pinLists!!! */
"int __ardublockAnalogRead(int pinNumber)\n" +
"{\n" +
"pinMode(pinNumber, INPUT);\n" +
"return analogRead(pinNumber);\n" +
"}\n\n";

public AnalogInputBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
Expand All @@ -14,8 +28,10 @@ public AnalogInputBlock(Long blockId, Translator translator, String codePrefix,
@Override
public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
String ret = "analogRead(";
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
translator.addDefinitionCommand(ARDUBLOCK_ANALOG_READ_DEFINE);

String ret = "__ardublockAnalogRead(";
ret = ret + translatorBlock.toCode();
ret = ret + ")";
return codePrefix + ret + codeSuffix;
Expand Down
Loading

0 comments on commit b43d3be

Please sign in to comment.