Schaublin 125-CNC retrofit.

More
7 months 2 days ago #344949 by andypugh
I think it might be more effective to create a dedicated component, rather than force carousel to fit.

But I think that Carousel will probably just keep the "motor-fwd" bit set high until the carousel is in the correct position, so the trick is to find a way to release the pressure and lower the carousel once the actuating cylinder hits end-of-stroke.
Is there a sensor for that?

The crude way to make this work might be to use motor-fwd to enable a siggen component that sends a suitably-timed series of pulses.

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #344957 by RotarySMP
Hi Andy,

I got the Schaublin updated to Trixie and 2.9.8.

I really like the update you did to the look and button layout of Lathe macros. Thanks.

I was trying to work out how to address not having any feedback on the turret arriving in position. Because I am a shit programmer, I tried Chat GPT yesterday.

 

This is the set of requirements I gave:

 

The AI summary is rather accurate.

 

 

After a couple of back and forth, adding requirements, and accepting some AI suggestions, the result is the attached files.
Scary good how fast and efficient this is for a small project with very limited requirements, and how well it documents and explains the code. It would have taken me a few evening to get to this level, and my code would have been a mess of half-arsed work-around to avoid the gaping holes in my programming knowledge.

It failed to compile yesterday, due to some unknown character. I suspect the apple text editor has added some hidden ascii code. The attached files I cut paste into a different text editor. Off to test them now.
Cheers,
Mark

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #344959 by RotarySMP
Hi Andy,

I got the Schaublin updated to Trixie and 2.9.8.

I really like the update you did to the look and button layout of Lathe macros. Thanks.

I was trying to work out how to address not having any feedback on the turret arriving in position. Because I am a shit programmer, I tried Chat GPT yesterday.

 

This is the set of requirements I gave:

 

The AI summary is rather accurate.

 

 

After a couple of back and forth, adding requirements, and accepting some AI suggestions, the result is the attached files.
Scary good how fast and efficient this is for a small project with very limited requirements, and how well it documents and explains the code. It would have taken me a few evening to get to this level, and my code would have been a mess of half-arsed work-around to avoid the gaping holes in my programming knowledge.

It failed to compile yesterday, due to some unknown character. I suspect the apple text editor has added some hidden ascii code. The attached files I cut paste into a different text editor. Off to test them now.
Cheers,
Mark

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #344964 by RotarySMP
Okay, now I am understanding the pain of AI. I went in circles with compiling errors and format.

Now it compiles, but I get
hal:turret:1: character unknown '  '
and the invisible character search didn't turn up anything.

Any ideas what I have wrong in this comp appreciated...

Please Log in or Create an account to join the conversation.

More
7 months 2 days ago #344971 by JacobRush
I asked my imaganiry AI friend to take a look at it thusly:

"A friend of mine is trying to get a custom linuxcnc HAL component up and running and he's getting an odd runtime error of "hal:turret:1: character unknown ' '"

The documentation for hal stuff is here:http://linuxcnc.org/docs/html/hal/comp.html take a look and see if you see anything out of place."

While sending the comp file along.
The replies seem pretty reasonable:



I see two issues:

1. The actual error (line 1) — almost certainly smart quotes

The "character unknown ' '" error on line 1 means the halcompile lexer is hitting a byte it doesn't recognize. Line 1 has a doc string:

component turret "4-position pneumatic...";

Those " " quotes are probably Unicode smart/curly quotes (U+201C/U+201D) instead of plain ASCII double quotes (U+0022). Super common when the file was written or pasted through a rich text editor, Google Docs, macOS Notes, Word, etc.

Fix: Have him run this to check:

cat -A turret.comp | head -1

If he sees M-bM-^@M-^\ or any multi-byte sequences where the quotes are, that's the culprit. Replace all smart quotes with plain ASCII " quotes. Quick fix:

sed -i 's/[\xe2\x80\x9c\xe2\x80\x9d]/"/g' turret.comp

2. Secondary bug — FUNCTION name mismatch

He declared function _; (underscore = unnamed/default) but then used FUNCTION(turret) in the C section. Those have to match. Should be either:

FUNCTION(_) {

Or better yet since it's a single-function component, just skip the FUNCTION() wrapper entirely and put bare C after ;; — like the ddt example in the docs.

3. Minor — int diff inside switch/case

case 0:
...
int diff = target - position;

Declaring a variable inside a case without braces can choke some C standards. Wrap it:

case 0: {
...
int diff = target - position;
...
break;
}

The smart quotes are almost guaranteed to be the "character unknown" error. The FUNCTION mismatch will bite him right after he fixes that.
The following user(s) said Thank You: RotarySMP

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #345076 by RotarySMP
Thanks for that, I was not able to get into the forum for the last couple of days.

I had similar advice from AI, and tried both the solution yours and mine gave and it has not corrected it.

I even used visual code studio, and rewrote the whole program be hand, to ensure there were no secret character codes in there. (See attached file)But the result is still the same.
hal:turret:1: character unknown '  '

Any other suggestions much appreciated. 
Cheers,
Mark

Please Log in or Create an account to join the conversation.

Time to create page: 0.552 seconds
Powered by Kunena Forum