Traumflug / Teacup_Firmware

Firmware for RepRap and other 3D printers
http://forums.reprap.org/read.php?147
GNU General Public License v2.0
312 stars 199 forks source link

Feedrate can be set to zero #185

Open phord opened 9 years ago

phord commented 9 years ago

I noticed by chance that this command will crash the simulator (floating point exception; divide by zero):

G1 X1 F

It's because target->F == 0, and it's often the denominator. I actually noticed this when testing with parsertests.txt because it has the word "for" in it which has the same effect. I suppose the ARM doesn't have the chance to segfault so it simply continues on with bad results. This should be cleaned up somewhere, but I'm not sure where at the moment. In the parser? In the dda?

So I'm leaving it in this issue instead for now. The problem existed for a long time now and no one has noticed. But it should be cleaned up.

Traumflug commented 9 years ago

Nice catch :-)

Two places for catching this come to mind: dda_create(), where maximum speeds are checked as well and process_gcode_command(), where machine limits are tested.

The question is: what to do with such an obvious syntax error? F0 doesn't make sense and so far Teacup does no syntax checking at all. Simply set it to the minimum, to F1?

Wurstnase commented 9 years ago

I would simply ignore such values.