Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Andy Carle
    @PrototypingAndy_twitter
    But: your build has one more problem. It is caused by PATHs getting too long, and right now we don't have a better fix for it than moving your %MODDABLE% directory. I recommend moving the Moddable SDK to C:\moddable and then updating your MODDABLE Environment Variable to point to it.
    mauroForlimpopoli
    @mauroForlimpopoli
    Now it works. I would never have been able to solve the problem. Thanks for your infinite patience
    Andy Carle
    @PrototypingAndy_twitter
    You're quite welcome!
    mauroForlimpopoli
    @mauroForlimpopoli
    Unfortunately, I still have the following error when I compile :

    C:\moddable\examples\piu\k6>mcconfig -d -m -r 90 -p esp32/moddable_two

    bles2gatt bleservices

    xsc main.xsb

    xsl modules

    ReferenceError: module "Bitmap" not found!

    NMAKE : fatal error U1077: 'C:\moddable\build\bin\win\release\xsl.EXE' : codice restituito '0xd'
    Stop.

    this when I add ""$(MODDABLE)/modules/io/manifest.json"" to my manifest
    {
    "build": {
    "PARTITIONS_FILE": "./partitions.csv"
    },
    "include": [
    "$(MODDABLE)/examples/manifest_base.json",
    "$(MODDABLE)/examples/manifest_piu.json",
    "$(MODULES)/input/keyboard/manifest.json",
    "$(MODULES)/pins/analog/manifest.json",
    "$(MODDABLE)/modules/files/file/manifest.json",
    "$(MODULES)/network/wifi/manifest.json",
    "$(MODDABLE)/examples/manifest_net.json",
    "$(MODDABLE)/modules/network/ble/manifest_server.json",
    "$(MODDABLE)/modules/network/ble/manifest_client.json",
    "$(MODULES)/pins/i2c/manifest.json",
    "$(MODDABLE)/modules/crypt/tls.json",
    "$(MODULES)/network/mdns/manifest.json",
    "$(MODDABLE)/modules/io/manifest.json"
    ],
    "creation":{
    "stack":500,
    "static": 98304,
    "keys": {
    "available":100
    },
    "chunk": {
    "initial":42530,
    "incremental":1024
    }
    },
    "modules": {
    "": [
    "./main",
    "./assets",
    "$(MODULES)/network/http/
    ",
    "./restart",
    "./deepSleep",
    "./funcSleep",
    "$(MODULES)/network/sntp/",
    "$(MODULES)/files/zip/
    "
    ],
    "pins/pwm": "$(MODULES)/pins/pwm/pwm",
    "esp32/ota": "$(MODDABLE)/build/devices/esp32/modules/ota/"
    },
    "resources":{
    "
    -alpha": [
    "$(MODDABLE)/examples/assets/fonts/OpenSans-Regular-20",
    "$(MODDABLE)/examples/assets/fonts/OpenSans-Semibold-18",
    "$(MODDABLE)/examples/assets/fonts/OpenSans-Light-42",
    "$(MODDABLE)/examples/assets/fonts/OpenSans-Semibold-28",
    "$(MODDABLE)/examples/assets/fonts/OpenSans-Regular-72",
    "$(MODDABLE)/examples/assets/fonts/arc64"
    ],
    "-image(50)": [
    "$(MODDABLE)/examples/assets/images/back-icon",
    "$(MODDABLE)/examples/assets/images/Bluetooth-icon",
    "$(MODDABLE)/examples/assets/images/Wifi-icon",
    "$(MODDABLE)/examples/assets/images/unlock-icon",
    "$(MODDABLE)/examples/assets/images/lock-icon"
    ],
    "
    -mask": [
    "$(MODDABLE)/examples/assets/images/loading-icon",
    "$(MODDABLE)/examples/assets/images/thermometer-mask",
    "$(MODDABLE)/examples/assets/images/battery-mask"
    ],
    "": [
    "$(MODULES)/crypt/data/ca106",
    "$(MODULES)/crypt/data/ca107",
    "$(MODULES)/crypt/data/ca109",
    "$(MODULES)/crypt/data/ca56",
    "$(MODULES)/crypt/data/ca23"
    ]
    },
    "platforms": {
    "esp": {
    "config": {
    "rotation": 90
    }
    },
    "esp32": {
    "config": {
    "rotation": 90,
    "brightness": 0,
    "file": {
    "root": "/mod/"
    }
    },
    "modules": {
    "
    ": [
    "$(MODULES)/pins/pwm/esp32/",
    "$(MODULES)/files/flash/
    ",
    "$(MODULES)/files/flash/esp32/"
    ]
    },
    "defines": {
    "serial": {
    "interface": { "UART": 2 },
    "baud": 9600,
    "config": { "dataBits": 8, "parity": "#N", "stopBits": 1 },
    "tx_pin": 17,
    "rx_pin": 16
    }
    }
    }
    },
    "preload": [
    "http",
    "sntp",
    "pins/i2c",
    "file",
    "pins/analog",
    "timer",
    "esp32/ota",
    "ble",
    "zip"
    ],
    "data": {
    "
    ": [
    "./mydata",
    "./myWeb"
    ]
    },"ble":{
    "": [
    "./bleservices/
    "
    ]
    }
    }
    John M. Wargo
    @johnwargo

    Greetings all - I setup the Moddable SDK and the Esprissif SDK on my mac tonight and when I try to run the helloworld sample, it gives me an error:

    ~/dev/moddable/moddable/examples/helloworld(public) » ls /dev/cu.*
    
    /dev/cu.Bluetooth-Incoming-Port /dev/cu.usbserial-0001
    --------------------------------------------------------------------------------
    ~/dev/moddable/moddable/examples/helloworld(public) » mcconfig -d -m -p esp32/moddable_two
    /Users/johnwargo/dev/moddable/moddable/build/tmp/esp32/moddable_two/debug/helloworld/makefile:189: ESP32_SUBCLASS esp32
    # Reconfiguring ESP-IDF...
    Traceback (most recent call last):
      File "/Users/johnwargo/esp32/esp-idf/tools/idf.py", line 45, in <module>
        from idf_py_actions.tools import (executable_exists, idf_version, merge_action_lists, realpath)  # noqa: E402
      File "/Users/johnwargo/esp32/esp-idf/tools/idf_py_actions/tools.py", line 1, in <module>
        import click
    ModuleNotFoundError: No module named 'click'
    make: *** [/Users/johnwargo/dev/moddable/moddable/build/tmp/esp32/moddable_two/debug/idf-esp32/config/sdkconfig.h] Error 1
    --------------------------------------------------------------------------------
    ~/dev/moddable/moddable/examples/helloworld(public) » UPLOAD_PORT=/dev/cu.usbserial-0001 mcconfig -d -m -p esp32/moddable_two
    /Users/johnwargo/dev/moddable/moddable/build/tmp/esp32/moddable_two/debug/helloworld/makefile:189: ESP32_SUBCLASS esp32
    # Reconfiguring ESP-IDF...
    Traceback (most recent call last):
      File "/Users/johnwargo/esp32/esp-idf/tools/idf.py", line 45, in <module>
        from idf_py_actions.tools import (executable_exists, idf_version, merge_action_lists, realpath)  # noqa: E402
      File "/Users/johnwargo/esp32/esp-idf/tools/idf_py_actions/tools.py", line 1, in <module>
        import click
    ModuleNotFoundError: No module named 'click'
    make: *** [/Users/johnwargo/dev/moddable/moddable/build/tmp/esp32/moddable_two/debug/idf-esp32/config/sdkconfig.h] Error 1

    Do you know what this error means?

    I'm a little scared that nobody's been here since April 19th, is everything OK?
    Peter Hoddie
    @phoddie
    It looks like you didn't run the script to configure IDF. This magic incantation, I believe:
    source $IDF_PATH/export.sh
    John M. Wargo
    @johnwargo
    I did, its in my shell’s ~./zshrc file.
    John M. Wargo
    @johnwargo
    here's the complete terminal output:
    Last login: Tue May 11 20:16:43 on ttys001
    Detecting the Python interpreter
    Checking "python" ...
    Checking "python3" ...
    Python 3.9.5
    "python3" has been detected
    Adding ESP-IDF tools to PATH...
    Using Python interpreter in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/bin/python
    Checking if Python packages are up to date...
    Python requirements from /Users/johnwargo/esp32/esp-idf/requirements.txt are satisfied.
    Updated PATH variable:
      /Users/johnwargo/esp32/esp-idf/components/esptool_py/esptool:/Users/johnwargo/esp32/esp-idf/components/espcoredump:/Users/johnwargo/esp32/esp-idf/components/partition_table:/Users/johnwargo/esp32/esp-idf/components/app_update:/Users/johnwargo/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin:/Users/johnwargo/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin:/Users/johnwargo/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/Users/johnwargo/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:/Users/johnwargo/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin:/Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/bin:/Users/johnwargo/esp32/esp-idf/tools:/Users/johnwargo/dev/moddable/moddable/build/bin/mac/release:/usr/local/opt/ruby/bin:/Users/johnwargo/.yarn/bin:/Users/johnwargo/.config/yarn/global/node_modules/.bin:/Users/johnwargo/.nvm/versions/node/v13.8.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/johnwargo/Library/Android/sdk/tools:/Users/johnwargo/Library/Android/sdk/tools/bin/:/Users/johnwargo/Library/Android/sdk/platform-tools:/Users/johnwargo/flutter/bin
    Done! You can now compile ESP-IDF projects.
    Go to the project directory and run:
    
      idf.py build
    
    --------------------------------------------------------------------------------
    ~ » cd ${MODDABLE}/examples/helloworld                        johnwargo@mini-18
    --------------------------------------------------------------------------------
    ~/dev/moddable/moddable/examples/helloworld(public) » mcconfig -d -m -p esp32/moddable_two
    /Users/johnwargo/dev/moddable/moddable/build/tmp/esp32/moddable_two/debug/helloworld/makefile:189: ESP32_SUBCLASS esp32
    # Reconfiguring ESP-IDF...
    Traceback (most recent call last):
      File "/Users/johnwargo/esp32/esp-idf/tools/idf.py", line 45, in <module>
        from idf_py_actions.tools import (executable_exists, idf_version, merge_action_lists, realpath)  # noqa: E402
      File "/Users/johnwargo/esp32/esp-idf/tools/idf_py_actions/tools.py", line 1, in <module>
        import click
    ModuleNotFoundError: No module named 'click'
    make: *** [/Users/johnwargo/dev/moddable/moddable/build/tmp/esp32/moddable_two/debug/idf-esp32/config/sdkconfig.h] Error 1
    --------------------------------------------------------------------------------
    ~/dev/moddable/moddable/examples/helloworld(public) »     2 ↵ johnwargo@mini-18
    John M. Wargo
    @johnwargo
    @phoddie any thoughts? I thought I followed the instructions to the letter. Well, not to the letter, I put the ESP32 folder in a different place, is that causing this?
    John M. Wargo
    @johnwargo
    Actually, I take that back - I did put the esp32 folder where the instructions said to put it.
    John M. Wargo
    @johnwargo
    Everything installs correctly:
    ❯ cd $IDF_PATH 
    
    esp-idf git/release/v4.2  
    ❯ ./install.sh
    Detecting the Python interpreter
    Checking "python" ...
    Python 3.9.1
    "python" has been detected
    Installing ESP-IDF tools
    Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, esp32ulp-elf, esp32s2ulp-elf, openocd-esp32
    Skipping xtensa-esp32-elf@esp-2020r3-8.4.0 (already installed)
    Skipping xtensa-esp32s2-elf@esp-2020r3-8.4.0 (already installed)
    Skipping esp32ulp-elf@2.28.51-esp-20191205 (already installed)
    Skipping esp32s2ulp-elf@2.28.51-esp-20191205 (already installed)
    Skipping openocd-esp32@v0.10.0-esp32-20200709 (already installed)
    Installing Python environment and packages
    Installing Python packages from /Users/johnwargo/esp32/esp-idf/requirements.txt
    Ignoring python-socketio: markers 'python_version <= "2.7"' don't match your environment
    Ignoring None: markers 'sys_platform == "win32"' don't match your environment
    Requirement already satisfied: setuptools>=21 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 4)) (56.0.0)
    Requirement already satisfied: click>=5.0 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 8)) (8.0.0)
    Requirement already satisfied: pyserial>=3.0 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 9)) (3.5)
    Requirement already satisfied: future>=0.15.2 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 10)) (0.18.2)
    Requirement already satisfied: cryptography>=2.1.4 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 11)) (3.4.7)
    Requirement already satisfied: pyparsing<2.4.0,>=2.0.3 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 12)) (2.3.1)
    Requirement already satisfied: pyelftools>=0.22 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 13)) (0.27)
    Requirement already satisfied: gdbgui==0.13.2.0 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 15)) (0.13.2.0)
    Requirement already satisfied: pygdbmi<=0.9.0.2 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 18)) (0.9.0.2)
    Requirement already satisfied: reedsolo<=1.5.4,>=1.5.3 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 23)) (1.5.4)
    Requirement already satisfied: bitstring>=3.1.6 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 24)) (3.1.7)
    Requirement already satisfied: ecdsa>=0.16.0 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from -r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 25)) (0.16.1)
    Requirement already satisfied: gevent<2.0,>=1.2.2 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from gdbgui==0.13.2.0->-r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 15)) (1.5.0)
    Requirement already satisfied: Flask-Compress<2.0,>=1.4.0 in /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/lib/python3.9/site-packages (from gdbgui==0.13.2.0->-r /Users/johnwargo/esp32/esp-idf/requirements.txt (line 15)) (1.9.0)
    Requirement already satisfied: Flask-SocketIO<3.0,>=2.9 in /Users/johnwargo
    John M. Wargo
    @johnwargo
    @phoddie can you please help me? I provided my console output indicating that the tools installed correctly and I executed the source $IDF_PATH/export.sh command. It's not working. Do you have any other suggestions?
    @Frida854 your output is the same as mine, I'm not sure why you're showing it to me.
    Frida854
    @Frida854
    @johnwargo
    I'm sorry, it should not happen again.
    Daniel Ashcraft
    @dashcraft
    @johnwargo you might make sure that you only have 1 version of python installed. I had 3 versions, 2.7, 3.2 and 3.9,
    i kept getting dependency errors because all 3 conflicted with my python terminal usage. After deleting all but the latest
    and running the python package commands again, everything worked fine.
    John M. Wargo
    @johnwargo
    @dashcraft thanks for that. I should only have one Python version running, the output above only shows one. I read an article about how to install a newer version of Python on macOS (over the macOS installed one) so I'm using pyenv https://opensource.com/article/19/5/python-3-default-mac
    Andy Carle
    @PrototypingAndy_twitter
    @johnwargo Good afternoon. Any chance that something later in your .zshrc is overriding a path set by $IDF_PATH/export.sh? You might try just doing a source $IDF_PATH/export.shin the terminal right before building to see if that helps any.

    You could also try building a standard ESP-IDF example. If your shell environment is properly configured, something like this should complete successfully:

    cd $IDF_PATH/examples/get-started/hello_world
    idf.py build flash monitor

    If that doesn't work, your issue is something outside of Moddable land.

    John M. Wargo
    @johnwargo

    @dashcraft

    @johnwargo you might make sure that you only have 1 version of python installed. I had 3 versions, 2.7, 3.2 and 3.9,
    i kept getting dependency errors because all 3 conflicted with my python terminal usage. After deleting all but the latest
    and running the python package commands again, everything worked fine.

    Yeah, so I have three copies: the macOS one, my pyenv one and the one that comes with the esp32 SDK.

    ❯ where python
    /Users/johnwargo/.pyenv/shims/python
    /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/bin/python
    /usr/bin/python

    Its my understanding I can't whack the Apple one (please correct me if I'm wrong), but I can redo the ESP32 installation without Python and see what happens.

    John M. Wargo
    @johnwargo
    @PrototypingAndy_twitter that did work, so outside of Moddable land works. the source command was in my ~./zshrc file only once, but I removed it and executed it manually in the terminal window.
    John M. Wargo
    @johnwargo
    hmmm, the idf install installs python automatically and, of course, puts it in the PATH. I'm not sure what to do with that.
    John M. Wargo
    @johnwargo
    Alright, @dashcraft was right - when I removed my pyenv python stuff from the ~/.zshrc it works.
    ❯ where python
    /Users/johnwargo/.espressif/python_env/idf4.2_py3.9_env/bin/python
    /usr/bin/python
    Peter Hoddie
    @phoddie
    Three cheers for @dashcraft! Thank you!
    Daniel Ashcraft
    @dashcraft
    Heyo! Awesome!
    Daniel Ashcraft
    @dashcraft
    Are there any successful apple home kit integrations using moddable sdk?
    Peter Hoddie
    @phoddie
    Good question. Some years ago the Kinoma team at Marvell did have HomeKit working with Kinoma Element. That's relevant because it was built on XS and an earlier version of our TLS stack. I believe it made use of some crypto features that haven't been migrated to the Moddable SDK yet, but it would be some work figure out what is needed (and HomeKit has changed since then). Beyond the crypto work, it should be straightforward (and the crypto work should be straightforward for someone comfortable with that)
    Daniel Ashcraft
    @dashcraft
    Idk if anyone is interested in this kind of stuff, but toit.io and toit lang looks fairly promising, however they've gone the route of vc funding which means you gotta pay the bridge troll to play
    Daniel Ashcraft
    @dashcraft
    Does moddable sdk minimize the js files/bundle js files or do any tree shaking of dependencies?
    Andy Carle
    @PrototypingAndy_twitter
    For the XS engine itself, the Moddable SDK strips unused features by default. See Strip Unused Features in the "XS Differences" document and the associated note in the manifest documentation. If you're talking about application files, the build tools just go by what they're told to do in the manifest.
    Daniel Ashcraft
    @dashcraft

    Good question, im contemplating some build tooling similar to what I get in web. If I use import { debounce } from 'lodash' for instance, it won't import
    the entire library, but it'll import the destructured method that's used and the rest of the dependencies "shake" off so to speak.

    I'm interested if anyone has used a bundler or js minifier with success, up to and including tree shaking, to reduce end bundle size.

    I apologize in advance for my lack of knowledge in this area, I'm used to the web world and I'm contemplating building an expressJs like router for
    moddable sdk wanted to make sure i didn't go down a path that left too many unused deps
    Peter Hoddie
    @phoddie
    Minifiers for the web are generally focused on making the JavaScript source text small. On an embedded device with the Moddable SDK the JavaScript is usually precompiled so shrinking the source text isn't always helpful. In some cases, it can make the code bigger. For example, a minifier may replace "false" with "!1" to save three byes. But, it will generate bigger (and slower) bytecode when built for embedded. Similarly, many of the goals of a bundler aren't really meaningful with the preload feature of the XS linker.
    All that said, like expressJs should very much be possible. The full expressiveness of JavaScript is there. The difference is that using it efficiently for embedded is often quite different from the web world.
    Some form of tree shaking for modules should be possible and would be great for helping keep firmware sizes down. It just looks like a non-trivial project to sort out the right place to start and how to integrate that through the build.
    Daniel Ashcraft
    @dashcraft

    Hmmmm very interesting. Is there any current moddable sdk npm style packages that have been used and work well that I could emulate?

    I also have some resources in the webpack and older gulpjs community I might be able to leverage.

    Peter Hoddie
    @phoddie
    Sorry, no NPM packages (hard as that may be to believe!)
    Peter Hoddie
    @phoddie
    Each .js fie in $MODDABLE/modules/ is a real ECMAScript module. It should be straightforward to put together an npm style package for them.
    Daniel Ashcraft
    @dashcraft
    @phoddie are there any plans for js sandboxing or using vm's for dedicated isolated app environments?
    Peter Hoddie
    @phoddie
    XS is the only engine to implement Secure ECMAScript natively. That provides Compartments which is a low-overhead way to virtualize/sandbox JavaScript code. The Secure ECMAScript section of this blog post is a good place to start learning about that, though a few of the details are out-of-date.
    This talk includes a demo of using Secure ECMAScript to sandbox JavaScript extensions to the firmware of a lightbulb. It is from a meet-up sponsored by Agoric, the folks who have been working on JavaScript virtualization longer than anyone.
    Daniel Ashcraft
    @dashcraft
    Very interesting, very very interesting
    Daniel Ashcraft
    @dashcraft
    Probably a question that's answered somewhere in the docs, but how do you parse a posted body through the http server?
    I'm trying to acccess incoming headers and data/body
    Daniel Ashcraft
    @dashcraft
    I’ve actually figured out headers, working on bodies, disregard
    Peter Hoddie
    @phoddie
    The httpserverputfile example is a good place to start for receiving the body in chunks.
    Daniel Ashcraft
    @dashcraft
    Another potential silly question, i don't see many docs explaining nested file includes. It seems as though each
    file needs to be included as a module. Are there examples i can reference for local nested file includes?
    image.png