...
 
Commits (3)
......@@ -2,8 +2,8 @@ CanBusGeneratorExtension.java 4bed3c88e71923515d7d9dc9235bc40a49ce237f GREEN
CanConnectorGeneratorExtension.java 5680017d9ef5ec7ac81ef7c035ba0a946d0f8b15 GREEN
CanTransmissionCatalog.java 0e5d45246d1c05d8391d540053df306c3e2a0b4d GREEN
ConsoleOutputGeneratorExtension.java 49509abbd2d6e2715c2f3af074d2e46a5c0a961e GREEN
MainGenerator.java 02e1a33db2f114a2ee5962764b3917568881a277 GREEN
MultiUnitMainGenerator.java 11c78dc068c5446b3e6b92ca688549b065f95071 RED
MainGenerator.java 15c330788dc48d1ff930363ffe104fc5b6f17e5f GREEN
MultiUnitMainGenerator.java b72c221bd1c45e18e8be9e63d42e92b86aef51ac GREEN
PWMActuatorGeneratorExtension.java 0764332c723731ae0ab19f09f65dfe8c6a571bdb GREEN
RaspberryPIGeneratorExtension.java 33d100efb28c217042d32facbcb0ae0ac9173b36 GREEN
SingleUnitMainGenerator.java 25750238d45816d706021d2ceb1b493a4d3c0417 GREEN
......@@ -190,46 +190,36 @@ public abstract class MainGenerator {
/** Creates the read code for the given receiver and port. */
protected String createReadCode(Receiver receiver, InputPort inport) {
ExecutableBase<?> exec = platformConnector2ExecutableBase.get(receiver);
if(exec instanceof IReadableGeneratorExtension) {
IReadableGeneratorExtension rexec = (IReadableGeneratorExtension)exec;
String targetVariable = getPortIdentifier(inport);
String readCode = rexec.getReadCode(inport, targetVariable);
String novalCode = rexec.getNoValReadCode(inport);
String pnvVar = getPortNoValIdentifier(targetVariable);
if(novalCode != null) {
return "if (!(" + novalCode + ")) {\n" + pnvVar + " = false;\n" + readCode +
"} else {\n" + pnvVar + " = true;\n}\n";
}
return pnvVar + " = false;\n" + readCode;
IReadableGeneratorExtension rexec = (IReadableGeneratorExtension)exec;
String targetVariable = getPortIdentifier(inport);
String readCode = rexec.getReadCode(inport, targetVariable);
String novalCode = rexec.getNoValReadCode(inport);
String pnvVar = getPortNoValIdentifier(targetVariable);
if(novalCode != null) {
return "if (!(" + novalCode + ")) {\n" + pnvVar + " = false;\n" + readCode +
"} else {\n" + pnvVar + " = true;\n}\n";
}
// TODO (TM): Can this happen? If so, an exception should be thrown!
return "FIXME(\"No generator extension available to read " + inport.getName() + " from " +
receiver.getName() + "\");\n";
return pnvVar + " = false;\n" + readCode;
}
/** Creates the read code for the given receiver and port. */
protected String createWriteCode(Transmitter transmitter, OutputPort outport) {
ExecutableBase<?> exec = platformConnector2ExecutableBase.get(transmitter);
if(exec instanceof IWriteableGeneratorExtension) {
IWriteableGeneratorExtension wexec = (IWriteableGeneratorExtension)exec;
String sourceVariable = getPortIdentifier(outport);
String writeCode = wexec.getWriteCode(outport, sourceVariable);
String novalCode = wexec.getNoValWriteCode(outport);
if(novalCode != null) {
String novalVariable = getPortNoValIdentifier(sourceVariable);
// @CodeFormatterOff
return "if (" + novalVariable + ") {\n"
+ novalCode + "\n" +
"} else {\n"
+ writeCode + "\n" +
"}\n";
// @CodeFormatterOn
}
return writeCode;
IWriteableGeneratorExtension wexec = (IWriteableGeneratorExtension)exec;
String sourceVariable = getPortIdentifier(outport);
String writeCode = wexec.getWriteCode(outport, sourceVariable);
String novalCode = wexec.getNoValWriteCode(outport);
if(novalCode != null) {
String novalVariable = getPortNoValIdentifier(sourceVariable);
// @CodeFormatterOff
return "if (" + novalVariable + ") {\n"
+ novalCode + "\n" +
"} else {\n"
+ writeCode + "\n" +
"}\n";
// @CodeFormatterOn
}
// TODO (TM): Can this happen? If so, an exception should be thrown!
return "FIXME(\"No generator extension available to write " + outport.getName() + " to " +
transmitter.getName() + "\");\n";
return writeCode;
}
/** Creates the includes of the system headers. */
......
......@@ -139,7 +139,6 @@ class MultiUnitMainGenerator extends MainGenerator {
for(OutputPort outport : c.getOutputPorts()) {
if(atomicOutputToTransmitter.containsKey(outport)) {
// deployed to hardware
// FIXME: an atomic output might be needed remotely and on HW
continue;
}
String portVar = af3PortName(outport);
......
MotorControlGeneratorExtensionBase.java 8140ad5a8114938e5db3e6e03b070c752be7026b GREEN
MotorControlInputGeneratorExtension.java 5a37e7265ad087aa421d36bf2a5094156ab36d17 GREEN
MotorControlOutputGeneratorExtension.java a78f5c231fd55c4d1b4285a4d5c9707e845c0de1 GREEN
MotorControlInputGeneratorExtension.java fe16866bbaad204ec3c61e9b35d2ae4589bc9eb4 GREEN
MotorControlOutputGeneratorExtension.java 1f9de6223e21e4c129d94381e892fcbee03113ae GREEN
......@@ -35,7 +35,7 @@ public class MotorControlInputGeneratorExtension
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return targetVariable + " = getVelocity();\n";
return targetVariable + " = 0;\n";
}
/** {@inheritDoc} */
......
......@@ -36,7 +36,7 @@ public class MotorControlOutputGeneratorExtension
/** {@inheritDoc} */
@Override
public String getWriteCode(OutputPort logicalSignal, String value) {
return "setVelocity(" + value + ");\n";
return "set_velocity(" + value + ");\n";
}
/** {@inheritDoc} */
......