Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
Added third servo-z position
Browse files Browse the repository at this point in the history
  • Loading branch information
melchiorrecaruso committed Apr 19, 2020
1 parent 3d0481a commit b4bc6d2
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 113 deletions.
2 changes: 1 addition & 1 deletion install/vplot.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "vPlot"
#define MyAppName "vPlot Client"
#define MyAppVersion "5.3"
#define MyAppPublisher "Melchiorre Caruso"
#define MyAppURL "https://github.com/melchiorrecaruso/vplot-arduino"
Expand Down
23 changes: 16 additions & 7 deletions src/mainfrm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ procedure tmainform.motorbtnclick(sender: tobject);
driver.onstop := @onplotterstop;
driver.ontick := @onplottertick;
driver.init;
driver.movez(setting.servozmax);
driver.movez(setting.servozvalue1);
driver.move (cx + driver.xcount,
cy + driver.ycount);
driver.start;
Expand All @@ -318,9 +318,18 @@ procedure tmainform.penbtnclick(sender: tobject);
driver.ontick := @onplottertick;
driver.init;
if sender = pendownbtn then
driver.movez(setting.servozmin)
else
driver.movez(setting.servozmax);
begin
if driver.zcount = setting.servozvalue2 then
driver.movez(setting.servozvalue1)
else
driver.movez(setting.servozvalue0);
end else
begin
if driver.zcount = setting.servozvalue0 then
driver.movez(setting.servozvalue1)
else
driver.movez(setting.servozvalue2);
end;
driver.start;
end;
end;
Expand Down Expand Up @@ -496,9 +505,9 @@ procedure tmainform.startmiclick(sender: tobject);
point2.y := point2.y + yoffset;

if distance_between_two_points(point1, point2) > 0.2 then
driver.movez(setting.servozmax)
driver.movez(setting.servozvalue1)
else
driver.movez(setting.servozmin);
driver.movez(setting.servozvalue0);

driverengine.calcsteps(point2, cx, cy);
driver.move(cx, cy);
Expand Down Expand Up @@ -552,7 +561,7 @@ procedure tmainform.movetohomemiclick(sender: tobject);
driver.onstop := @onplotterstop;
driver.ontick := @onplottertick;
driver.init;
driver.movez(setting.servozmax);
driver.movez(setting.servozvalue1);
driverengine.calcsteps(setting.point8, cx, cy);
driver.move(cx, cy);
driver.start;
Expand Down
10 changes: 6 additions & 4 deletions src/settingfrm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ procedure tsettingform.load(asetting: tvpsetting);
settinglist.insertrow('PULLEY-1.RADIUS', floattostr(asetting.pulley1radius), true);
settinglist.insertrow('PULLEY-1.RATIO', floattostr(asetting.pulley1ratio), true);

settinglist.insertrow('SERVO-Z.MIN', floattostr(asetting.servozmin), true);
settinglist.insertrow('SERVO-Z.MAX', floattostr(asetting.servozmax), true);
settinglist.insertrow('SERVO-Z.VALUE-0', floattostr(asetting.servozvalue0), true);
settinglist.insertrow('SERVO-Z.VALUE-1', floattostr(asetting.servozvalue1), true);
settinglist.insertrow('SERVO-Z.VALUE-2', floattostr(asetting.servozvalue2), true);

settinglist.insertrow('PAGE.HEIGHT', floattostr(asetting.pageheight), true);
settinglist.insertrow('PAGE.WIDTH', floattostr(asetting.pagewidth), true);
Expand Down Expand Up @@ -125,8 +126,9 @@ procedure tsettingform.save(asetting: tvpsetting);
asetting.pulley0ratio := strtofloat(settinglist.values['PULLEY-0.RATIO' ]);
asetting.pulley1radius := strtofloat(settinglist.values['PULLEY-1.RADIUS']);
asetting.pulley1ratio := strtofloat(settinglist.values['PULLEY-1.RATIO' ]);
asetting.servozmin := strtoint (settinglist.values['SERVO-Z.MIN' ]);
asetting.servozmax := strtoint (settinglist.values['SERVO-Z.MAX' ]);
asetting.servozvalue0 := strtoint (settinglist.values['SERVO-Z.VALUE-0']);
asetting.servozvalue1 := strtoint (settinglist.values['SERVO-Z.VALUE-1']);
asetting.servozvalue2 := strtoint (settinglist.values['SERVO-Z.VALUE-2']);

