Pause @ zPos

Support for the new Pause @ zPos in sailfish firmware
master
WHPThomas 2013-04-19 14:53:34 +10:00
parent f77f3c5fd4
commit b6ec0f9328
2 changed files with 24 additions and 1 deletions

23
gpx.c
View File

@ -1168,6 +1168,17 @@ static void set_acceleration(int state)
// 157 - Stream Version
// 158 - Pause @ zPos
static void pause_at_z(float z_positon)
{
if(write_8(158) == EOF) exit(1);
// uint8: pause at Z coordinate or 0.0 to disable
if(write_float(z_positon) == EOF) exit(1);
}
// PARSER INPUT PREPROCESSORS
// return the length of the given file in bytes
@ -2288,6 +2299,18 @@ int main(int argc, char * argv[])
case 321:
set_acceleration(0);
break;
// M322 - Pause @ zPos
case 322:
if(command.flag & Z_IS_SET) {
pause_at_z(targetPosition.z);
}
else {
pause_at_z(0.0);
fprintf(stderr, "(line %u) Syntax Warning: M322 is missing Z axes, assuming 0.0" EOL, line_number);
}
break;
default:
fprintf(stderr, "(line %u) Syntax Warning: unsupported mcode command 'M%u'" EOL, line_number, command.m);
}

2
gpx.h
View File

@ -29,7 +29,7 @@
#include <limits.h>
#define GPX_VERSION "0.4 (beta)"
#define GPX_VERSION "0.5 (beta)"
// x3g axes bitfields