Hi! I finally had the possibility to test your code and unfortunately it didn't do it. It behaves in the same way as before. Before testing the code I thought that the "p -= 1;" at the end of the tool change would make it report back the wrong (-1) tool position. But it will report back the correct position although it hasn't reached the correct pocket. When I coded my little fix my assumption was that the deducation has to take place during the start of the move instead of during the reverse latching, thereby forcing the turret to go one step further. Deducting "one" during the latching doesn't seem to make the turret restart again to move that extra step forward. My guess is that case 2 already sets "state = 4" when the current_position evaluates to the requested tool position, thereby not doing anything more after that. That might be the reason why "p -= 1" doesn't have any effect. But I might of course be totally incorrect here.
Regards, Andreas Den tis 12 jan. 2021 kl 00:22 skrev Andreas Linnarsson < andreas.linnars...@gmail.com>: > Great! I will try this tomorrow! I made some slight adjustments to the > carousel.comp that made it work as well. Not a pretty or general solution. > I tried to make a more general solution, really going through your code to > adding what I thought would be neccessary. But it didn't compile at the > first try so I just did this. I've commented my changes. > > The first time I tried it, it worked a couple of times then it broke and I > got the "Unexpected delay error" again. Next time I tried it I could issue > tool change after tool change and it didn't fail. But your solution looks > much neater. Thanks! > > Den mån 11 jan. 2021 kl 23:58 skrev andy pugh <bodge...@gmail.com>: > >> On Mon, 11 Jan 2021 at 16:51, Andreas Linnarsson >> <andreas.linnars...@gmail.com> wrote: >> > >> > I do understand it's really hard to bugfix without the real hardware. >> >> Try this. >> >> case 'I': // index + position. >> p = current_position; >> if (homed){ >> if ( old_index != sense(1) ) >> if (motor_fwd && sense(1)){ >> p += 1; >> if (p > inst_pockets) p -= inst_pockets; >> } >> if (inst_dir == 2 && motor_rev && sense(1)) { >> p -= 1; >> if (p < 1) p += inst_pockets; >> } >> // special case for single-dir latching turrets falling >> // off the pulse during the latch >> if (inst_dir == 1 && ! motor_fwd && ! sense(1)){ >> p -= 1; >> } >> } >> old_index = sense(1); >> } >> break; >> >> >> -- >> atp >> "A motorcycle is a bicycle with a pandemonium attachment and is >> designed for the especial use of mechanical geniuses, daredevils and >> lunatics." >> — George Fitch, Atlanta Constitution Newspaper, 1912 >> >> >> _______________________________________________ >> Emc-users mailing list >> Emc-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/emc-users >> > _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users