This is for a cnc laser machine i am building. Ill be loading grbl on it and i was thinking why not make it work autonomously without tying a pc or rpi or a phone to it.
I have too much time to spare so learning some new skills, maybe programming, is a good way to spend my days.
It would be awesome if i can get it working. Thanks for all the help this group had been giving me. Couldnt make it this far without your guys’ help. Especially you and @embeddedt. Please help me all the way. Hahah.
Update: i have all the functions done for all the objects (buttons, button maps, dropdown lists, scroll bars, etc.). All of them working as i expected them to. The stepper motors they need to move responds on the commands.
I however have one general issue. Hope somebody can help. This might not be the right forum to ask it. Apologies in advance. (Maybe point me to a better forum to ask it.)
The main problem i have is after sending a command, whether using the text area or buttons, i can only send that only one command and the stepper motors would not respond anymore. The commands are just basically text gcode commands. Anybody got any idea what i might have missed? Or maybe im doing something wrong. Thanks in advance.
I have just tested the program and learned that even after sending commands thru the lvgl GUI, sending commands thru a serial terminal still makes the motors move.
Codes sent to the machine are actually just text strings. Above code should result to something like “G90G21X-12.5F250”. No spaces in between. so i am thinking that there is something wrong with my text string. its’ termination or something else.
have a nice weekend.
ps. after posting my project on a number of fb groups, i got lots of inquiry what driver or library i used. of course i told them about littlevgl. hope they try this soon.
strcpy and strcat are C functions, not LittlevGL functions. Have you tried using a debugger to see the contents of the GCode buffer after calling each function? That should lead you to the problem quickly.
sprintf is an awesome function for creating a string with variable input(s). The %s tags you see in there are just like you’d use in a printf statement and represent a character string. Note that this will only work if they are terminated with \0 characters (e.g., travelDist should contain ‘12.5\0’).
You also need to be certain that GCode has enough room to hold the entire ‘string’ or you may receive a segfault or other undesired behavior.