예제 #1
0
bool CardReader::selectFile(const char* filename, bool silent/*=false*/) {
  const char *oldP = filename;

  if(!cardOK) return false;

  file.close();

  if (!file.exists("restart.gcode")) {
    file.createContiguous(&workDir, "restart.gcode", 1);
    file.close();
  }

  if (file.open(curDir, filename, O_READ)) {
    if ((oldP = strrchr(filename, '/')) != NULL)
      oldP++;
    else
      oldP = filename;
    if(!silent) {
      ECHO_MT(SERIAL_SD_FILE_OPENED, oldP);
      ECHO_EMV(SERIAL_SD_SIZE, file.fileSize());
    }

    for (int c = 0; c < sizeof(fullName); c++)
  		const_cast<char&>(fullName[c]) = '\0';
    strncpy(fullName, filename, strlen(filename));

    #if ENABLED(JSON_OUTPUT)
      parsejson(file);
    #endif
    sdpos = 0;
    fileSize = file.fileSize();
    ECHO_EM(SERIAL_SD_FILE_SELECTED);
    return true;
  }
  else {
    if(!silent) ECHO_EMT(SERIAL_SD_OPEN_FILE_FAIL, oldP);
    return false;
  }
}
예제 #2
0
 void Stopwatch::debug(const char func[]) {
   if (DEBUGGING(INFO)) {
     ECHO_MT("Stopwatch::", func);
     ECHO_EM("()");
   }
 }