Avatar for KevinAst

KevinAst

Member since Oct 2018 • Last active Nov 2018
  • 2 conversations
  • 10 comments

Most recent activity

  • in General
    Avatar for KevinAst

    Hi Gordon,

    I am helping AJ on this issue, and you are correct that he attached the wrong log file. He sent you the output of an "npm audit". I have attached the output of the npm install command.

    Thanks for your help.

    Kevin

  • in Interfacing
    Avatar for KevinAst

    @Gordon,

    I upgraded to espruino@0.1.15 and it appears to now support windows-based cr/lf.

    Thanks!

    BTW: Do you maintain any revision history for the espruino package releases?

  • in Interfacing
    Avatar for KevinAst

    Thanks for the info @Gordon.

    I had suspected windows cr/lf was the culprit, but was unfamiliar with all the special processing done by espruino.

    The difference in my new process is it is being checked into a git repository, and I think git is attempting some "neutral" representation of cr/lf. I can research some git settings.

    With that said, however I believe all my production code will be contained inside function definitions, so I should be OK.

    Thanks for your help and insight.

    Kevin

  • in Interfacing
    Avatar for KevinAst

    @Gordon: Thanks for you quick reply. I was out-of-the-office for a bit, hence this delayed response.

    Per you request, I updated the espruino package to ver 0.1.14, and experienced mixed results.

    • GREAT: I can now require more than one module. Previously a rogue "d" was prefixed to the "Modules" reference generating the following run-time error. However this has been fixed with the 0.1.14 release ... I no longer receive this error:

      Uncaught ReferenceError: "dModules" is not defined
      at line 1 col 10
      dModules.addCached("TestMod3","print('ex­panding TestMod3.js...
    
    • PROBLEM: I still am not able to place an else clause on a second line when the code is expended in-line. Here is the run-time error:

      Uncaught SyntaxError: Got else expected EOF
       at line 2 col 1
      else {
      ^
    

    My full code can be found here:

    Here are some points of interest and/or questions:

    1. Why is it that I do not experience this problem with the IDE? I was under the impression that this was the same code.

    2. It appears to me that the "else on a subsequent line" is only a problem for code expanded in-line. I do not experience this issue when the code is contained in a function definition.

    Does this make sense?

    I can work around this issue by placing my in-line code in an IIFE:

       (function () {
         ... my in-line code here
       })();
    

    Evidently espruino does not have to do anything special in regard to cr/lf for code contained with function definitions.

    Would it make sense for espruino to wrap any code it is sending to the board in an IIFE, rather that attempting to identify/react to special cases like this?

    Your help is greatly appreciated.

    Kevin>

  • in Interfacing
    Avatar for KevinAst

    Hello,

    I have just installed the espruino NPM package, and is "partially" working.

    My vital signs are:

    Host Machine
      - Windows 10
      - Node:   8.11.3
      - NPM:    5.6.0
      - Espruino NPM package: 0.1.13
    MCU
      - Espruino WiFi
      - Version:  1v99
    

    I can successfully connect to my Espruino WiFi board, and execute the MCU remotely via the espruino NPM CLI.

    However, I am experiencing a number of very weird run-time errors, when sending code to the board using the espruino NPM package. Things like:

    • Cannot place an "else" clause (of an if/then/else) on a second line. The following run-time error is encountered ONLY when the code is in-line (i.e. the error is not experienced when the code is within a function).

      Uncaught SyntaxError: Got else expected EOF
       at line 2 col 1
      else {
      ^
    
    • Cannot "require" more than one module. When the second module is included, I receive the following run-time error:

      Uncaught ReferenceError: "dModules" is not defined
      at line 1 col 10
      dModules.addCached("TestMod3","print('ex­panding TestMod3.js...
    

    All this code runs correctly, when it is sent via the Espruino IDE. I only have these problems when sending the code using the Espruino NPM package.

    Obviously, something very rudimentary is out-of-whack.

    By enabling verbose output, I have determined that the issue is something related to escape sequences sent to the board, however I do not know how to resolve.

    Sending the following code snippet:

    var x = 1;
    if (x===1) {
      x++;
    }
    else { // CRAZY: can't be on a seperate line (when code is in-line)
      x--;
    }
    

    Sends the following stream:

    Sending...
    ---> "\u0010reset();\n\u0010var x = 1;\n\u0010\u001b[4dif (x===1) {\r\u001b\n  x++;\r\u001b\n}\r\u001b\nelse { // CRAZY: can't be on a seperate line (when code is in-line)\r\u001b\n  x--;\r\u001b\n}\n\u0010\u001b[60dsave()\­n\n"
    

    Generating the following run-time error:

    :else { // CRAZY: can't be on a seperate line (when code is in-line)
    :
    :  x--;
    :
    :}
    Uncaught SyntaxError: Got else expected EOF
     at line 2 col 1
    else { // CRAZY: can't be on a seperate line (when code is i...
    ^
    

    Again, the issue has something to do with the escape sequences, but I do not know how to resolve.

    Your help is greatly appreciated in resolving this issue.

    Kevin

  • in JavaScript
    Avatar for KevinAst

    Thanks @Gordon ... I very much appreciate your insight!

  • in JavaScript
    Avatar for KevinAst

    Hello @Gordon. I am currently not a patreon, other than the purchase of a couple of your Espruino WiFi boards. I am currently in a "discovery" phase ... determining whether espruino will meet our needs. Actually, I am working on my Son's behalf (as I am retired) ... he has the MCU experience, I am the JS expert :-) Is your time (and/or response) typically limited to patreons?

    Thanks for explaining what is going on.

    Background: I am researching a technique by which I can isolate my MCU logic from the hardware it is running on. This is accomplished by defining a "binding" structure that bridges the gap between hardware/logic. As a result, I heavily rely on modules. The entire MCU logic is found in a module, and the driving code (in the editor window) is a very small snippet that defines and passes the hardware "binding" structure to the logic module's start() function. This supports many sets of hardware by creating small mainlines (again in the editor window), that vary only in the hardware binding definition.

    As a result, I'm not sure how I feel about disabling module minification. I would assume this is pretty important with the MCU's limited resources (as well as proprietary obfuscation) . With that said, I see in the IDE settings that "by default" no minification occurs in the main code, so my "resource" concern may be unfounded. Thoughts?

    In looking at the minification options, I see that you have two options (Esprima and Closure). Have you considered babel? ... this may be a loaded question.

    I am considering researching/using your espruino npm package for deployment, and bypassing the IDE. Any thoughts on this?

    • does it have the same options (and/or limitations) of deployment through the IDE?

    Your assistance is greatly appreciated.

    Kevin

  • in JavaScript
    Avatar for KevinAst

    Thanks @Robin.

    Yes I will most likely be using github eventually ... right now I am in a "sandbox" mode.

    This would be rather odd if a remote deployment solved the "false error" coming out of the IDE. At best, this would be a "hack".

    Curious as to what the real problem is.

    Thanks for the link!

Actions