IDE testing plugin- boolean problem

Posted on
  • Hi All, I started using testing plugin in the IDE. I found an issue with boolean value setting. It could be my very basic knowledge of JS but here it is.
    I am trying to change the value of a boolean variable with a button from the testing plugin. This is the code:

    var my_bool = true;
    var bool_test = function(){
      if (my_bool) console.log("true");
      else console.log("false");
    setInterval(bool_test, 1000);

    then I run the program and test. After toggling the test button, my_bool variable is still true. Same code works fine with numeric values.

    1 Attachment

    • Screenshot 2020-12-15 at 14.06.19.png
  • @kri100s

    indeed, something with boolean is off...

    You see the workaround: make Commands for setting and clearing (not the most elegant, but it works).

    Furthermore, notice:

    • 1. To display the state of a boolean I convert them to a number that is in the range of the other ones... then I see a continuous graph line about the status - in this case: value 2 is true for on variable, 1 represents false
    • 2. You can switch back to console and you see what the Espruino board returns every second. Unfortunately, you cannot see what the Testing/Monitor is sending to the Espruino board. For that you would have to look into the JS Testing plug-in code and change it.

    When you take a look at the plug-in code, you may figure what is wrong with the boolean. Looks to me good what you do and I suspect as well something is broken for setting a boolean variable. -­DE/blob/master/js/plugins/testing.js#L62­

    3 Attachments

    • espMonCmdSetFalse.png
    • espMonCmdSetBoo.png
    • espMonCmdSetBooLog.png
  • Thanks @allObjects for looking into it. Its not a big deal for me since I can just use number instead like you suggested. I wanted to know if its a real issue or just my poor js knowledge. It would be good to let know to whoever is maintaining the plugin. I bet there is an easy fix for it.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

IDE testing plugin- boolean problem

Posted by Avatar for kri100s @kri100s