Welcome! Log In Create A New Profile

Advanced

Problems running RepRap Host.

Posted by alfalover 
Problems running RepRap Host.
June 24, 2011 01:08AM
Hello,

I just finished my Mendel , and I have problems to get it run, every time y try to print I receive next error and stops printing: y have enabled Comm Debug and debug...

ERROR: Error printing file: java.lang.NumberFormatException: For input string: "N79" [599.089s/6041ms]
java.lang.NumberFormatException: For input string: "N79"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:438)
at java.lang.Long.parseLong(Long.java:478)
at org.reprap.comms.GCodeReaderAndWriter.waitForResponse(Unknown Source)
at org.reprap.comms.GCodeReaderAndWriter.bufferQueue(Unknown Source)
at org.reprap.comms.GCodeReaderAndWriter.access$100(Unknown Source)
at org.reprap.comms.GCodeReaderAndWriter$1.run(Unknown Source)
comms: G-code: N80 G28 *11 dequeued and sent [643.158s/44069ms]

Gen 7 1.2 Board, with teacup firmware, and mendel parts hot end.

With XYZ and Extruder z I am able to test the machine.


Thanks for any hint in advance.
Re: Problems running RepRap Host.
June 29, 2011 01:36AM
Quote

ERROR: Error printing file: java.lang.NumberFormatException: For input string: "N79" [599.089s/6041ms]

Could you post line N78 ... N80 of this G-code file? Looks like Host doesn't like something in line N79.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Problems running RepRap Host.
July 08, 2011 08:41PM
I've only just downloaded the code and started playing with....

But looking at the code this isn't a problem with the gcode file.
The method waitForResponse is actually processing a response from the printer.
It basically reads character data coming back from the printer until it sees an end of line character.
It then pulls the response line apart.

In particualer the line in question is where the printer has issued an 'rs' which is a resend request.

Not having looked at the firmware I don't know why it would do this.

Anyway the host application is is looking for a number after the 'rs' command.
I'm guessing that the rs command looks like:

rs N79

However the code passes the full N79 to the parseLong call which causes the Exception.

The following 'UNTESTED" patched version of waitForResponse should fix the problem.

Brett

/**
* Parse the string sent back from the RepRap machine.
*
*/
private long waitForResponse()
{
int i;
String resp = "";
long result = allSentOK;
String lns;
resetReceived();
boolean goAgain;
Date timer = new Date();
long startWait = timer.getTime();
long timeNow;
long increment = 2000;
long longWait = 10*60*1000; // 10 mins...

for(;winking smiley
{
timeNow = timer.getTime() - startWait;
if(timeNow > increment)
{
Debug.d("GCodeReaderAndWriter().waitForResponse(): waited for " + timeNow/1000 + " seconds.");
increment = 2*increment;
}

if(timeNow > longWait)
{
Debug.e("GCodeReaderAndWriter().waitForResponse(): waited for " + timeNow/1000 + " seconds.");
try {
queue("M0 ;shut RepRap down");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

try
{
i = serialInStream.read();
} catch (Exception e)
{
i = -1;
}

//anything found?
if (i >= 0)
{
char c = (char)i;

//is it at the end of the line?
if (c == '\n' || c == '\r')
{
goAgain = false;

Debug.d("GCodeWriter.waitForResponse() - received response from RepRap "+ resp);

if (resp.startsWith("start") || resp.contentEquals("")) // Startup or null string...
{
resp = "";
goAgain = true;
} else if (resp.startsWith("!!")) // Horrible hard fault?
{
result = shutDown;
Debug.e("GCodeWriter.waitForResponse(): RepRap hard fault!");

} else if (resp.startsWith("//")) // immediate DEBUG "comment" from the firmware ( like C++ )
{
resp = "";
goAgain = true;
} else if (resp.endsWith("\\")) // lines ending in a single backslash are considered "continued" to the next line, like "C"
{
// Debug.d("GCodeWriter.waitForResponse(): " + resp);
// resp = ""; don't clear the previuos response...
goAgain = true; // but do "go again"
} else if (resp.startsWith("rs")) // Re-send request?
{
lns = resp.substring(3);
int sp = lns.indexOf(" ");
if(sp > 0)
lns = lns.substring(0, sp);

// Some firmware (may be all) returns the line with a leading 'N'.
if (lns.startsWith("N"))
lns = lns.substring(1);

result = Long.parseLong(lns);
} else if (!resp.startsWith("ok")) // Must be "ok" if not those - check
{
Debug.e("GCodeWriter.waitForResponse() - dud response from RepRap:" + resp);
result = lineNumber; // Try to send the last line again
}

// Have we got temperatures and/or coordinates?

eTemp = parseReturnedValue(resp, " T:");
bTemp = parseReturnedValue(resp, " B:");
if(resp.indexOf(" C:") >= 0)
{
x = parseReturnedValue(resp, " X:");
y = parseReturnedValue(resp, " Y:");
z = parseReturnedValue(resp, " Z:");
e = parseReturnedValue(resp, " E:");
}

if(!goAgain)
{
Debug.c("Response: " + resp);
lastResp = resp.substring(2);
return result;
}
} else
resp += c;
}
}
}
Aircatcher
Re: Problems running RepRap Host.
July 28, 2011 05:42PM
To solve this problem you can change the teacup firmware:
in the file: gcode_parse.c replace
sersendf_P(PSTR("rs N%ld Expected line number %ld\n"), next_target.N_expected, next_target.N_expected);
with:
sersendf_P(PSTR("rs %ld Expected line number %ld\n"), next_target.N_expected, next_target.N_expected);

Frank


alfalover Wrote:
-------------------------------------------------------
> Hello,
>
> I just finished my Mendel , and I have problems
> to get it run, every time y try to print I receive
> next error and stops printing: y have enabled Comm
> Debug and debug...
>
> ERROR: Error printing file:
> java.lang.NumberFormatException: For input string:
> "N79" [599.089s/6041ms]
> java.lang.NumberFormatException: For input string:
> "N79"
> at
> java.lang.NumberFormatException.forInputString(Num
> berFormatException.java:65)
> at java.lang.Long.parseLong(Long.java:438)
> at java.lang.Long.parseLong(Long.java:478)
> at
> org.reprap.comms.GCodeReaderAndWriter.waitForRespo
> nse(Unknown Source)
> at
> org.reprap.comms.GCodeReaderAndWriter.bufferQueue(
> Unknown Source)
> at
> org.reprap.comms.GCodeReaderAndWriter.access$100(U
> nknown Source)
> at
> org.reprap.comms.GCodeReaderAndWriter$1.run(Unknow
> n Source)
> comms: G-code: N80 G28 *11 dequeued and sent
> [643.158s/44069ms]
>
> Gen 7 1.2 Board, with teacup firmware, and mendel
> parts hot end.
>
> With XYZ and Extruder z I am able to test the
> machine.
>
>
> Thanks for any hint in advance.
Sorry, only registered users may post in this forum.

Click here to login