Mercurial Hosting > harelet
changeset 6:ec82c868b8b0
Automated Vimcurial commmit
author | VilyaemKenyaz |
---|---|
date | Sat, 09 Sep 2023 16:44:53 -0400 |
parents | 3879c1178448 |
children | 1bb981516d87 |
files | .harelet.c.swp HARELET.MAN harelet.c |
diffstat | 3 files changed, 41 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HARELET.MAN Sat Sep 09 16:44:53 2023 -0400 @@ -0,0 +1,13 @@ +HARELET +.SH +NAME +.PP +HARELET +.SH +SYNOPSIS +.PP +HARELET +.SH +DESC +.PP +CAD program for CNC machines
--- a/harelet.c Fri Sep 08 08:40:34 2023 -0400 +++ b/harelet.c Sat Sep 09 16:44:53 2023 -0400 @@ -16,16 +16,16 @@ #define SPEED 20 typedef struct{ - unsigned int X = 0; - unsigned int Y = 0;; - unsigned int down = 0; + unsigned int X; + unsigned int Y; + unsigned int down; }point; point points[MAXPOINT]; unsigned int X = 0; -unsigned int Y = 0; -unsigned int step = 0; +unsigned int Y = 0; +unsigned int step = 5; unsigned int down = 0; unsigned int numpoints = 0; char action; @@ -37,10 +37,13 @@ * *******************************************/ void Render(){ + printf("\x1b[0;0f]"); + puts("HARELET A CAD PROGRAM BY VILYAEM KENYAZ, PEEP SOFTWARE 2023"); + printf("Number of Points: %d X: %d Y: %d STEPSIZE: %d DWN?: %d\n",numpoints,X,Y,step,down); + //Render points for(int i = 0;i != MAXPOINT;i++){ - puts("\x1b[0;0f]"); - + printf("\x1b[0;0f]"); //Move X for(int j = 0;j != points[i].X;j++){ @@ -89,7 +92,7 @@ char * file; int choice; - puts("Select your format\n1. RAW GCODE\n2. Superhare INO"); + puts("Select your format\n1. RAW GCODE"); scanf("%d",&choice); @@ -99,17 +102,17 @@ if(choice == 1){ //Set the miller strcat(file,UNITS); - + strcat(file,"G0 X0 Y0 Z0"); //Meat of instructions for(int i = 0;i != numpoints;i++){ //Compose char * instruction; strcat(instruction,"G0 X"); - strcat(instruction,sprintf("%d",points[i].X)); + strcat(instruction,itoa(points[i].X)); strcat(instruction," Y"); - strcat(instruction,sprintf("%d",points[i].Y)); + strcat(instruction,itoa(points[i].Y)); strcat(instruction," Z"); - strcat(instruction,sprintf("%d",DEEPNESS)); + strcat(instruction,itoa(DEEPNESS)); //Write to string strcat(file,instruction); } @@ -117,18 +120,6 @@ strcat(file,"G0, X0, Y0, Z0"); WriteFile(filename,file); } - else{ - puts("Superhare implementation not done"); - exit(1); - //Set the miller - - - //Meat of instructions - - - //Finish - - } puts("Finished Compiling"); @@ -151,16 +142,25 @@ numpoints++; break; case 'h': - X+=step; + + if(X < 200 - step){ + X += step; + } break; case 'j': - Y+=step; + if(X > step){ + Y += step; + } break; case 'k': - Y-=step; + if(Y < 0){ + Y -= step; + } break; case 'l': - X-=step; + if(Y > 200){ + X -= step; + } break; case 's':