Mercurial Hosting > harelet
comparison harelet.c @ 11:1d4df12de9e3
Automated Vimcurial commmit
author | VilyaemKenyaz |
---|---|
date | Tue, 12 Sep 2023 08:05:11 -0400 |
parents | c73aed540bdd |
children | 35e6a7b53e3c |
comparison
equal
deleted
inserted
replaced
10:c73aed540bdd | 11:1d4df12de9e3 |
---|---|
13 #ifdef __linux__ | 13 #ifdef __linux__ |
14 #include "linuxconio.h" | 14 #include "linuxconio.h" |
15 #endif | 15 #endif |
16 | 16 |
17 #ifdef _WIN32 | 17 #ifdef _WIN32 |
18 #include <Windows.h>> | 18 #include <windows.h>> |
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 |
31 }point; | 31 }point; |
32 | 32 |
33 point points[MAXPOINT]; | 33 point points[MAXPOINT]; |
34 | 34 |
35 unsigned int X = 100; | 35 unsigned int X = 100; |
36 unsigned int Y = 100; | 36 unsigned int Y = 25; |
37 unsigned int step = 5; | 37 unsigned int step = 5; |
38 unsigned int down = 0; | 38 unsigned int down = 0; |
39 unsigned int numpoints = 0; | 39 unsigned int numpoints = 0; |
40 char action; | 40 char action; |
41 | 41 |
86 * Description - This function compiles instructions for CNC machines. | 86 * Description - This function compiles instructions for CNC machines. |
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; | 92 char * filename; |
93 char * file; | 93 char * file; |
94 char buffer[sizeof(int)*8+1]; | 94 char buffer[sizeof(int)*8+1]; |
95 int choice; | 95 int choice; |
96 | 96 clrscr(); |
97 puts("Select your format\n1. RAW GCODE"); | 97 puts("Select your format\n1. RAW GCODE"); |
98 scanf("%d",&choice); | 98 scanf("%d",&choice); |
99 | 99 |
100 | 100 |
101 puts("Enter the filename"); | 101 puts("Enter the filename"); |
108 //Meat of instructions | 108 //Meat of instructions |
109 for(int i = 0;i != numpoints;i++){ | 109 for(int i = 0;i != numpoints;i++){ |
110 //Compose | 110 //Compose |
111 char * instruction; | 111 char * instruction; |
112 strcat(instruction,"G0 X"); | 112 strcat(instruction,"G0 X"); |
113 itoa(points[i].X,buffer); | |
114 strcat(instruction,buffer); | 113 strcat(instruction,buffer); |
114 //Convert X to string | |
115 sprintf(buffer,"%d",&points[i].X); | |
115 strcat(instruction," Y"); | 116 strcat(instruction," Y"); |
116 itoa(points[i].Y,buffer); | 117 //Convert Y to string |
118 sprintf(buffer,"%d",&points[i].Y); | |
117 strcat(instruction,buffer); | 119 strcat(instruction,buffer); |
120 //Convert Z to string | |
121 sprintf(buffer,"%d",5); | |
118 strcat(instruction," Z"); | 122 strcat(instruction," Z"); |
119 itoa(DEEPNESS,buffer); | |
120 strcat(instruction,buffer); | 123 strcat(instruction,buffer); |
121 //Write to string | 124 //Write to string |
122 strcat(file,instruction); | 125 strcat(file,instruction); |
123 } | 126 } |
124 //Finish | 127 //Finish |
125 strcat(file,"G0, X0, Y0, Z0"); | 128 strcat(file,"G0, X0, Y0, Z0"); |
126 WriteFile(filename,file); | 129 WriteFile(filename,file); |
127 } | 130 } |
128 | 131 |
129 puts("Finished Compiling"); | 132 puts("Finished Compiling GCODE"); |
130 | 133 |
131 */ | 134 |
132 } | 135 } |
133 | 136 |
134 | 137 |
135 /********************************************* | 138 /********************************************* |
136 * Description - Main function | 139 * Description - Main function |
142 while(1){ | 145 while(1){ |
143 Render(); | 146 Render(); |
144 //New CONIO controls | 147 //New CONIO controls |
145 switch(getchar()){ | 148 switch(getchar()){ |
146 case 'h': | 149 case 'h': |
147 X += step; | 150 X -= step; |
148 break; | 151 break; |
149 case 'j': | 152 case 'j': |
150 Y += step; | 153 Y += step; |
151 break; | 154 break; |
152 case 'k': | 155 case 'k': |
153 Y -= step; | 156 Y -= step; |
154 break; | 157 break; |
155 case 'l': | 158 case 'l': |
156 X -= step; | 159 X += step; |
157 break; | 160 break; |
158 | 161 |
159 case 's': | 162 case 's': |
160 puts("New stepsize"); | 163 puts("New stepsize"); |
161 scanf("%d",&step); | 164 scanf("%d",&step); |