diff --git a/simulation/src/de/c3ma/ollo/mockup/ESP8266Node.java b/simulation/src/de/c3ma/ollo/mockup/ESP8266Node.java index 1ff7824..efc1d86 100644 --- a/simulation/src/de/c3ma/ollo/mockup/ESP8266Node.java +++ b/simulation/src/de/c3ma/ollo/mockup/ESP8266Node.java @@ -34,6 +34,7 @@ public class ESP8266Node extends TwoArgFunction { final LuaTable node = new LuaTable(); node.set("compile", new CompileFunction()); node.set("restart", new RestartFunction()); + node.set("heap", new HeapFunction()); env.set("node", node); env.get("package").get("loaded").set("node", node); return node; @@ -73,6 +74,18 @@ public class ESP8266Node extends TwoArgFunction { } + private class HeapFunction extends ZeroArgFunction { + + @Override + public LuaValue call() { + System.out.println("[Node] Heap"); + return LuaValue.valueOf(Runtime.getRuntime().freeMemory()); + } + + } + + + public void setWorkingDirectory(File workingDir) { this.workingDir = workingDir; } diff --git a/simulation/src/de/c3ma/ollo/mockup/ESP8266Tmr.java b/simulation/src/de/c3ma/ollo/mockup/ESP8266Tmr.java index aa5e207..5802d18 100644 --- a/simulation/src/de/c3ma/ollo/mockup/ESP8266Tmr.java +++ b/simulation/src/de/c3ma/ollo/mockup/ESP8266Tmr.java @@ -34,6 +34,7 @@ public class ESP8266Tmr extends TwoArgFunction { tmr.set("stop", new stop()); tmr.set("alarm", new alarm()); tmr.set("create", new create()); + tmr.set("wdclr", new watchDog()); env.set("tmr", tmr); env.get("package").get("loaded").set("tmr", tmr); @@ -127,6 +128,15 @@ public class ESP8266Tmr extends TwoArgFunction { } } + private class watchDog extends ZeroArgFunction { + + public LuaValue call() { + System.out.println("[TMR] Watchdog fed"); + return LuaValue.valueOf(true); + + } + } + private class dynStop extends ZeroArgFunction { private final int dynIndex; public dynStop(int index) {