M30/M31 fast sd block transfer
This commit is contained in:
parent
d196068a8c
commit
fa1a0e7def
1 changed files with 21 additions and 21 deletions
|
|
@ -225,7 +225,7 @@ unsigned long stepper_inactive_time = 0;
|
||||||
|
|
||||||
if(pstr == NULL)
|
if(pstr == NULL)
|
||||||
{
|
{
|
||||||
SerialMgr.cur()->println("invalid command");
|
Serial.println("invalid command");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,24 +234,24 @@ unsigned long stepper_inactive_time = 0;
|
||||||
//check mode (currently only RAW is supported
|
//check mode (currently only RAW is supported
|
||||||
if(strcmp(strchr_pointer+4, "RAW") != 0)
|
if(strcmp(strchr_pointer+4, "RAW") != 0)
|
||||||
{
|
{
|
||||||
SerialMgr.cur()->println("Invalid transfer codec");
|
Serial.println("Invalid transfer codec");
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
SerialMgr.cur()->print("Selected codec: ");
|
Serial.print("Selected codec: ");
|
||||||
SerialMgr.cur()->println(strchr_pointer+4);
|
Serial.println(strchr_pointer+4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file.open(&root, pstr+1, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))
|
if (!file.open(&root, pstr+1, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))
|
||||||
{
|
{
|
||||||
SerialMgr.cur()->print("open failed, File: ");
|
Serial.print("open failed, File: ");
|
||||||
SerialMgr.cur()->print(pstr+1);
|
Serial.print(pstr+1);
|
||||||
SerialMgr.cur()->print(".");
|
Serial.print(".");
|
||||||
}else{
|
}else{
|
||||||
SerialMgr.cur()->print("Writing to file: ");
|
Serial.print("Writing to file: ");
|
||||||
SerialMgr.cur()->println(pstr+1);
|
Serial.println(pstr+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SerialMgr.cur()->println("ok");
|
Serial.println("ok");
|
||||||
|
|
||||||
//RAW transfer codec
|
//RAW transfer codec
|
||||||
//Host sends \0 then up to SD_FAST_XFER_CHUNK_SIZE then \0
|
//Host sends \0 then up to SD_FAST_XFER_CHUNK_SIZE then \0
|
||||||
|
|
@ -261,10 +261,10 @@ unsigned long stepper_inactive_time = 0;
|
||||||
//read SD_FAST_XFER_CHUNK_SIZE bytes (or until \0 is recieved)
|
//read SD_FAST_XFER_CHUNK_SIZE bytes (or until \0 is recieved)
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
while(!SerialMgr.cur()->available())
|
while(!Serial.available())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if(SerialMgr.cur()->peek() != 0)
|
if(Serial.peek() != 0)
|
||||||
{
|
{
|
||||||
//host has failed, this isn't a RAW chunk, it's an actual command
|
//host has failed, this isn't a RAW chunk, it's an actual command
|
||||||
file.sync();
|
file.sync();
|
||||||
|
|
@ -272,13 +272,13 @@ unsigned long stepper_inactive_time = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//clear the initial 0
|
//clear the initial 0
|
||||||
SerialMgr.cur()->read();
|
Serial.read();
|
||||||
for(int i=0;i<SD_FAST_XFER_CHUNK_SIZE+1;i++)
|
for(int i=0;i<SD_FAST_XFER_CHUNK_SIZE+1;i++)
|
||||||
{
|
{
|
||||||
while(!SerialMgr.cur()->available())
|
while(!Serial.available())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
lastxferchar = SerialMgr.cur()->read();
|
lastxferchar = Serial.read();
|
||||||
//buffer the data...
|
//buffer the data...
|
||||||
fastxferbuffer[i] = lastxferchar;
|
fastxferbuffer[i] = lastxferchar;
|
||||||
|
|
||||||
|
|
@ -292,11 +292,11 @@ unsigned long stepper_inactive_time = 0;
|
||||||
{
|
{
|
||||||
fastxferbuffer[SD_FAST_XFER_CHUNK_SIZE] = 0;
|
fastxferbuffer[SD_FAST_XFER_CHUNK_SIZE] = 0;
|
||||||
file.write(fastxferbuffer);
|
file.write(fastxferbuffer);
|
||||||
SerialMgr.cur()->println("ok");
|
Serial.println("ok");
|
||||||
}else{
|
}else{
|
||||||
SerialMgr.cur()->print("Wrote ");
|
Serial.print("Wrote ");
|
||||||
SerialMgr.cur()->print(xferbytes);
|
Serial.print(xferbytes);
|
||||||
SerialMgr.cur()->println(" bytes.");
|
Serial.println(" bytes.");
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -853,8 +853,8 @@ inline void process_commands()
|
||||||
fast_xfer();
|
fast_xfer();
|
||||||
break;
|
break;
|
||||||
case 31: //M31 - high speed xfer capabilities
|
case 31: //M31 - high speed xfer capabilities
|
||||||
SerialMgr.cur()->print("RAW:");
|
Serial.print("RAW:");
|
||||||
SerialMgr.cur()->println(SD_FAST_XFER_CHUNK_SIZE);
|
Serial.println(SD_FAST_XFER_CHUNK_SIZE);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 42: //M42 -Change pin status via gcode
|
case 42: //M42 -Change pin status via gcode
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue