gcode_parse.c: added comments, which show possible variable overflows.

Stay tuned, the fix is just around the corner.
This commit is contained in:
Markus Hitter 2011-02-23 02:39:04 +01:00
parent dfc4674012
commit 0dc623d4eb
2 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,7 @@
// for threaded rods, this is (steps motor per turn) / (pitch of the thread) // for threaded rods, this is (steps motor per turn) / (pitch of the thread)
// for belts, this is (steps per motor turn) / (number of gear teeth) / (belt module) // for belts, this is (steps per motor turn) / (number of gear teeth) / (belt module)
// half-stepping doubles the number, quarter stepping requires * 4, etc. // half-stepping doubles the number, quarter stepping requires * 4, etc.
// valid range = 0.020 to 4194.303
#define STEPS_PER_MM_X 320.000 #define STEPS_PER_MM_X 320.000
#define STEPS_PER_MM_Y 320.000 #define STEPS_PER_MM_Y 320.000
#define STEPS_PER_MM_Z 320.000 #define STEPS_PER_MM_Z 320.000

View File

@ -47,6 +47,22 @@ decfloat read_digit __attribute__ ((__section__ (".bss")));
GCODE_COMMAND next_target __attribute__ ((__section__ (".bss"))); GCODE_COMMAND next_target __attribute__ ((__section__ (".bss")));
/*
decfloat_to_int() is the weakest subject to variable overflow. For evaluation, we assume a build room of +-1000 mm and STEPS_PER_MM_x between 1.000 and 4096. Accordingly for metric units:
df->mantissa: +-0..1048075 (20 bit - 500 for rounding)
df->exponent: 0, 2, 3 or 4 (10 bit)
multiplicand / denominator: 20..4194303 / 1000 (22 bit - 10 bit) or
0..4095 / 1 (12 bit - 0 bit)
imperial units:
df->mantissa: +-0..32267 (15 bit - 500 for rounding)
df->exponent: 0, 2, 3 or 4 (10 bit)
multiplicand: 1..105000 (17 bit)
denominator: 1 or 10 ( 4 bit)
*/
/* /*
utility functions utility functions
*/ */