natevw / sdcard

Tessel library for the SD card module.
Other
11 stars 2 forks source link

Part of image is missing while saving to sdcard #21

Closed brankosekulic closed 9 years ago

brankosekulic commented 9 years ago

This is probably caused by switching to new version of fatfs:

version 0.8.6

picture-1426373149481

version 0.8.5 picture-1426374203318

brankosekulic commented 9 years ago

This is also the case with any other file type

johnnyman727 commented 9 years ago

@natevw may be able to help out here.

natevw commented 9 years ago

Oy, this doesn't seem good. Have you been able to debug any further @brankosekulic and/or made sure it's not just a bad card?

I wonder if this reliably happens whenever you write a certain file size (regardless of content) or just something that happens from time to time but usually is okay? It's interesting that (unless Github did some of its own processing to your attachement) that it's not cut off exactly at a 512-byte boundary or anything like that.

brankosekulic commented 9 years ago

@natevw card is good, it saves whole file with version 8.0.5

It always happens with each file size and type.

natevw commented 9 years ago

I am able to reproduce this by putting your good image above into a folder with test project and using this script to copy to card:

var tessel = require('tessel'),
    builtin_fs = require('fs'),
    sdlib = require("./");

builtin_fs.readFile("./sdcard-issues-21-complete.jpg", function (e,d) {
  if (e) throw e;
  else console.log("Opened file", d.length, "bytes");

  sdlib.use(tessel.port['A'], {getFilesystems:true}, function (e,arr) {
      if (e) throw e;
      else card_fs = arr[0];
      console.log("Got filesystem.");
      card_fs.writeFile("sdcard-issues-21-copy_"+Date.now()+".jpg", d, function (e) {
          if (e) throw e;
          else console.log("Wrote file.");
      });
  });
});
natevw commented 9 years ago

This is due to https://github.com/tessel/runtime/issues/721

natevw commented 9 years ago

…and https://github.com/tessel/runtime/issues/722

natevw commented 9 years ago

I've worked around the runtime/firmware issues and with sdcard@0.8.7 I am able to save files over 4KB again.