comparison harelet.c @ 6:ec82c868b8b0

Automated Vimcurial commmit
author VilyaemKenyaz
date Sat, 09 Sep 2023 16:44:53 -0400
parents 3879c1178448
children 1bb981516d87
comparison
equal deleted inserted replaced
5:3879c1178448 6:ec82c868b8b0
14 #define MAXPOINT 4096 14 #define MAXPOINT 4096
15 #define UNITS "G20" 15 #define UNITS "G20"
16 #define SPEED 20 16 #define SPEED 20
17 17
18 typedef struct{ 18 typedef struct{
19 unsigned int X = 0; 19 unsigned int X;
20 unsigned int Y = 0;; 20 unsigned int Y;
21 unsigned int down = 0; 21 unsigned int down;
22 }point; 22 }point;
23 23
24 point points[MAXPOINT]; 24 point points[MAXPOINT];
25 25
26 unsigned int X = 0; 26 unsigned int X = 0;
27 unsigned int Y = 0; 27 unsigned int Y = 0;
28 unsigned int step = 0; 28 unsigned int step = 5;
29 unsigned int down = 0; 29 unsigned int down = 0;
30 unsigned int numpoints = 0; 30 unsigned int numpoints = 0;
31 char action; 31 char action;
32 32
33 /********************************************* 33 /*********************************************
35 * Author - William King 35 * Author - William King
36 * Date - Sep 08 2023 36 * Date - Sep 08 2023
37 * *******************************************/ 37 * *******************************************/
38 void Render(){ 38 void Render(){
39 39
40 printf("\x1b[0;0f]");
41 puts("HARELET A CAD PROGRAM BY VILYAEM KENYAZ, PEEP SOFTWARE 2023");
42 printf("Number of Points: %d X: %d Y: %d STEPSIZE: %d DWN?: %d\n",numpoints,X,Y,step,down);
43
40 //Render points 44 //Render points
41 for(int i = 0;i != MAXPOINT;i++){ 45 for(int i = 0;i != MAXPOINT;i++){
42 puts("\x1b[0;0f]"); 46 printf("\x1b[0;0f]");
43
44 //Move X 47 //Move X
45 for(int j = 0;j != points[i].X;j++){ 48 for(int j = 0;j != points[i].X;j++){
46 49
47 printf(""); 50 printf("");
48 51
87 void Compile(){ 90 void Compile(){
88 char * filename; 91 char * filename;
89 char * file; 92 char * file;
90 int choice; 93 int choice;
91 94
92 puts("Select your format\n1. RAW GCODE\n2. Superhare INO"); 95 puts("Select your format\n1. RAW GCODE");
93 scanf("%d",&choice); 96 scanf("%d",&choice);
94 97
95 98
96 puts("Enter the filename"); 99 puts("Enter the filename");
97 scanf("%s",filename); 100 scanf("%s",filename);
98 101
99 if(choice == 1){ 102 if(choice == 1){
100 //Set the miller 103 //Set the miller
101 strcat(file,UNITS); 104 strcat(file,UNITS);
102 105 strcat(file,"G0 X0 Y0 Z0");
103 //Meat of instructions 106 //Meat of instructions
104 for(int i = 0;i != numpoints;i++){ 107 for(int i = 0;i != numpoints;i++){
105 //Compose 108 //Compose
106 char * instruction; 109 char * instruction;
107 strcat(instruction,"G0 X"); 110 strcat(instruction,"G0 X");
108 strcat(instruction,sprintf("%d",points[i].X)); 111 strcat(instruction,itoa(points[i].X));
109 strcat(instruction," Y"); 112 strcat(instruction," Y");
110 strcat(instruction,sprintf("%d",points[i].Y)); 113 strcat(instruction,itoa(points[i].Y));
111 strcat(instruction," Z"); 114 strcat(instruction," Z");
112 strcat(instruction,sprintf("%d",DEEPNESS)); 115 strcat(instruction,itoa(DEEPNESS));
113 //Write to string 116 //Write to string
114 strcat(file,instruction); 117 strcat(file,instruction);
115 } 118 }
116 //Finish 119 //Finish
117 strcat(file,"G0, X0, Y0, Z0"); 120 strcat(file,"G0, X0, Y0, Z0");
118 WriteFile(filename,file); 121 WriteFile(filename,file);
119 }
120 else{
121 puts("Superhare implementation not done");
122 exit(1);
123 //Set the miller
124
125
126 //Meat of instructions
127
128
129 //Finish
130
131 } 122 }
132 123
133 puts("Finished Compiling"); 124 puts("Finished Compiling");
134 125
135 } 126 }
149 points[numpoints].Y = Y; 140 points[numpoints].Y = Y;
150 points[numpoints].down = down; 141 points[numpoints].down = down;
151 numpoints++; 142 numpoints++;
152 break; 143 break;
153 case 'h': 144 case 'h':
154 X+=step; 145
146 if(X < 200 - step){
147 X += step;
148 }
155 break; 149 break;
156 case 'j': 150 case 'j':
157 Y+=step; 151 if(X > step){
152 Y += step;
153 }
158 break; 154 break;
159 case 'k': 155 case 'k':
160 Y-=step; 156 if(Y < 0){
157 Y -= step;
158 }
161 break; 159 break;
162 case 'l': 160 case 'l':
163 X-=step; 161 if(Y > 200){
162 X -= step;
163 }
164 break; 164 break;
165 165
166 case 's': 166 case 's':
167 puts("Enter new step:"); 167 puts("Enter new step:");
168 scanf("%d",&step); 168 scanf("%d",&step);