Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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.
    uDude
    @uDude
    I glanced at the nodemcu-partition.py script and noticed LFS0 and LFS1 defined. However I did not see an implementation that explicitly used it.
    My presumption is that I can ultimately read the partition table at runtime, and ostensibly switch between LFS partitions as needed (e.g., one is the latest loaded the other is a 'fall back' good partition sort of thing). Clearly anything can be done. Did I miss the implementation?
    uDude
    @uDude
    My vision on LFS0/LFS1 is build the partiton table at flash time, flash LFS to LFS0. Then at runtime Write a new LFS to LFS1, save a flag somewhere indicating LFS1 is "new" and LFS0 is "fallback". Vice-versa on next load. Update custom LFS routines to do the right thing then reboot.
    Thoughts?
    Terry Ellison
    @TerryE
    Switchable LFS partitions is way down the way in terms of roadmap. Don't hold your breath. I want to get 5.3 deployed then OTA.
    uDude
    @uDude
    Maybe I'll tinker with it anyway :) . (doubtful -- my brain no longer functions like it should very often)
    KT819GM
    @KT819GM
    Hello everyone, hope new year started well 🍺😊 as always I have a stupid question and some hope to get positive answer, so: is there a way to update string (let’s say json) in a file without overwriting whole contents or appending line at the file end? I know there is way to write from some starting byte, but maybe something better exist. Talking about file with Lua table and want to change specific sections only. Did not found it easier to work with json than with Lua tables sadly, or just maybe didn’t found examples understandable for me.
    seawave
    @dalgatatar
    hi
    someone use esp8266 and connect apm to mission planer?
    Terry Ellison
    @TerryE

    is there a way to update string (let’s say json) in a file without overwriting whole contents or appending line at the file end?

    Think about it: a structure encoded in JSON has a very strict grammar; even something as simple as replacing a string value with another 1 byte longer is going insert an extra byte in the middle of the encoded string, so there is no practical way to do this with file primitives. It's a lot easier just to rewrite the entire file with the new version, say by doing a file.putcontents() with the new encoded string. Work internally in RAM with Lua structures and only serialise them to SPIFFS if you want to keep a non-volatile copy to persist over restarts.

    KT819GM
    @KT819GM
    Can’t be more clear Terry. Thank you.
    KT819GM
    @KT819GM
    Anyone knows, if a fetchbot, maintainer of a ads1115 module uses gitter, or can tell a way to contact him. I see from my perspective small problem in that module (need to add delay after switching mux before reading value), would like to ask if he could implement it.
    Marcel Stör
    @marcelstoer
    @KT819GM if nothing else helps you can open an issue in the firmware project and tag him/her. Just add @fetchbot to the description.
    KT819GM
    @KT819GM
    Okay, will do feature request and will add @fetchbot into it :)
    Terry Ellison
    @TerryE
    @KT819GM BTW if I were using the ADS1115 my inclination would be to start with the datasheet and write my own Lua module around the std I²C library. Even if you are using the C library, I am not sure why you'd want any delay other than the conversion time as the low level driver handles slave acknowledgement. Delay conversion is 8 mSec in high precision mode and multi mSec delays are best handled through tmr alarms
    If I am missing something then it is best to explain the flaw in terms of deviations from the datasheet required timings.
    KT819GM
    @KT819GM
    Hello @TerryE. Datasheet is missing this part of information but there are same problems on google like: ads1115. I've just wanted to introduce delay, after switching multiplexer because if you have no delay you will get readings of previous channel (reading channel 1 but got old value from channel 0). But I will try to do pure Lua implementation using standard I2C because I need to have possibility to ignore any errors reading device, like you made with ds18b20. But now battling with myself prooving that I need json in my life :D
    KT819GM
    @KT819GM
    With C library I'm simply using tmr to delay readout after switch of the channel, but it does not look quite optimal for me, somehow still would like that library which I'm using would do it for me.
    Terry Ellison
    @TerryE
    How long a delay do you find works? The the tmr.delay() function just calls a ROM bootloader delay function, which isn't masked to ISRs and so can be used safely up to a few mSec, but I would suggest doing an alarm for much more than that. This isn't a time critical delay so a wobble of a mSec or 2 won't make any difference.
    You can call the delay function directly in C. See tmr.c for an example of how to do this.
    As to what is 'optimal', what are you yielding by optimising? Nothing. So it isn't really relevant is it?
    KT819GM
    @KT819GM
    Good morning. Terry, I apologise for being unspeciffic, because English knowledge makes me look like a kid in this type of discussions. I will try to be more speciffic next time to not to waste your and others time.
    I’m not using tmr.delay(), delay I meant in general - to put delay between doing tasks and for sure non-blocking, using tmrin this manner: tmr.create():alarm(10, tmr.ALARM_SINGLE, function(t_ads) adc1:startread(function(volt). Saying “not optimal” I meant that usually, when you have device library it should do these small tasks and you should be free of thining about “did I forgot to put delay between readouts”. I will do readings today using different timing and will return with results.
    Terry Ellison
    @TerryE
    No apologies needed. This is broadly the correct way to do this and wrapping up this complexity once in a small Lua module is the easiest implementation strategy IMO. The raw I²C command interface allows you to do things like start C1, start C2, delay, read C1, read C2 to minimise cross channel reading skew. IIRC, the C library doesn't facilitate this. But you seemed to be saying that you needed extra micro delays between addressing a next channel and issuing the start or one-shot read. I find it's a lot easiest to play around with this sort of timing in Lua since you can do this by tweaking Lua fragments rather than having to go through a make and reflash on each test.
    Thomas Jakober
    @tjakober
    hi, i am trying to compile the esp32 firmware on WSL. However the make command stucks with the following error:

    Uncompressing toolchain

    the archive contains ro files

    Setting IDF_PATH and re-invoking...
    /bin/sh: 1: Syntax error: "(" unexpected
    Makefile:21: recipe for target 'all' failed
    make: * [all] Error 2

    KT819GM
    @KT819GM
    hi, is this WSL1 or WSL2?
    Thomas Jakober
    @tjakober
    Good question. How do I find out? I recently set it up on windows 10 1909
    Thomas Jakober
    @tjakober
    It seems I have WSL1
    Gregor Hartmann
    @HHHartmann
    Could it be that your sources are quite old?
    Wer had this error fixed some time ago.
    Thomas Jakober
    @tjakober
    No, I just downloaded them. But what was the solution when you fixed it?
    Thomas Jakober
    @tjakober
    I tried to make the epp8266 and I get the same error. It seems to be a problem under wsl.
    PRUNE libmain.a libc.a
    /bin/sh: 1: Syntax error: "(" unexpected
    Makefile:334: recipe for target '/home/thomas/nodemcu-firmware/nodemcu-firmware/sdk/.pruned-3.0-e4434aa' failed
    make: * [/home/thomas/nodemcu-firmware/nodemcu-firmware/sdk/.pruned-3.0-e4434aa] Error 2
    make: Leaving directory '/home/thomas/nodemcu-firmware/nodemcu-firmware'
    Gregor Hartmann
    @HHHartmann
    Then please feel free to open an issue so it can be tracked properly
    uDude
    @uDude

    @tjakober What are your .h changes. I just used linux x64 w/o issue on default...

    git clone --recursive https://github.com/nodemcu/nodemcu-firmware
    cd nodemcu-firmware
    make -j8
    git show-ref | grep HEAD
    71a182caa7841cbb478ed90ede526dc881943c80 refs/remotes/origin/HEAD

    I showed the head ref, too just in case something was fixed before I posted.