Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    uDude
    @uDude
    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.

    uDude
    @uDude
    @tjakober I went further back in the chat history and see that my answer above does not answer your question.
    uDude
    @uDude

    Yeouch. I was just looking at 'smartconfig.' Man is it ugly for security, even using AES. In the situation where you are a company and you have pre-provisioned your devices with specific AES keys to deliver to the public customer, those keys live on the device. We all know how to dump the storage, find the programs, perform disassembly or whatever is needed to find the keys. Now after they are publicly shared some war driver can capture your packets (or your neighbor can do the same) and your network is passphrase is known. Even without capturing the AES key, an attacker can drop a device with battery to capture the info of the target. The device can then get on the network transmit its passphrase to "destination hosts somewhere belonging to 'chchchoo' (sorry had to sneeze) the attacker." The device erases itself to avoid detection or maybe reconfigures itself for some rapid or stealthy recon. It could just alter the key to send you on a fools errand when doing your response effort to figure out what someone did. Basically smartconfig will unwittingly put the networks of your customers at risk -- or your personal network if you use it yourself.

    No matter what, good security practices indicate that you should pay attention to what hosts are on your network -- or use good provisioning techniques that meet your risk threshold for your Intellectual Property (which may or may not include smartconfig). I don't use it.

    Marcel Stör
    @marcelstoer
    uDude
    @uDude
    Saw that and was pleased :). Generally, the only thing I wish for this project is that we could pay someone (or more) full time to port it to a handful of other MCUs (e.g., STM). I'm personally quite ill which is why I'm so spotty on the chat.
    uDude
    @uDude
    All -- I have a question. The blocksize of the flash HW write is 4KB ???
    uDude
    @uDude
    I see it in the docs -- I just didn't dig through spiffs code to see if it matches. If it is 4KB then I have question about "app/lua/lflash.c has #define WRITE_BLOCKSIZE 2048. Now is it set to 2KB for memory issues? Each time the 2KB write happens the esp should read the full block, update it, then write it. So writing with 2KB means double the reads and double the writes for each write. Correct?? I know this routine should rarely be used but I'm just curious about the reason for 2KB rather than 4KB.
    KT819GM
    @KT819GM
    isn’t lflash.c lfs part? if so it’s read only on spiffs?
    uDude
    @uDude
    @KT819GM -- yes it the code is part of lfspart, and it modifies the partition table on disk; hence my curiosity.
    Thomas Jakober
    @tjakober

    The Makefile definitely does not work on wsl. I made now a VM with Ubuntu and there it will compile to some extent. However also there I have a missing file:
    In file included from /home/thomas/nodemcu-firmware-esp32/components/luac_cross/../lua/lua.h:18:0,
    from /home/thomas/nodemcu-firmware-esp32/components/luac_cross/../base_nodemcu/linit.c:12:
    /home/thomas/nodemcu-firmware-esp32/components/luac_cross/../lua/luaconf.h:305:10: fatal error: readline/readline.h: No such file or directory

    include <readline/readline.h>

          ^~~~~~~~~~~~~~~~~~~~~

    compilation terminated.

    Gregor Hartmann
    @HHHartmann
    You are missing a package. Judging from
    libreadline-dev. There might be more.
    Thomas Jakober
    @tjakober
    this did the job. Thanks alot
    Gregor Hartmann
    @HHHartmann
    Glad i could help
    Terry Ellison
    @TerryE
    @uDude, there isn't a flash write block size, per se. There is a block erase quanta of 4 Kb, but writes are a multiple of aligned words and use NAND write rules.
    See Wikipedia article on this. In fact the smallest write we do is 1 bit.
    Terry Ellison
    @TerryE
    There is an overhead with writing, as the ICache is disabled by the SDK during the flash write and hence write to flash has a per record overhead. The block size is somewhat arbitrary, and is as compromise between reducing the per write overheads and RAM needed.
    Thomas Jakober
    @tjakober
    I am struggling with the new ESP32 time module. When I set the timezone to EST I get one hout less than it is actually. When I set it to UTC+1 which should be equivalent to EST, I get two hours less. Only when I set it to UTC-1 I get the correct time. I am in Switzerland and we currently do not have DST. What I am thinking wrong?