asetting.pageheight := strtofloat(settinglist.values['PAGE.HEIGHT' ]);
asetting.pagewidth := strtofloat(settinglist.values['PAGE.WIDTH' ]);
Expand Down
41 changes: 23 additions & 18 deletions src/vpsetting.pas
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ tvpsetting = class
fpulley1radius: vpfloat;
fpulley1ratio: vpfloat;
// servo-z
fservozmin: longint;
fservozmax: longint;
fservozvalue0: longint;
fservozvalue1: longint;
fservozvalue2: longint;
// ramps
frampkb: longint;
frampkl: longint;
Expand Down Expand Up @@ -82,8 +83,9 @@ tvpsetting = class
property pulley0ratio: vpfloat read fpulley0ratio write fpulley0ratio;
property pulley1radius: vpfloat read fpulley1radius write fpulley1radius;
property pulley1ratio: vpfloat read fpulley1ratio write fpulley1ratio;
property servozmin: longint read fservozmin write fservozmin;
property servozmax: longint read fservozmax write fservozmax;
property servozvalue0: longint read fservozvalue0 write fservozvalue0;
property servozvalue1: longint read fservozvalue1 write fservozvalue1;
property servozvalue2: longint read fservozvalue2 write fservozvalue2;

property rampkb: longint read frampkb write frampkb;
property rampkl: longint read frampkl write frampkl;
Expand Down Expand Up @@ -166,12 +168,13 @@ procedure tvpsetting.load(const filename: string);
fpoint9offset := ini.readfloat('LAYOUT', 'POINT9.OFFSET', 0);
fpoint9factor := ini.readfloat('LAYOUT', 'POINT9.FACTOR', 0);

fpulley0radius := ini.readfloat ('PULLEY-0', 'RADIUS', 0);
fpulley0ratio := ini.readfloat ('PULLEY-0', 'RATIO', 0);
fpulley1radius := ini.readfloat ('PULLEY-1', 'RADIUS', 0);
fpulley1ratio := ini.readfloat ('PULLEY-1', 'RATIO', 0);
fservozmin := ini.readinteger('SERVO-Z', 'MIN', 0);
fservozmax := ini.readinteger('SERVO-Z', 'MAX', 0);
fpulley0radius := ini.readfloat ('PULLEY-0', 'RADIUS', 0);
fpulley0ratio := ini.readfloat ('PULLEY-0', 'RATIO', 0);
fpulley1radius := ini.readfloat ('PULLEY-1', 'RADIUS', 0);
fpulley1ratio := ini.readfloat ('PULLEY-1', 'RATIO', 0);
fservozvalue0 := ini.readinteger('SERVO-Z', 'VALUE-0', 0);
fservozvalue1 := ini.readinteger('SERVO-Z', 'VALUE-1', 0);
fservozvalue2 := ini.readinteger('SERVO-Z', 'VALUE-2', 0);

fpageheight := ini.readfloat('PAGE', 'HEIGHT', 0);
fpagewidth := ini.readfloat('PAGE', 'WIDTH', 0);
Expand Down Expand Up @@ -211,8 +214,9 @@ procedure tvpsetting.load(const filename: string);
writeln(format('PLLY-0::RATIO = %12.5f', [fpulley0ratio ]));
writeln(format('PLLY-1::RADIUS = %12.5f', [fpulley1radius]));
writeln(format('PLLY-1::RATIO = %12.5f', [fpulley1ratio ]));
writeln(format(' SRV-Z::MIN = %12.5u', [fservozmin ]));
writeln(format(' SRV-Z::MAX = %12.5u', [fservozmax ]));
writeln(format(' SRV-Z::VALUE-0 = %12.5u', [fservozvalue0 ]));
writeln(format(' SRV-Z::VALUE-1 = %12.5u', [fservozvalue1 ]));
writeln(format(' SRV-Z::VALUE-2 = %12.5u', [fservozvalue2 ]));

