Avatar for Nadnerb

Nadnerb

Member since Nov 2018 • Last active Apr 2019
  • 4 conversations
  • 16 comments

Most recent activity

  • in Interfacing
    Avatar for Nadnerb

    Thanks.

    I actually did this today, using bin2c.exe to convert the binary data to a .h file which I included in Espruino/targets/nrf5x, then using a jsWrapper to return the address of that array from the .h file.
    It seems to work pretty well. Now I can create a loop in my javascript to retrieve that data and I can re-flash that data using the nRF toolbox app in DFU mode.

  • in Interfacing
    Avatar for Nadnerb

    The problem with this approach is that the data is a 30kB hex file, its not something I can easily type into the console on the Web IDE. However I think I may have found a solution, by uploading this data with the firmware hex file I could write it to the Espruino's flash directly.

    I can then use the nRF toolbox app to write this modified firmware to the nRF chip.

  • in Interfacing
    Avatar for Nadnerb

    I would like to be able to send files over bluetooth to the RAK8211 board. This board uses the nRF52, so it should be possible to send data over bluetooth to it.
    I cant seem to see anything out of the box that would allow for bluetooth file transfer.
    I noticed that Espruino's filesystem library works with SD cards, and one of the arguments is a source path.

    Would it be possible to use a bluetooth address as the source path instead of the SD card directory?
    I realise this may require 'hacking' espruino codebase to be able to do what I need to do.

    Alternatively there is the nRF connect app which is used to access the device and upload firmware to it. We are currently using the nRF toolbox to flash the firmware to the device. I suspect there could be some way to upload files using the same interface.

    Do you have any ideas how I could do this?

  • in General
    Avatar for Nadnerb

    I'm currently using the "JS & CSS Minifier" extension on VSCode. It works excellently, minimizes to ES6 and I've had no issues so far.
    https://github.com/olback/es6-css-minify­

    Thanks for clarifying how the modules as functions behaves, that makes sense to me now.

  • in General
    Avatar for Nadnerb

    I just tested it with minification off and that seems to be correct. with all minification off it works. (with or without modules as functions enabled).

    I would rather not share the code I'm uploading, aside from being over 2000 lines, it will be used for a proof of concept and includes some proprietary information that I'd have to remove before uploading. Sorry. I know its easier to help when you have the full code.

    As for the minification settings: Its working fine using "Simple Optimizations", as long as "modules as functions" is not checked.
    If it is checked then I need to use "No minification".
    Using "Simple optimizations" or "Whitespace Only" results in the $jscomp error above.

    But I'm not using the functionality from "modules as functions", so it can remain unchecked for my project.

    So it seems that $jscomp is inserted when transpiling ES6 -> ES5.
    That makes sense because I am using ES6 code, making use of the arrow notation which seems to be transpiled to ES5 in the Closure Compiler.

    Just as an experiment, I have used an ES6 aware minifier, which doesn't transpile the arrow notations. This has worked and has produced code smaller than the closure compiler minifier. (4900 vs 4600 bytes).

  • in General
    Avatar for Nadnerb

    I figured out the issue.
    Modules as functions cant be ticked. If its unticked it works fine, if it doesnt, then it comes up with an error regarding $jscomp.initSymbol or $jscomp.makeIterator.

    If I use closure compiler to minify my code, these variables are not part of the code, which confused me, but when I did a dump() I could see that these variables were in the code that was uploaded, and were causing problems. Since unchecking the modules as functions box its stopped producing the error and allows my code to execute.

    According to the webIDE this function is still in BETA, so I'm not sure if this feedback will be useful in order to fix it for upcoming releases.

  • in General
    Avatar for Nadnerb

    The same thing:

    Uncaught ReferenceError: "$jscomp" is not defined
     at line 1 col 150
    ...(var $jscomp$iter$0=$jscomp.makeIterator(data­),$jscomp$key$x...
                                  ^
    in function called from system
    

    But when I use it as code inside the build - as in I've rebuilt the .hex firmware file including the module in source code, it works.

  • in General
    Avatar for Nadnerb

    I am actually using the name without the file extension, sorry about writing it wrong in my post. [edited now]
    Even if that was the problem, it would give me an error saying it failed to load it. This loads it but then crashes on execution.

    I also run it without minification until I'm done w/development. I was developing this particular module months ago in the sandbox, and thought I was done and minified it and added it to the build. (the file in question is a board file, specifying the lower level AT commands of a custom board).

    However, I need to update the file, so I am going back to tweak it, but the sandbox version no longer works because of some error. Even without the minification, I'm still getting an error which looks similar to what closure compiler would give. (I've noticed $jscomp is a variable in the closure compiler, so I shouldn't expect to see this if my code isn't minified.)

Actions