Clear script from board if it becomes too large to download

Issue #88 new
Turgut Guneysu created an issue

Hi John,

This dummy program I created forces a “Script is too large to send to board” error. Ignore the the actual code, it is just filler with no meaning.

  • So when I first load it, I get that message. I try to run it and it will not run.
  • Then I remove the very last block. - I get the same message - I try to run and it runs !
  • Then I add the last removed block back - I get the same message - I try to run and it runs !
  • BUT it will not display the very last SAY !

So I believe, somehow microBlock is not able to load that last block on to the card. And it runs what was on the card before the last change.

To test that, if one splits the code at comment: SEPARATE HERE & RUN

  • Then the top part is small enough to fit and run. produces the last SAY message: “Reached here OK”
  • Then when the separated part is added back, one gets the “Script Large” message, BUT it is NOT LOADED.
  • Upon running, the last SAY is again the one that displays: “Reached here OK”.
  • SAY:”And out of the LOOP”, and SAY: “TEMP:” will not display, because that part of the program is NOT really loaded.

What puzzles me is that I have “FREE MEMORY” statements in each SAY and it is not varying that much or even reaching a very low level.

So my confusion is:

  • If for some reason there is a determined SIZE issue, then no matter what, that code should NOT RUN !
  • It is obviously possible to have a version of code on the board that is different than what one looks at on the screen (even if by just ONE statement ! ). And that is very confusing if one is not aware of the background on-goings.

I suggest that:

  • Some form of positive “Program Loaded” status be developed. A similar request was documented in ISSUE# 62.
  • A more clear and definite memory size display be provided, since it seems to be crucial metric.
  • Error messages that are displayed and are caused by a particular block, or at least are detected at a certain block, should also highlight or indicate that block. This will allow the user to determine where the fault is and in case of partial loads have an idea which part of the code is not in memory of the device in use.

These are my suggestions based on my experiences. They might not be possible or suitable to the actual design of the environment. Please take them as a wish-list and possibly provide a suitable solution that is more appropriate.

TG

Comments (3)

  1. John Maloney repo owner

    Thank for doing these careful experiments. There are definitely some issues with how things are handled when scripts are too large.

    FYI, the limit on scripts has nothing to do with the amount of memory reported by the “free memory” block. That block tells you how much RAM is available for lists and strings. The limited size of scripts stems from the need to fit an entire script into a fixed size buffer when transferring scripts from the IDE to the board. That buffer is separate from the RAM used for strings and lists so the amount of memory reported by “free memory” has no impact on the script size limit.

    I agree with these two points:

    If for some reason there is a determined SIZE issue, then no matter what, that code should NOT RUN !

    It is obviously possible to have a version of code on the board that is different than what one looks at on the screen (even if by just ONE statement ! ). And that is very confusing if one is not aware of the background on-goings.

    Will work on this.

  2. Turgut Guneysu reporter

    Some further info regarding size and program loading activities:

    I can definitely say that large programs take a while to update, even if minor changes are done to the code. The bad part is tha this delay is NOT very consistent. Sometimes it is very short, sometimes not, and definitely not always related to the changes one makes. I got the feeling, observing Console window displays, that hitting STOP causes synchs.

    One gets used to changing a number in a block, for example, and clicking the RUN icon. Then sometimes, one gets a strange error, such as, “needs a List or String” etc. Upon pressing STOP icon, waiting for the “All tasks stopped” message in the command window, and re-clicking the RUN, all is well.

    As you can see, this is definitely NOT what one would know to look for. I know it, and it is even hard for me to remember and wait for it.

    I am hoping you will find a way to provide an indicator for the dynamic program load feature. Maybe a green bar that advances upon completion of changes or whenever the program attempts to update the board. this is very critical with large codes. And by large I mean screen and a half full of code blocks. Because without an indicator, one is too quick to keep hitting either an individual block or the RUN to test, and sometimes fail.

    It’s for your consideration.

  3. Log in to comment