Mercurial Hosting > harelet
comparison harelet.c @ 2:1b0ebe86b44c
Automated Vimcurial commmit
author | VilyaemKenyaz |
---|---|
date | Fri, 08 Sep 2023 07:54:05 -0400 |
parents | 47e1b1039d7b |
children | eb7a7364994c |
comparison
equal
deleted
inserted
replaced
1:47e1b1039d7b | 2:1b0ebe86b44c |
---|---|
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include "basedfilelib.h" | 9 #include "basedfilelib.h" |
10 | 10 |
11 #define DEEPNESS 5 | 11 #define DEEPNESS 5 |
12 #define MAXPOINT 4096 | 12 #define MAXPOINT 4096 |
13 | 13 #define UNITS "G20" |
14 #define SPEED 20 | |
14 | 15 |
15 typedef struct{ | 16 typedef struct{ |
16 unsigned int X,Y,down; | 17 unsigned int X,Y,down; |
17 }point; | 18 }point; |
18 | 19 |
58 * Author - William King | 59 * Author - William King |
59 * Date - Sep 08 2023 | 60 * Date - Sep 08 2023 |
60 * *******************************************/ | 61 * *******************************************/ |
61 void Compile(){ | 62 void Compile(){ |
62 char * filename; | 63 char * filename; |
64 char * file; | |
63 int choice; | 65 int choice; |
64 | 66 |
65 puts("Select your format\n1. RAW GCODE\n2. Superhare INO"); | 67 puts("Select your format\n1. RAW GCODE\n2. Superhare INO"); |
66 scanf("%d",&choice); | 68 scanf("%d",&choice); |
67 | 69 |
68 | 70 |
69 puts("Enter the filename"); | 71 puts("Enter the filename"); |
70 scanf("%s",filename); | 72 scanf("%s",filename); |
71 | 73 |
72 if(choice == 1){ | 74 if(choice == 1){ |
73 | 75 //Set the miller |
76 strcat(file,UNITS); | |
77 | |
78 //Meat of instructions | |
79 for(int i = 0;i != numpoints;i++){ | |
80 //Compose | |
81 char * instruction; | |
82 strcat(instruction,"G0 X"); | |
83 strcat(instruction,sprintf("%d",points[i].X)); | |
84 strcat(instruction," Y"); | |
85 strcat(inustrction,sprintf | |
86 //Write to string | |
87 strcat(file,instruction); | |
88 } | |
89 //Finish | |
90 strcat(file,"G0, X0, Y0, Z0"); | |
91 WriteFile(filename,file); | |
74 } | 92 } |
75 else{ | 93 else{ |
94 //Set the miller | |
95 | |
76 | 96 |
97 //Meat of instructions | |
98 | |
99 | |
100 //Finish | |
77 | 101 |
78 } | 102 } |
79 | 103 |
80 puts("Finished Compiling"); | 104 puts("Finished Compiling"); |
81 | 105 |
88 * Date - Sep 08 2023 | 112 * Date - Sep 08 2023 |
89 * *******************************************/ | 113 * *******************************************/ |
90 void main(int argc, char* argv[]){ | 114 void main(int argc, char* argv[]){ |
91 scanf("%c",&action); | 115 scanf("%c",&action); |
92 switch(action){ | 116 switch(action){ |
93 case 'a': numpoints++; | 117 case 'a': points[numpoints].X = X; |
118 points[numpoints].Y = Y; | |
119 points[numpoints].down = down; | |
120 numpoints++; | |
94 break; | 121 break; |
95 case: | 122 case 'h': |
123 X+=step; | |
96 break; | 124 break; |
97 default: | 125 case 'j': |
126 Y+=step; | |
127 break; | |
128 case 'k': | |
129 Y-=step; | |
130 break; | |
131 case 'l': | |
132 X-=step; | |
133 break; | |
134 | |
135 case 's': | |
136 puts("Enter new step:"); | |
137 scanf("%d",&step); | |
138 break; | |
139 default: | |
98 break; | 140 break; |
99 } | 141 } |
100 exit(0); | 142 exit(0); |
101 } | 143 } |