onReadablle
callback that is invoked when the interrupt triggers. The Digital class installs an ISR and triggers your JavaScript callback. This button code is a good example of how that works.
Perfect. I have the ESP-IDF port working in Moddable now (sending/receiving LoRa packets in Moddable) but I'm going to try to port to JS next as that would be much cleaner / more maintainable.
You can always run that in its own virtual machine to ensure it isn't blocking if it comes to that.
Is this using Workers? We have a discussion earlier (more than a year ago) where you said they were experimental. How are you feeling about the reliability of Workers now?
mcconfig
kill the running instance of the seriall2xsbug
bridge. So, you'll probably need to manually launch serial2xsbug
twice, each with a different serial port. They will both connect to the same instance of xsbug.
received()
to see if a packet is waiting (then receive_packet
will be quite fast as it reads from a FIFO on the chip). You will see in there a TODO comment on the SPI config about Port - I wasn't clear as some code sets port to "VSPI" or "HSPI" but other code samples use "0" and "1". Not sure what that value really means yet, especially since I set the pins. Also if you look at the constructor, you will see I had issues with SPI automatically managing the CS pin, and had to remove it from SPI and do it myself.
device.io
for things like SPI, button, LED, etc. When I run, for example, the io/digital/button example, it fails for both esp32
and esp32/heltec_wifi_kit_32
because it isn't defined. Are those just missing, or do I need to do something to get them for those devices?
device
global is what binds the Ecma-419 APIs to the specific hardware you are running on. It must be provided by the build target. Not all do yet. The ESP32 provider doesn't provide device.pin.button
because that isn't defined by ESP32 but by a particular board, like Moddable Two.
@cmidgley When you get a chance, could you try something for me? I just want to make sure we're looking at the same problem. In %MODDABLE%\tools\xsbug\behaviors.js
and %MODDABLE%\tools\xsbug\ConsolePane.js
, comment out the lines (three total) that reference application.cursor
, then close xsbug and rebuild tools (build.bat
).
The diffs for the changes are:
$ cd $MODDABLE/tools/xsbug
andyc@ANDY-SURFACE MINGW64 /c/moddable/tools/xsbug (master)
$ git diff behaviors.js
diff --git a/tools/xsbug/behaviors.js b/tools/xsbug/behaviors.js
index e41106e31..4aa9d9f71 100644
--- a/tools/xsbug/behaviors.js
+++ b/tools/xsbug/behaviors.js
@@ -51,7 +51,7 @@ export class ButtonBehavior extends Behavior {
this.changeState(container, container.active ? 1 : 0);
}
onMouseEntered(container, x, y) {
- application.cursor = cursors.arrow;
+ // application.cursor = cursors.arrow;
this.changeState(container, 2);
}
onMouseExited(container, x, y) {
@@ -379,7 +379,7 @@ export class CodeBehavior extends Behavior {
return true;
}
onMouseEntered(code, x, y) {
- application.cursor = cursors.iBeam;
+ // application.cursor = cursors.iBeam;
}
onReveal(code) {
this.getScroller(code).reveal(code.selectionBounds);
andyc@ANDY-SURFACE MINGW64 /c/moddable/tools/xsbug (master)
$ git diff ConsolePane.js
diff --git a/tools/xsbug/ConsolePane.js b/tools/xsbug/ConsolePane.js
index 12daa115d..899c9bbc7 100644
--- a/tools/xsbug/ConsolePane.js
+++ b/tools/xsbug/ConsolePane.js
@@ -108,7 +108,7 @@ class ConsoleCodeBehavior extends CodeBehavior {
let bounds = code.bounds;
let offset = code.findLineBreak(code.hitOffset(x - bounds.x, y - bounds.y), false);
let color = this.colors.find(color => color.offset == offset);
- application.cursor = color ? cursors.link : cursors.iBeam;
+ // application.cursor = color ? cursors.link : cursors.iBeam;
}
onTouchEnded(code, id, x, y, ticks) {
super.onTouchEnded(code, id, x, y, ticks);
mcrun -m -p <myplatform> -o build
) but I just want a build without launching tools like xsbug
or serial2xsbug
. Not using -d
at least stops xsbug
from launching, and -p
stops the simulator from running, but it always launches serial2xsbug
. With mcconfig
I can use -t build
but that isn't available with mcrun
. Any recommendations on how to build a mod, without launching the debugger or serial2xsbug? This is for an automated build system that I'm putting together inside Docker.
sed
to remove the line referencing SERIAL2XSBUG in makefile:mcrun -p <myplatform> -o build
pushd build/tmp/esp32/release/mod
sed '/$(SERIAL2XSBUG) $(UPLOAD_PORT) $(DEBUGGER_SPEED) 8N1 -install $(ARCHIVE)/d' makefile >makefile >makefile
make
popd