Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    matrixbot
    @matrixbot
    ildar Does nobody like Busted over RPC ?
    ildar 🙁
    Terry Ellison
    @TerryE
    I am wading through the issues related to getting our Lua 5.3 port from alpha to beta, and currently I am the only contributor actively working on the Lua core. I am using the Lua test suite in the luac.cross -e environment as part of my test strategy (this runs the NodeMCU execution environment including ROTable support on the host). Part of these tests can run on a standard Lua VM, but part also require the core to be modified with the Test Suite patches. make LUA=53 TEST=1will build the firmware with the Lua 5.3 runtime and enable the T test module support in luac.cross -e
    My intention is to run the subset of the test suite that doesn't require the Tmodule on ESP, but delivered through one or more LFS images. I will also extend this to add test vectors for some of the core nodemcu modules.
    Terry Ellison
    @TerryE
    We've only got ~44Kb heap available on boot, so getting environments like tango to run without LFS would be extremely difficult, and tango+ssl pretty much impossible, IMO.
    If you've come from the world of have I got 4 Gb to work with or is 8 ... then getting your head around living within 44Kb is quite hard.
    You can't assume that a reused infrastructure stack will be able to load, let alone run an effective application.
    Terry Ellison
    @TerryE
    So whether we like Busted vs. RPC vs. some raw socket implementation really starts with "here is an example of my RPC-like system running this non-trivial application". This is with a git library containing this host end and this ESP client end. If you can't provide a decent example showing that you've addressed the RAM constraints for at least one realistic usecase, then the debate is purely academic.
    matrixbot
    @matrixbot
    ildar Sure! I support your (pragmatic) POV. I'll show you figures I currently have for Tango in Spiffs tomorrow as I don't have it at home
    ildar I'm sure using LFS would make it slim
    ildar And definitely I don't intend to distance you from the important Lua platform change

    ildar > <@ildar:matrix.org> And definitely I don't intend to distance you from the important Lua platform change

    I mean distract

    Javier Peletier
    @jpeletier
    @TerryE @marcelstoer Do you know why Lua's standard iomodule is commented out (i.e., not enabled). It seems it does mostly what filedoes, and could work with ESP_IDF's vfs system.
    Terry Ellison
    @TerryE
    @jpeletier Javier, it's because the work to port it was never done. The file library was created as a stop-gap and has hung around ever since. See #2145 comment. Testing the file module comprehensively is a PITA. adding io is definitely a wish list item but it all comes down to priorities and time.
    Javier Peletier
    @jpeletier
    @TerryE Good, I just wanted to know in case there was some technical pitfall. Having it for ESP32 should not be a lot of work, I'll add it to the list of things once I have time.
    eliffakgunn
    @eliffakgunn
    hello i am new on esp world and i try to connect oled led and nodemcu v3. can somebody help with connections? I connect esp and led two different ways that i found internet. First is scl to D1 and sda to D2 (aslo vvc-vcc, gnd-gnd) second is scl-tx and sda-rx. Which is true?
    İ tried both ways but they did not work. I set NodeMcu ESP8266 12E on Arduino IDE then i used this libraries: https://github.com/adafruit/Adafruit-GFX-Library and https://github.com/adafruit/Adafruit_SSD1306 . Then i try ssd1306_128x64_i2c example in Adafruit_SSD1306 library. When i run the program i get this but there is nothing on the led.

    @eliffakgunn
    İ tried both ways but they did not work. I set NodeMcu ESP8266 12E on Arduino IDE then i used this libraries: https://github.com/adafruit/Adafruit-GFX-Library and https://github.com/adafruit/Adafruit_SSD1306 . Then i try ssd1306_128x64_i2c example in Adafruit_SSD1306 library. When i run the program i get this but there is nothing on the led.
    When i run the progam i get this: *
    esptool.py v2.6
    2.6
    esptool.py v2.6
    Serial port COM4
    Connecting....
    Chip is ESP8266EX
    Features: WiFi
    MAC: a0:20:a6:1b:28:96
    Uploading stub...
    Running stub...
    Stub running...
    Configuring flash size...
    Auto-detected Flash size: 4MB
    Compressed 290176 bytes to 209656...

    Writing at 0x00000000... (7 %)
    Writing at 0x00004000... (15 %)
    Writing at 0x00008000... (23 %)
    Writing at 0x0000c000... (30 %)
    Writing at 0x00010000... (38 %)
    Writing at 0x00014000... (46 %)
    Writing at 0x00018000... (53 %)
    Writing at 0x0001c000... (61 %)
    Writing at 0x00020000... (69 %)
    Writing at 0x00024000... (76 %)
    Writing at 0x00028000... (84 %)
    Writing at 0x0002c000... (92 %)
    Writing at 0x00030000... (100 %)
    Wrote 290176 bytes (209656 compressed) at 0x00000000 in 18.6 seconds (effective 124.8 kbit/s)...
    Hash of data verified.

    Leaving...
    Hard resetting via RTS pin...
    what is the meaning of

    Leaving...
    Hard resetting via RTS pin...

    Develo
    @devyte
    @eliffakgunn wrong place to ask, this is the nodemcu lua channel
    KT819GM
    @KT819GM
    Hello, can anyone recommend correct way to store RTC memory into file and reloading it after restart. Point is to use that memory as settings storage making every register as config bucket. Have no luck of using spiffs for that purpose (change variables / values on the fly)
    Terry Ellison
    @TerryE
    you need to use the rtcmem module and struct to pack your state into the memory block. Read the documentation. Use SPIFFS for low volatility config data. I just use sjson to pack/unpack it and file.putcontents() and file.getcontents()to save/ restore. RTCmem is best for high volatility state data that you want to persist from boot to boot, but remember it gets trashed if you have a total powerfail.
    KT819GM
    @KT819GM
    Thank you Terry for taking your valuable time to answer me. I will dig into sjson and file.*contents(). Regarding trash in rtcmem after power failure - maybe will just fill them after every restart with FF and reload with contents (if needed) saved on spiffs.
    matrixbot
    @matrixbot
    ildar greetings! want to raise a little flame. You are warned )))
    API question: there are quite many platforms working with hardware directly (mainly targeting MCU): Arduino, Espruino, libopencm3, mPython, NodeMCU (in alphabetical order) and more. I think it really makes sense to have similar APIs instead inventing own.
    We have different APIs for 8266 and 32. They must come to one API. Is it worth going closer to neighbor friends or not? just asking ))
    Terry Ellison
    @TerryE
    Are you volunteering to do all of the leg work?
    Evolution doesn't work top down
    We do intend to converge the two ESP architectures when we can resource it
    matrixbot
    @matrixbot
    ildar Hi, Terry,
    no, I'm not volunteering to do ALL of the leg work, sorry. Yet I believe that this work may be done (more or less) gradually, like in https://github.com/nodemcu/nodemcu-firmware/issues/1657#issuecomment-520635406
    ildar so WHEN this to be done, what pattern is to be used?
    This is generally the topic of my question
    Patrick Dorion
    @poorandunlucky
    I have a function that I wrote that converts BCD to decimal, and while it works in a console running Lua 5.1.5, it fails on the board... It's a arithmetic comparison, and it's probably me who's too tired as usual, or who doesn't know a peculiarity, but it says 9 > 9 = true... Like if I paste the file in a console running Lua 5.1.5, it runs OK; if I paste it in a terminal to my ESP12-E, the error gets triggered. Link: https://gist.github.com/poorandunlucky/7f0e29cf694ed37bb9e569752412ac09
    Terry Ellison
    @TerryE
    Patrick, why do you do that bizarre way?
    Terry Ellison
    @TerryE
    Is this an academic exercise? You just wouldn't do it that way om an IoT IMO
    Terry Ellison
    @TerryE
    You just use the language features to KISS, for example a BCD encode could be something like:
    ('%08u'):format(m):gsub('..', function (s) local h,l=s:byte(1,2) return string.char(h*16+l) end)
    The decode is a similar one-liner
    Terry Ellison
    @TerryE
    Oops forgot to offset by char '0', but that's only a tweak.
    JomoPipi
    @JomoPipi
    Is this is a general nodemcu channel?
    JomoPipi
    @JomoPipi
    I'm embarking on a pretty cool/big project that can go many ways. Might just make multiple versions. For now I have in mind a beat pad, or a step-sequencer. Basically a "musical" device. You can see a simple step sequencer I've made with arduino, here: https://www.youtube.com/watch?v=jX2tDVLKqYk.
    I HATE soldiering for the life of me, so this time I'll use a nodemcu and put all the buttons on a website so I can just control it with my phone. It will be interesting to see how much of the "work" I can shift from the nodemcu to my phone/browser. Here's what I got so far: https://www.youtube.com/watch?v=kd7N9Ya4rzc
    Has anyone done anything similar and what are your insights on it?
    Patrick Dorion
    @poorandunlucky
    @TerryE No, it's not academic; I can't really go to school (long story, but not money)... The reason I do it like that is because that's how I understand things, I'm a fundamentalist as a person, and I believe procedural in my programming style... When I first started I needed a CGI script, and I was coding it in C, but I realized after a little while that the library I was writing was actually PHP, and so I moved over to that, and I am not sure how my programming looks to you, but it's just the way it comes out... I prefer writing my own functions, I don't readily trust external code, and I don't have to worry about licensing, or rights if it ever becomes useful, and I don't have to feel like I owe anyone anything, either... There's also that I still don't understand how to manipulate binary in Lua, it's still a pretty new language to me...
    JomoPipi
    @JomoPipi
    @poorandunlucky I feel that making stuff from 'scratch' is usually a great way to learn :)

    btw:

    Which is faster?
    A. if (x >> 14 > 0) {}
    B. if (x > 16384) {}

    and
    I heard that Strings suck.
    Is there a way I can avoid using it (in a way that makes sense, performance-wise), here?

    String s = "";
    int i, n;
    for(i=0; i<lenght; i++) {
        s += (char)payload[i];
    }
    n = s.toInt();

    (using Arduino language)

    JomoPipi
    @JomoPipi
    ahh... I should've also mentioned that payload is a uint8_t *
    and it will eventually have more data in it, seperated by a : or something.
    Develo
    @devyte
    @JomoPipi wrong channel, this is for Lua nodemcu
    JomoPipi
    @JomoPipi
    thank you, sorry for the random noise
    Terry Ellison
    @TerryE

    @poorandunlucky Patrick, I know perhaps 2 dozen languages and assembler variants, but have only used half of these professionally. In my view one of the essentials of coming to new language is to ask yourself

    • In what ways is this language similar to other languages that you know.
    • What is the essence of why this language is different, and understanding this unique elements is key to truly adapting to your coding to use the language well.

    It is a mistake to attempt write in language Y as if it were language X, simply because you happened to learn language Y first.

    In this case I feel that your gist is very C-like and isn't using the natural features of Lua -- or any dynamically typed language with rich text manipulation features, such as Lua, Javascript, PHP or Perl. I find your example which is some 150 lines long hard to follow; it will also take up a lot of ESP resources and run slowly.
    Terry Ellison
    @TerryE
    My point is that if you use a more natural Lua style then you could achieve the same functionality in ½ dozen lines of code -- and code that would take less resources and run faster. BCD takes a decimal string so the easiest way to do this encoding is (i) to convert the number to a decimal string, and (ii) encode the string.
    So local 'd=string.format('%08u',n)` will convert a number to a [0-9]* string.
    d=('%08u'):format(n) is just another way of saying this.
    bcdn = d:gsub('..', someF) will chop a string into two byte chunks and pass them to someF and then substitute the returned value.
    Terry Ellison
    @TerryE
    So function F(s) local n0,h,l = 48,s:byte(1,2) return string.char(((h-n0)*16+l-n0) end) will generate your bcd