comparison harelet.c @ 13:8fe2392f2fcc

Automated Vimcurial commmit
author VilyaemKenyaz
date Tue, 12 Sep 2023 08:28:49 -0400
parents 35e6a7b53e3c
children 8b5ff478ec66
comparison
equal deleted inserted replaced
12:35e6a7b53e3c 13:8fe2392f2fcc
19 #include <conio.h> 19 #include <conio.h>
20 #endif 20 #endif
21 21
22 #define DEEPNESS 5 22 #define DEEPNESS 5
23 #define MAXPOINT 4096 23 #define MAXPOINT 4096
24 #define UNITS "G20" 24 #define UNITS "G20\n"
25 #define SPEED 20 25 #define SPEED 20
26 26
27 typedef struct{ 27 typedef struct{
28 unsigned int X; 28 unsigned int X;
29 unsigned int Y; 29 unsigned int Y;
87 * Author - William King 87 * Author - William King
88 * Date - Sep 08 2023 88 * Date - Sep 08 2023
89 * *******************************************/ 89 * *******************************************/
90 void Compile(){ 90 void Compile(){
91 91
92 char filename[32]; 92 char filename[64];
93 char file[8192]; 93 char file[8192];
94 char buffer[32]; 94 char buffer[64];
95 unsigned int choice; 95 unsigned int choice;
96 96
97 clrscr(); 97 clrscr();
98 puts("Select your format\n1. RAW GCODE"); 98 puts("Select your format\n1. RAW GCODE");
99 scanf("%d",&choice); 99 scanf("%d",&choice);
100 100
101 101
102 puts("Enter the filename"); 102 puts("Enter the filename");
103 scanf("%s",filename); 103 scanf("%s",filename);
104 printf("Compiling %s,,,\n",filename); 104 printf("Compiling %s...\n",filename);
105 if(choice == 1){ 105 if(choice == 1){
106 //Set the miller 106 //Set the miller
107 strcat(file,UNITS); 107 strcat(file,UNITS);
108 strcat(file,"G0 X0 Y0 Z0"); 108 strcat(file,"G0 X0 Y0 Z0\n");
109 //Meat of instructions 109 //Meat of instructions
110 for(int i = 0;i != numpoints;i++){ 110 for(int i = 0;i != numpoints;i++){
111 //Compose 111 //Compose
112 char instruction[32]; 112 char instruction[32];
113 strcat(instruction,"G0 X"); 113 strcat(instruction,"G0 X ");
114 strcat(instruction,buffer); 114 strcat(instruction,buffer);
115 //Convert X to string 115 //Convert X to string
116 sprintf(buffer,"%d",&points[i].X); 116 sprintf(buffer,"%d",&points[i].X);
117 strcat(instruction," Y"); 117 strcat(instruction," Y ");
118 //Convert Y to string 118 //Convert Y to string
119 sprintf(buffer,"%d",&points[i].Y); 119 sprintf(buffer,"%d",&points[i].Y);
120 strcat(instruction,buffer); 120 strcat(instruction,buffer);
121 if(points[i].down = 1){ 121 if(points[i].down = 1){
122 strcat(instruction," Z 5"); 122 strcat(instruction," Z 5\n");
123 } 123 }
124 else{ 124 else{
125 strcat(instruction," Z 0"); 125 strcat(instruction," Z 0\n");
126 } 126 }
127 strcat(instruction,buffer); 127 strcat(instruction,buffer);
128 //Write to string 128 //Write to string
129 strcat(file,instruction); 129 strcat(file,instruction);
130 } 130 }
131 //Finish 131 //Finish
132 strcat(file,"G0, X0, Y0, Z0"); 132 strcat(file,"G0 X0 Y0 Z0\n");
133 WriteFile(filename,file); 133 WriteFile(filename,file);
134 } 134 }
135 else{ 135 else{
136 136
137 puts("Invalid compile format"); 137 puts("Invalid compile format");