Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    eliffakgunn
    @eliffakgunn

    @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
    How tersely you lay this all out is a matter of style. The inverse operation is equally brief.
    Patrick Dorion
    @poorandunlucky
    @TerryE Thanks. Also, I'm having a problem where Make updates app/include/buildinfo.h with the script at tools/update-buildinfo.sh, particularly the variable BUILDINFO_RELEASE_DTS that seems to be set from a git subcommand, and if your last commit is GPG-signed, that output is multi-line, and the lines aren't backslash-continued, so it generates an error. Should I submit a issue.. ?
    Terry Ellison
    @TerryE
    Yes
    Gregor Hartmann
    @HHHartmann
    @poorandunlucky I will have a look if you can provide a repo which i can check out and see the problem.
    Patrick Dorion
    @poorandunlucky
    @HHHartmann I just wanted to let you know I'd seen this, and will let you know when I've done that..
    KT819GM
    @KT819GM
    Good day everyone. Silly question as always, but ... Documentation is served on github and only way to fix small mistakes is forking project, editing and submitting changes for commit?
    Marcel Stör
    @marcelstoer
    @KT819GM There's a "Edit on GitHub" link top-right on every page that should make this a one-click stop - at least in theory. Sometimes the documentation tool generates broken links and you have to remember to edit things on the dev branch (rather than master).
    KT819GM
    @KT819GM
    Yes, I saw and used that button which leads to fork and so on. Anyway, will use issue report rather than editing by myself to avoid any mistakes. t.y.
    KT819GM
    @KT819GM
    ah, seems I understood it wrong. Will recheck and will use it. On 'dev'.
    Aggeloz
    @Aggeloz
    Hello... I want to upload the jquery lib inside the SPIFFS of my nodemcu but my compiller says that i only have 64kb of memory... How do i unlock the rest of the memory cause i know that the chip has either 1MB or 4MB of memory
    KT819GM
    @KT819GM
    How did you made your firmware?
    chathurangawijetunge
    @chathurangawijetunge
    Does any one let me know how to add HTML files to LFS.img
    Terry Ellison
    @TerryE

    @chathurangawijetunge, you should generalise this Q and consider HTML as a special case: when is it appropriate to store resources in LFS and when the alternatives are a better fit. Lua as a language can only support numeric, boolean and string constants in code; anything more complicated: array, function closures, have to be constructed at runtime. LFS stores Lua code so it can only support the former. It makes sense storing resources as string in LFS code if you need fast access paths, but there is a cost in readability and maintainability. So sometimes the alternatives can be better such as:

      return file.getcontents('someresource.dat')  -- or even
      return sjson.decode(file.getcontents('someresource.dat'))

    Also remember than in terms of storing HTML, then it is well worth separating the true constant stuff: CSS JS and even some HTML furniture is constant files which you can run through gzip on the host and store the compressed form as file or even string resource-s on the ESP. Just use the Content-encoding: gzip response to that the browser knows to unpack it. This is good example of where leaving the compressed resource as a file is just so much easier.

    When it comes to storing complex resources in strings:

    • Consider preprocessing the resources host-side and using a small bash/Python/Lua script to generate the file automatically from the bare resources.
    • You can use the %q format specifier to ensure than any such resource can be embedded in compilable format into the intermediate source format, but
    • You might find that base64 encoding is just so much more readable: return encoder.fromBase64[[...]]
    Terry Ellison
    @TerryE
    Also remember that another great advantage of HTML is that you can use cross-site URIs so there is absolutely no reason to serve all of your URI resources from the ESP. Even if you don't have your own public accessible web server, you can trivially obtain a free web service to host content and this can include CSS, HTML and JS resources, so that your script can just as easily reference such resources from your web content service, rather than attempting to host them on your IoT device.