Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Peter Hoddie
    @phoddie
    @cmidgley – here's a bit of trivia for future reference. You asked about how to run code after preload completes. It turns out there's a simple solution: use a Promise:
    Promise.resolve().then(() => {
        // this code runs after all preloads complete but before lockdown of the firmware image
    });
    Chris
    @cmidgley
    Interesting! I'll give it a try (though I have found a workaround that is working ... using the last entry in the preload array as you suggested). This might simplify the manifests though so I'll give it a whirl. thx.
    Lawrence R Kincheloe
    @LokiMetaSmith
    there's a typo, #define ICACHE_XS6RO2_ATTR attribute((section(".rodata.xs6ro2"))) attribute((aligned(4)))
    #define ICACHE_XS6STRING_ATTR __attribute((section(".rodata.str1.4"))) __attribute__((aligned(4)))

    it was listed as

    define ICACHE_XS6STRING_ATTR attribute((section(".rodata.str1.4"))) attribute__((aligned(4)))

    but should be

    define ICACHE_XS6STRING_ATTR attribute((section(".rodata.str1.4"))) attribute((aligned(4)))

    still doesn't fix the issue though

    I gotta figure out formatting in gitter, this is horrible...
    Peter Hoddie
    @phoddie
    Good catch. GCC attributes like that are really difficult to read (and apparently to write reliably too!).
    What's the issue you are looking into?
    Lawrence R Kincheloe
    @LokiMetaSmith
    trying to stage the esp32c3 pull request
    but there's code I commented out to make it work, and figuring out why it isn't working is well, entertaining
    Peter Hoddie
    @phoddie
    Could be. The section stuff with GCC has always been a little mysterious. The section attributes are necessary on ESP8266 but I think on ESP32 they aren't really necessary (different versions of GCC, different CPU capabilities). The attribute is still relevant. Maybe you can eliminate the section attribute for your target (maybe we can do that for ESP32 in general?).
    moddable getting love during jsconf budapest from nick!
    Peter Hoddie
    @phoddie
    That looks so great! Thanks for posting. I'm going to have to make time to watch that today.
    Lawrence R Kincheloe
    @LokiMetaSmith
    heads up, esp-idf version 5 has a bunch of migration issues. https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/index.html
    Peter Hoddie
    @phoddie
    No doubt! Every major version does. We've survived all the other transitions. We'll get through this one too.
    Peter Hoddie
    @phoddie
    (I just hope audio isn't broken again. Or, at least, that v5 finally correctly fixes the ADC audio woes of ESP-IDF v4.4. @meganetaaan and I have wrestled with that enough.)
    Lawrence R Kincheloe
    @LokiMetaSmith

    I'm still getting error: conflicting types for 'size_t' typedef __SIZE_TYPE__ size_t;
    feeling kind of stuck.

    https://github.com/juniper-garden/moddable/tree/testing_tag3

    Peter Hoddie
    @phoddie
    Will try to take a look today.
    Michael Kellner
    @mkellner
    @lokimetasmith, using your testing_tag3 branch... at line 112 in xs/includes/xs.h change from #if defined(__ets__) to #if defined(__ets__) && !ESP32. And in xs/platforms/esp/xsHost.h, change the vPortEnter/ExitCritical to portENTER_/portEXIT_CRITICAL to get past the next hurdle.
    Michael Kellner
    @mkellner
    Thanks to @LokiMetaSmith, there is now early support for the esp32c3.
    Michael Kellner
    @mkellner
    There are a number of c3 boards out there. I have been using the ESP32-C3-DevKitM-1 from Espressif. For the AI Thinker modules like ESP-C3_32S-Kit or ESP-C3-12F-Kit, I had to set UPLOAD_SPEED to 460800.
    Lawrence R Kincheloe
    @LokiMetaSmith
    They both use the CH340 serial chipset, which I think should set the max baud rate, also the layout if mismatched impedance on the data lines cause any issues. The ESP32c3 devkit m1 uses CP2102N-A02-GQFN28
    Lawrence R Kincheloe
    @LokiMetaSmith
    yeah, from the datasheet" For one-directional 1Mbps and above, or bi-directional 500Kbps and above, recommended to use CH343,
    enable automatic hardware flow control.
    The baud rate error of CH340 UART reception is about 2%, the baud rate error of CH340G/CH340T/CH340R
    UART transmission is less than 0.3%, and the baud rate of CH340C/CH340N/CH340K/CH340E/CH340X/CH340B
    is less than 1.2%"
    I bet you're dealing with a lower grade CH340
    mtoko
    @mtoko
    Hi, I have just bought the IOT Development book and am working my way through it. I did eventually get the toolchain setup and am working on Chapter 3 networking. I am using an ESP8266 and have tested all the connect to Wifi examples and these work fine, I want to continue to the http-get example, but it not too clear how to use this. I assume that the esp needs to be connected to Wifi first so I have added the http-get code to the main.js in wifi-code, but the I get an error in the debugger (host): module "http" not found. If I can work this out it will help with the rest of the examples. Any advice appreciated
    Andy Carle
    @PrototypingAndy_twitter

    Hi @mtoko, welcome to our Gitter! Most of the Chapter 3 examples use a two-step process: first you install the host application and then you use mcrun to install the example mods. Have you worked through any of the examples that work this way in earlier chapters? If not, it may be worth briefly going back to Chapter 1 to familiarize yourself with the process.

    I'm guessing that we're not in the same time zone, so I'll provide some additional instructions here to keep you moving if you return to this while I'm offline. Basically, you want to go to the ch3-network folder in your terminal and then do something like:

    cd host
    mcconfig -d -m -p esp

    then when the host app has successfully launched, use control-c to break out of the debugger connection, then do:

    cd ..
    cd http-get
    mcrun -d -m -p esp
    mtoko
    @mtoko
    Hi @PrototypingAndy_twitter , thanks for the help! I have made great progress and got the examples running on both esp and esp32. The setting up of the toolchain was a challenge but the detailed description on Github and the instructions in the book are excellent. I would have been interested in this anyway but I am a long time Node Red user and have seen the early implementation of Node Red on esp. I have got the MQTT example running, the possibilities of this boggle the mind! Who would have thought in these times that buying a book would be so worthwhile!
    Andy Carle
    @PrototypingAndy_twitter
    Great! I'm glad to hear that you got it working.
    js4iot
    @js4iot
    Does Moddable have a way to connect to a gRPC server talking over HTTP/2?
    Peter Hoddie
    @phoddie
    Hey, @js4iot. We don't currently support HTTP/2. That would be a bit of an adventure.
    Why do you ask?
    js4iot
    @js4iot
    Totally understood. I asked because the company that I work for (Salesforce) released a new product to broadcast messages based on gRPC (http/2) and I was thinking on building a demo. I guess I could have some middleware where I connect from the board using MQTT, and from Salesforce using the new product. Thanks
    Peter Hoddie
    @phoddie
    Thanks for the info. A bridge between gRPC (HTTP/2) and MQTT (or WebSockets?) sounds like a practical place to start.
    Tobias Wendling
    @tobiaswendling

    Hello everyone! I got some problems with my project:
    manifest.json

    {
        "include": [
            "$(MODDABLE)/modules/io/manifest.json",
            "$(MODDABLE)/modules/drivers/sensors/ccs811/manifest.json",
            "$(MODDABLE)/modules/drivers/sensors/bmp280/manifest.json",
            "$(MODDABLE)/modules/drivers/sensors/shtc3/manifest.json"
        ],
        "modules": {
            "*": [
                "./main"
            ]
        }
    }

    main.js

    import CCS811 from "embedded:sensor/AirQuality/CCS811"
    import BMP280 from "embedded:sensor/AtmosphericPressure-Temperature/BMP280"
    import SHTC3 from "embedded:sensor/Humidity-Temperature/SHTC3";
    import Timer from "timer"
    
    const bmp280 = new BMP280({ 
        sensor: device.I2C.default 
    })
    
    const ccs811 = new CCS811({ 
        sensor: {
            ...device.I2C.default,
            io: device.io.SMBus
        }
    })
    
    const shtc3 = new SHTC3({ 
        sensor: device.I2C.default 
    })
    
    bmp280.configure({ 
        mode: 3,
        temperatureSampling: 2,
        pressureSampling: 5,
        filter: 4,
        standbyDuration: 4
    })
    
    ccs811.configure({ mode: 1 })
    
    shtc3.configure({
        lowPower: false,
        autoSleep: false
    });
    
    Timer.repeat(() => {
        const bmp280_sample = bmp280.sample()
        const ccs811_sample = ccs811.sample()
        const shtc3_sample = shtc3.sample()
    
        const temperature = bmp280_sample.thermometer.temperature?.toFixed(2)
        const pressure = bmp280_sample.barometer.pressure?.toFixed(2)
        const eco2 = ccs811_sample.eCO2
        const tvoc = ccs811_sample.TVOC
        const humidity = shtc3_sample.hygrometer.humidity?.toFixed(2)
    
        trace(`Temperature: ${ temperature } C\n`)
        trace(`Pressure: ${ pressure } C\n`)
        trace(`eCO2: ${ eco2 } ppm\n`)
        trace(`TVOC: ${ tvoc } ppm\n`)
        trace(`Humidity: ${ humidity } %RH\n`)
    }, 2000)

    When i execute my code with mcconfig -d -m -p esp32/nodemcu xsbug starts but it looks like that the main.js tab is flickering - if i click on it it instantly closes. Looks like its stuck in a loop. What can i do?

    Tobias Wendling
    @tobiaswendling
    The problem also occurs when opening another project (e.g. moddable/examples/drivers/sensors/bmp280
    Michael Kellner
    @mkellner

    Hello @tobiaswendling. I tried your code on a nodemcu without any sensors connected. If you put a line debugger; after the imports, then you can step through the creation of your sensor objects and see which one fails.

    I then connected up the set of sensors (SHTC3, CCS811 and BMP180) and tried again and... Success!

    Humidity: 38.74 %RH
    Temperature: 27.18 C
    Pressure: 100872.29 C
    eCO2: 410 ppm
    TVOC: 1 ppm
    So, I suspect a wiring issue.
    Tobias Wendling
    @tobiaswendling
    Ok, i'll check that again - thanks for the reply!
    Tobias Wendling
    @tobiaswendling
    I tried my code on my NodeMCU ESP32 - it's this one here: https://joy-it.net/en/products/SBC-NodeMCU-ESP32 - without any sensors. The problem still remains: After mcconfig -d -m -p esp32/nodemcu xsbug opens but the tab "main" on top of xsbug is "flickering". When i click on it the tab is closing instantly. I cant even get to the point of using debugger...
    Tobias Wendling
    @tobiaswendling
    I also tried to get sensor data by using Arduino and not ModdableSDK: I get all sensor data - so there is no wiring issue.
    Michael Kellner
    @mkellner

    If you put the debugger; statement after the imports and rebuild, xsbug should stop when it gets there. Start single-stepping and let me know how far you get.

    To make sure we're starting from the same place, remove the build results directories - that is rm -rf $MODDABLE/build/bin/esp32 $MODDABLE/bulid/tmp/esp32 (or the windows equivalent - BTW: which host OS are you using?)

    Tobias Wendling
    @tobiaswendling
    I'm using MacOS. I already did ...
    1) Deleted the bin/esp32 and tmp/esp32<
    2) Added debugger; after the imports
    Is there a way to show images here? I cant single-step through anything, because i cant access anything. xsbug wont let me open up "main". I cant press any buttons to start, stop or pause anything
    I even did a full reset and reinstalled MacOS and Moddable
    Tobias Wendling
    @tobiaswendling
    I recorded xsbug ... maybe this helps: https://vimeo.com/730663986
    Simple modules like a "Hello World" work just fine (with only "$(MODDABLE)/examples/manifest_base.json" included). But as soon as I add the "$(MODDABLE)/modules/io/manifest.json" it gets stuck as seen in the video.
    Peter Hoddie
    @phoddie
    The flickering behavior in xsbug suggests that the device is constantly rebooting for some reason. It may be something needs to be configured differently for your board. You might try and instrumented build to see if that shows why it the device is rebooting. Pass -i to mcconfig instead of -d to use an instrumented build.