Browse Source

show reply from abs/rel in case of error

Martin Kunz 4 years ago
parent
commit
7a8f6dfe99

+ 2 - 0
.idea/encodings.xml

@@ -2,5 +2,7 @@
 <project version="4">
   <component name="Encoding">
     <file url="file://$PROJECT_DIR$" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
   </component>
 </project>

+ 6 - 4
src/main/java/uraxis/programnodes/FestoNodeContribution.java

@@ -68,13 +68,15 @@ public class FestoNodeContribution implements ProgramNodeContribution {
     @Override
     public void generateScript(ScriptWriter writer) {
         if(nodeType==NodeType.ABS) {
-            writer.appendLine(getInstallation().getXMLRPCVariable() + ".abs(" + getPosition() + ", "+ getSpeed() +")");
-            writer.appendLine("write_output_integer_register(3,"+ getPosition()+")");
+            writer.appendLine(String.format("ret = %s.abs(%d, %d)", getInstallation().getXMLRPCVariable(), getPosition(), getSpeed()));
         }
         else {
-            writer.appendLine(getInstallation().getXMLRPCVariable() + ".rel(" + getPosition() + ", "+ getSpeed() +")");
-            writer.appendLine("write_output_integer_register(3," + getPosition() + ")");
+            writer.appendLine(String.format("ret = %s.rel(%d, %d)", getInstallation().getXMLRPCVariable(), getPosition(), getSpeed()));
         }
+        writer.appendLine("if (ret != \"OK\"):");
+        writer.appendLine(String.format("popup(ret)"));
+        writer.appendLine("end");
+        writer.appendLine("write_output_integer_register(3," + getPosition() + ")");
         writer.writeChildren();
 
     }

+ 0 - 1
src/main/resources/uraxis/installation.html

@@ -8,7 +8,6 @@
 				width: 100px;
 				height: 28px;
 			}
-
 			input {
 				display: inline-block;
 				width: 200px;

+ 1 - 1
uraxis.iml

@@ -12,7 +12,7 @@
           <property key="Bundle-Description" value="This is a description of the URCap" />
           <property key="Import-Package" value="com.ur.urcap.api*;version=&quot;[1.7.0,2.0.0)&quot;,*" />
           <property key="Bundle-Name" value="uraxis" />
-          <property key="Include-Resource" value="is/installation.html=$MODULE_DIR$/src/main/resources/uraxis/installation.html,uraxis/programnode.html=$MODULE_DIR$/src/main/resources/uraxis/programnode.html" />
+          <property key="Include-Resource" value="icons/acme_logo.png=$MODULE_DIR$/src/main/resources/icons/acme_logo.png,is/installation.html=$MODULE_DIR$/src/main/resources/uraxis/installation.html" />
         </additionalProperties>
         <additionalJARContents />
       </configuration>