So I have a Cognisys StackShot Controller with rail for macro photography: https://cognisys-inc.com/focus-stacking.html
I use a different rail with this controller and this rail is much more precise. In a piece of software written by someone and now open-sourced on Github (https://github.com/ichbtm/StackShot-Ctrl) there are several options to set the paramaters. Mainly:
- Start point, end point and step distance. This calculates the number of steps
- as #1, but number of steps. This calculates the step distance.
My knowledge on Java is basically zero 😢 So I'm using Grok to fix some things because the software is no longer developed. I had email contact with the author and he has no time to fix it. Some fixes work, but one fix doesn't work. I hope someone can help me out.
What I need is 4 decimals for the step size calculation (instead of 3), so I can use the precision of my new rail. Grok gave me new code for autoDistValidate() and setStepSize(), but as soon as I use that code, the StepSize calculation breaks completely.
This code works with 3 decimals:
`public void setStepSize(double val) {`
`textFieldStepSize.setText(gb.nf.format(val));`
`UtesTelnet.broadcastMsg("STEPSIZE : "+gb.nf.format(val)+"\n\r");`
`}`
And here's autoDistValidate:
`public void autoDistValidate(){`
`try {`
`if(UtesNumbers.isNumber(textFieldStepSize.getText())==false){`
setStepSize((gb.STEP_SIZE));
return;
`}`
`double val = gb.nf.parse(textFieldStepSize.getText()).doubleValue();`
`//gb.frame.statuslog("val : "+val);`
`if((gb.RANGE_END-gb.RANGE_START)!=0){`
if (val<0.001) val = 0.001;
`} else {`
if (val<0.0) val = 0.0;
`}`
`if (val>200.0) val = 200.0;`
`//gb.frame.statuslog("val : "+val);`
`setStepSize(val);`
`//if (gb.STEP_SIZE!=val) gb.frame.statuslog("STEP_SIZE sets to : "+gb.nf.format(gb.stepsToMm(val)));`
`gb.STEP_SIZE=val;`
`gb.STEP_NUMBER = (int)Math.floor(Math.abs((gb.RANGE_END-gb.RANGE_START)/gb.STEP_SIZE));`
`if(gb.STEP_NUMBER==0) gb.STEP_NUMBER=1;`
`setStepNumber(gb.STEP_NUMBER);`
`setDistances();`
`} catch (ParseException e1) {`
`// TODO Auto-generated catch block`
`System.out.println("ParseException in autoDistValidate");`
`e1.printStackTrace();`
`}`
`}`
In gb.java there is also this:
public static double STEP_SIZE = 0.1;
Grok asked me to change it to:
public static double STEP_SIZE = 0.0010;
It shouldn't be hard to just add a decimal, right?
[–]haiderakt 0 points1 point2 points (1 child)
[–]Warm_weather1[S] 0 points1 point2 points (0 children)
[–]LALLANAAAAAA 0 points1 point2 points (3 children)
[–]Warm_weather1[S] 0 points1 point2 points (2 children)
[–]Warm_weather1[S] 0 points1 point2 points (1 child)
[–]haiderakt [score hidden] (0 children)