writeln(format(' PAGE::HEIGHT = %12.5f', [fpageheight]));
writeln(format(' PAGE::WIDTH = %12.5f', [fpagewidth ]));
Expand Down Expand Up @@ -254,12 +258,13 @@ procedure tvpsetting.save(const filename: string);
ini.writefloat('LAYOUT', 'POINT9.OFFSET', fpoint9offset);
ini.writefloat('LAYOUT', 'POINT9.FACTOR', fpoint9factor);

ini.writefloat ('PULLEY-0', 'RADIUS', fpulley0radius);
ini.writefloat ('PULLEY-0', 'RATIO', fpulley0ratio);
ini.writefloat ('PULLEY-1', 'RADIUS', fpulley1radius);
ini.writefloat ('PULLEY-1', 'RATIO', fpulley1ratio);
ini.writeinteger('SERVO-Z', 'MIN', fservozmin);
ini.writeinteger('SERVO-Z', 'MAX', fservozmax);
ini.writefloat ('PULLEY-0', 'RADIUS', fpulley0radius);
ini.writefloat ('PULLEY-0', 'RATIO', fpulley0ratio);
ini.writefloat ('PULLEY-1', 'RADIUS', fpulley1radius);
ini.writefloat ('PULLEY-1', 'RATIO', fpulley1ratio);
ini.writeinteger('SERVO-Z', 'VALUE-0', fservozvalue0);
ini.writeinteger('SERVO-Z', 'VALUE-1', fservozvalue1);
ini.writeinteger('SERVO-Z', 'VALUE-2', fservozvalue2);

ini.writefloat('PAGE', 'HEIGHT', fpageheight);
ini.writefloat('PAGE', 'WIDTH', fpagewidth);
Expand Down
58 changes: 29 additions & 29 deletions vplot.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
POINT0.X=0
POINT0.Y=2200
POINT1.X=2566
POINT1.Y=2202
POINT1.Y=2200
POINT8.X=1283
POINT8.Y=1338
POINT9.OFFSET=-15
POINT8.Y=1339
POINT9.OFFSET=-5
POINT9.FACTOR=-0.5

[PULLEY-0]
RADIUS=6.0
RATIO=0.01244
RADIUS=6
RATIO=0.012485

[PULLEY-1]
RADIUS=6.0
RATIO=0.01244
RADIUS=6
RATIO=0.012485

[SERVO-Z]
MIN=180
MAX=140
VALUE-0=170
VALUE-1=140
VALUE-2=115

[PAGE]
HEIGHT=841
Expand All @@ -30,24 +31,23 @@ KL=200
KM=10

[WAVE]
POINT0.X=+0
POINT0.Y=+0
POINT1.X=+0
POINT1.Y=+1.25
POINT2.X=+0
POINT2.Y=+0
POINT3.X=+0
POINT3.Y=+0
POINT4.X=+0
POINT4.Y=+1.25
POINT5.X=+0
POINT5.Y=+0
POINT6.X=+0
POINT6.Y=+0
POINT7.X=+0
POINT7.Y=+1.25
POINT8.X=+0
POINT8.Y=+0
SCALE=1.0
POINT0.X=0
POINT0.Y=0
POINT1.X=0
POINT1.Y=0
POINT2.X=0
POINT2.Y=0
POINT3.X=0
POINT3.Y=0
POINT4.X=0
POINT4.Y=0
POINT5.X=0
POINT5.Y=0
POINT6.X=0
POINT6.Y=0
POINT7.X=0
POINT7.Y=0
POINT8.X=0
POINT8.Y=0
SCALE=1
OFF=1

Loading

0 comments on commit b4bc6d2

Please sign in to comment.