• If I run this code on a cleaned up Bangle watch, it seems to throw a file too big error eventually and the file size reported is ~ 1Mb. Am I doing something wrong to not be able to write on beyond 1Mb ?

    (** BEWARE: starts with Storage.eraseAll() ** )

    function repro() {
      require("Storage").eraseAll();
      var file = require("Storage").open("testfile.log", "a");
      try
      {
        while (true){
          var sentence = "Long string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberish\n";
          file.write(sentence);
        }
      }
      catch(ex){
        console.log(ex);
        console.log("File size after write error: " + file.getLength());
        file = null;
      }
    }
    
    repro();
    
    
    >Error: Error: File too big!
    File size after write error: 1036320
    

    Following are my env details

    >process.env
    ={
      VERSION: "2v04.375",
      GIT_COMMIT: "9b362663",
      BOARD: "BANGLEJS",
      FLASH: 524288, SPIFLASH: 4194304, STORAGE: 4194304, RAM: 65536,
      SERIAL: "a0cf0da6-7b6c234d",
      CONSOLE: "Bluetooth",
      MODULES: "Flash,Storage,hea" ... "le,graphical_menu",
      EXPTR: 536883676 }
    > 
    

    My fork was last synced with upstream on March 1, so I am wee bit behind. Apologies if this is causing the issue.

    Update: Just to clarify, I was expecting the File write to error out after ~4Mb which is the max capacity of the BangleJS.

  • Thr 2020.03.05

    Observation: L6 infinite while()

    Do I need to say more?

    L8 is most likely queued up multiple times before the first write occurs and is allowed to finish, cleaning up file I/O overhead. Maybe try a callback strategy, rather than relying on an error detection scheme?

About

Avatar for Robin @Robin started