#include "KMotionDef.h"
#include "InitConfig.c"
#include "MPGWatch.c"
#ifndef TMP
#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
#endif
MPGWatch.c calls DoPCFloat before KflopToKMotionCNCFunctions.c has been included.
The standard TCC67 compiler is very fast but not great at giving warnings. If you check the TI Compiler (right click) it will flag these errors. It reports:
"C:\KMotion435h\C Programs\MPG_test\MPGWatch.c", line 113: warning: missing return statement at end of non-void function "EvaluateSelectedAxis" "C:\KMotion435h\C Programs\MPG_test\MPGWatch.c", line 143: warning: function declared implicitly
"C:\KMotion435h\C Programs\MPG_test\MPGWatch.c", line 120: warning: variable "LastUpdateEncoder" was declared but never referenced
"C:\KMotion435h\C Programs\MPG_test\MPGWatch.c", line 164: warning: function declared implicitly
"C:\KMotion435h\C Programs\MPG_test\MPGWatch.c", line 246: warning: last line of file ends without a newline "C:\KMotion435h\C Programs\KflopToKMotionCNCFunctions.c", line 4: error: declaration is incompatible with previous "DoPCFloat" (declared at line 143 of "C:\KMotion435h\C Programs\MPG_test\MPGWatch.c")
"C:\KMotion435h\C Programs\MPG_test\InitConfigButtonAction.c", line 23: warning: last line of file ends without a newline
1 error detected in the compilation of "C:\KMotion435h\C Programs\MPG_test\InitConfigButtonAction.c".
Tom, I tried to use the incremental mode to set FRO and RRO intending to have some sync with the values commanded by the UI, but I got an issue when commanding the multiplier to a value less than 0.1.
I thought that KMotionCNC would block the value, but what happens is that it lets the value go less than the limit, and when I try to raise the number again it blocks stating that the value should be greater than 0.1.
To be able to command the values again via the MPG controller I needed to change the multiplier via the UI.
That being said, is it possible to keep track of the multipliers (FRO and RRO) written in the UI, so that I can block the command via code when reaching near that limit?
Or, do you see any other alternative to synchronize the values commanded via MPG and the values coming from the UI?
The current code that handles the MPG is attached. BasicServiceMPG() is called in the infinite loop from the init program. ChangeFROAndRRO() is the function to handle the incremental set of FRO and RRO. I am using version 4.35h from KMotionCNC.
Find attached my source files. InitConfigButtonAction.c contains the program that runs when the Init button is pressed, and MPGWatch.c contains MPG related code.
CS0_LastFRO and CS0_LastRapidFRO can be used as the last commanded Hardware FROs. The code below seems to work for preventing below 0.1. But I don't have a proper solution for above 1.0. Do you wish to allow FRO or RRO above 1.0? If no you could also limit changes above 1.0. Do you wish to use Software FRO?
Thanks for the response. I'll try it on my machine using these variables you mentioned to keep track of FRO and RRO, also adding a limit in the positive end at 1.0.
I'm not sure about the difference between software and hardware FRO. My intent is to have sync between UI, and MPG FRO and RRO commands.