Commit 1c344d37 authored by Tiziano Munaro's avatar Tiziano Munaro

GREEN/RED

Issue-Ref: 4103
Issue-Url: #4103Signed-off-by: Tiziano Munaro's avatarTiziano Munaro <munaro@fortiss.org>
parent c6950900
Pipeline #27993 failed with stage
ActuatorDigitsPropertySection.java 75be0be45a1bc462e1f6fe2d84f63c60b95360a0 GREEN
ActuatorPWMPropertySection.java f4c1c8285a9c1f234a2bdaad4e91d4487887c4a6 GREEN
BoundedIntPositiveZeroValidator.java dfde0d07d2c3465c9bf6f626b0000c2d049e52b1 GREEN
RaspberryPiExecutionUnitPropertySection.java 6aabd64d84083b8885699f6f34a4695a117b8571 YELLOW
RaspberryPiExecutionUnitPropertySection.java 6aabd64d84083b8885699f6f34a4695a117b8571 GREEN
UIDUnitPropertySection.java d2f64193f25734f8955f2b3d1d1a681390d0acf3 GREEN
raspberry.ecore 10fc51155c399eae2d4970121e82189619bd77f0 YELLOW
raspberry.ecore 10fc51155c399eae2d4970121e82189619bd77f0 GREEN
......@@ -2,7 +2,7 @@ CanBusGeneratorExtension.java 4bed3c88e71923515d7d9dc9235bc40a49ce237f GREEN
CanConnectorGeneratorExtension.java 5680017d9ef5ec7ac81ef7c035ba0a946d0f8b15 GREEN
CanTransmissionCatalog.java 0e5d45246d1c05d8391d540053df306c3e2a0b4d GREEN
ConsoleOutputGeneratorExtension.java 49509abbd2d6e2715c2f3af074d2e46a5c0a961e GREEN
MainGenerator.java 70cb25f11ddc7349c6c921efb64858b3638f696f YELLOW
MainGenerator.java 93d8654c8aed4ee35a6c469ca2039fd060d9170a GREEN
MultiUnitMainGenerator.java b72c221bd1c45e18e8be9e63d42e92b86aef51ac GREEN
PWMActuatorGeneratorExtension.java 68db89869b6c8a64bab3e5081e750345bb6fc7fe GREEN
RaspberryPIGeneratorExtension.java 33d100efb28c217042d32facbcb0ae0ac9173b36 GREEN
......
......@@ -234,7 +234,7 @@ public abstract class MainGenerator {
Component c = p.getSecond();
String headerName = identifierName(c);
if(!headerName.isBlank())
sb.append("#include \"" + identifierName(c) + ".h\"\n");
sb.append("#include \"" + headerName + ".h\"\n");
}
// create includes for platform header files
for(String header : headers) {
......
ControlCenterDownstreamInputGeneratorExtension.java 3067dac609a1eded8fbc942f3980f7faa6eede4b YELLOW
ControlCenterUpstreamOutputGeneratorExtension.java 65c0c4847871f422597790fe8ffb8fd74b669458 YELLOW
ControlcenterGeneratorExtensionBase.java f134baffb4cf2aa22ab5fc6f76078db937aca24a YELLOW
ControlCenterDownstreamInputGeneratorExtension.java 04e102dff0b7f993d180f0517279fbbcf2d95f6d RED
ControlCenterUpstreamOutputGeneratorExtension.java b7879f35271921d1fab1caaf6db075a32c5aff5c RED
ControlcenterGeneratorExtensionBase.java b21dc38cb4958e4a2a2b7cd690e501a6abdf14fc RED
......@@ -20,8 +20,8 @@ import org.fortiss.af3.expression.model.types.TBool;
import org.fortiss.af3.expression.model.types.TDouble;
import org.fortiss.af3.expression.model.types.TInt;
import org.fortiss.af3.platform.raspberry.generator.framework.IReadableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput;
import org.fortiss.af3.platform.raspberry.model.impl.RaspberryPiImpl;
import org.fortiss.af3.project.model.typesystem.IType;
/**
......@@ -42,13 +42,15 @@ public class ControlCenterDownstreamInputGeneratorExtension
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
RaspberryPiImpl piImpl = (RaspberryPiImpl)modelElement.eContainer();
if(!piImpl.isControlcenterActivated())
// TODO TM: The `*Impl` classes should never be used directly, only the respective
// interfaces. I already adapted the following line. Please test and reset class to YELLOW
// in case it works.
RaspberryPi pi = (RaspberryPi)modelElement.eContainer();
if(!pi.isControlcenterActivated())
return "";
// get the value depending on the logical signal data type
IType variableType = logicalSignal.getVariableType();
if(variableType instanceof TDouble) {
return "af3_cc_get_double(\"" + modelElement.getName() + "\" , " + "&" +
targetVariable + ", &noval_" + targetVariable + " );\n";
......
......@@ -20,25 +20,31 @@ import org.fortiss.af3.expression.model.types.TBool;
import org.fortiss.af3.expression.model.types.TDouble;
import org.fortiss.af3.expression.model.types.TInt;
import org.fortiss.af3.platform.raspberry.generator.framework.IWriteableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput;
import org.fortiss.af3.platform.raspberry.model.impl.RaspberryPiImpl;
/** Generator extension for {@link ControlCenterUpstreamOutput}. */
public class ControlCenterUpstreamOutputGeneratorExtension
extends ControlcenterGeneratorExtensionBase<ControlCenterUpstreamOutput>
implements IWriteableGeneratorExtension {
// TODO TM: See comment in `ControlCenterDownstreamInputGeneratorExtension`.
// TODO TM: I factored the `RaspberryPi` out from the two distinct methods. Please test and
// reset class to YELLOW once all TODOs are done.
/** Model element. */
private RaspberryPi pi;
/** Constructor. */
public ControlCenterUpstreamOutputGeneratorExtension(ControlCenterUpstreamOutput modelElement) {
super(modelElement);
pi = (RaspberryPi)modelElement.eContainer();
}
/** {@inheritDoc} */
@Override
public String getWriteCode(OutputPort logicalSignal, String value) {
RaspberryPiImpl piimpl = (RaspberryPiImpl)modelElement.eContainer();
if(piimpl.isControlcenterActivated()) {
// send the value depending on the logical siganal data type
if(pi.isControlcenterActivated()) {
// send the value depending on the logical signal data type
if(logicalSignal.getVariableType() instanceof TDouble) {
return "af3_cc_send_double(\"" + logicalSignal.getName() + "\" , " + value +
" , local_logical_clock );\n";
......@@ -59,8 +65,7 @@ public class ControlCenterUpstreamOutputGeneratorExtension
/** {@inheritDoc} */
@Override
public String getNoValWriteCode(OutputPort logicalSignal) {
RaspberryPiImpl piimpl = (RaspberryPiImpl)modelElement.eContainer();
if(piimpl.isControlcenterActivated()) {
if(pi.isControlcenterActivated()) {
return "af3_cc_send_noval(\"" + logicalSignal.getName() +
"\" , local_logical_clock );\n";
}
......
......@@ -29,6 +29,7 @@ import org.fortiss.af3.platform.raspberry.model.impl.RaspberryPiImpl;
*
* @author duenhuber
*/
// TODO TM: Rename class to match the others in the same package (with a capital C in ..olCen..).
abstract class ControlcenterGeneratorExtensionBase<T extends EObject>
extends PiHALLibraryGeneratorExtensionBase<T> implements ISharedInstanceGeneratorExtension {
/** Stores the instance postfix. */
......@@ -90,6 +91,11 @@ abstract class ControlcenterGeneratorExtensionBase<T extends EObject>
/** {@inheritDoc} */
@Override
public final String getSingletonInitializationCode() {
// TODO TM: Do not use the `*Impl` class, but the respective interface (c.f.
// `ControlCenterUpstreamOutputGeneratorExtension`).
// TODO TM: Factor out the `RaspberryPi` as a private class variable to avoid code
// duplication in the following methods (c.f.
// `ControlCenterUpstreamOutputGeneratorExtension`).
RaspberryPiImpl piImpl = (RaspberryPiImpl)modelElement.eContainer();
if(!piImpl.isControlcenterActivated())
return "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment