Date:2015-05-22 15:49:29 (8 years 4 months ago)
Author:Werner Almesberger
Commit:efe5f38eb4ec764f166e0bdf80cf534ed64501f3
Message:gp2rml/gp2rml.c: add spaces around operators

Files: gp2rml/gp2rml.c (3 diffs)

Change Details

gp2rml/gp2rml.c
6060static double z_scale = 1; /* < 1: compress; > 1: stretch */
6161
6262
63#define units(mm) ((int) round((mm)*40.0))
63#define units(mm) ((int) round((mm) * 40.0))
6464
6565
6666#define alloc_type(t) \
...... 
146146        printf("!PZ%d,%d;PA%d,%d;PD\n",
147147            units(seg->z-z_max), units(z_clear),
148148            units(seg->x), units(seg->y));
149        d = hypot(x-seg->x, y-seg->y);
149        d = hypot(x - seg->x, y - seg->y);
150150        s += d;
151        s += z-z_max;
152        t += d/V_MAX;
153        t += (z-z_max)/z_speed;
151        s += z - z_max;
152        t += d / V_MAX;
153        t += (z - z_max) / z_speed;
154154        x = seg->x;
155155        y = seg->y;
156156        z = seg->z;
157157        seg = seg->next;
158158        while (seg) {
159159            printf("!ZZ%d,%d,%d\n", units(seg->x), units(seg->y),
160                units((seg->z-z_max)*z_scale));
161            d = hypot(x-seg->x, y-seg->y);
162            txy = d/xy_speed;
163            tz = fabs(z-seg->z)/z_speed;
160                units((seg->z - z_max) * z_scale));
161            d = hypot(x - seg->x, y - seg->y);
162            txy = d / xy_speed;
163            tz = fabs(z - seg->z) / z_speed;
164164            t += txy > tz ? txy : tz;
165            d = hypot(d, z-seg->z);
165            d = hypot(d, z - seg->z);
166166            s += d;
167167            x = seg->x;
168168            y = seg->y;
...... 
170170            seg = seg->next;
171171        }
172172        printf("PU\n");
173        d = z_max+z_clear-z;
173        d = z_max + z_clear - z;
174174        s += d;
175        t += d/V_MAX;
176        z = z_max+z_clear;
175        t += d / V_MAX;
176        z = z_max + z_clear;
177177    }
178178
179179    printf("!MC0;!ZO0;!PZ0,0;PU0,0;IN\n");
180    d = -z+hypot(x, y);
180    d = -z + hypot(x, y);
181181    s += d;
182    t += d/V_MAX;
182    t += d / V_MAX;
183183    fprintf(stderr, "Distance %.1f mm, time %.1f s\n", s, t);
184184}
185185

Archive Download the corresponding diff file

Branches:
master



interactive