use of DoubleSerial
Hi,
during machine setup i want to do some manual control (for example x/y/z moves to find workpiece).
is there a possibility to use bluetooth input while serial input is connected to Repetier Host on computer ?
so repetier host is communicating, i think that´s the problem for me.
is there a possibility to switch over from serial to bluetooth (serial1) by a command and back again by another command?
thanks for any thoughts
RAyWB
during machine setup i want to do some manual control (for example x/y/z moves to find workpiece).
is there a possibility to use bluetooth input while serial input is connected to Repetier Host on computer ?
so repetier host is communicating, i think that´s the problem for me.
is there a possibility to switch over from serial to bluetooth (serial1) by a command and back again by another command?
thanks for any thoughts
RAyWB
Comments
seems to work so far when i use ascii protocol for both.(i still use firmware 92.9).
when using repetier protocol for repetier host and sending ascii via bluetooth i get checksum error message.
think that´s solved in actual firmware so i´ll switch over soon
sometimes i get " resend" with a line number... it´s getting better when i switch the checking for extruder/bed temperatur
off in repetier host.
do you know a way to manage this? maybe i can check for others than the "wait" also.
As i sometimes loose some bits on communication I´ll try to check for "OK" also. is there a "Dummy proof" way to catch all
communication errors?
workpiece coordinates for milling.
from principal it´s ok to have buttons on the machine to move toolhead and do some other settings.
but after milling some parts there are a lot of shavings around , so you have to clean the buttons etc.
anyway you can spend a lot of money for good buttons or membrane switches which are not affected by
that shavings.
having Computer close to the machine resulted in a damaged Laptop keyboard (by aluminum shavings)
so for me there is a need to act .
i have to keep computer away from machine for more than 3 meters(that´s the distance most of shavings reach)
and that´s the problem when adjusting workpiece offset
the idea goes to use low cost touch-display(which is easy to clean) instead of the switches.
i use a 12€ 3.95inch Display on a Uno clone with HC05 Bluetooth Sender , so monetary effort is <25 € for that
i can send any command with that, make any number of buttons on several pages
for example:
another possibility to avoid the communication problems would be to use that touch"terminal" as I2C slave .
so i can add a switch/case in UI and act commands in UI ...
I´m also thinking about that so it´s not a must to have it wireless I just need a cleanable terminal.
hope it helps you to understand my intension
something like
in config.h:
# define Terminal Serial2
# define TerminalBaud 38400
in hal.cpp
add to hwsetup()
Terminal.begin(TerminalBaud);
and for example read the terminal until\n during uidisplay slow action
and execute via GCode::executeFString
think that´s the easiest to solve.will try that first
i use this code:
while (BT.available()&!stringComplete)
{
char inChar = (char)BT.read();
inputString += inChar;
if (inChar == '\n') {
stringComplete = true;
}
}
if (stringComplete)
{
GCode::executeFString(inputString);
inputString = "";
stringComplete = false;
}
#endif
but GCode::executeFString(inputString) gives error message:
no matching function for call to 'GCode::executeFString(String&)'
can you please point me a way?
using fix commands and call them by number via switch/case in ui or a duplicate of parse commands as you wrote before
added following code:(whats a copy of executeFString)
void GCode::executeString(String Kommando)
{
char buf[80];
uint8_t buflen;
char c;
GCode code;
do
{
// Wait for a free place in command buffer
// Scan next command from string
uint8_t comment = 0;
buflen = 0;
do
{
c = Kommando.charAt(buflen);
if(c == 0 || c == '\n') break;
if(c == ';') comment = 1;
if(comment) continue;
buf[buflen++] = c;
}
while(buflen < 79);
if(buflen == 0) // empty line ignore
continue;
buf[buflen] = 0;
// Send command into command buffer
if(code.parseAscii((char *)buf,false));// && (code.params & 518)) // Success
{
#ifdef DEBUG_PRINT
debugWaitLoop = 7;
#endif
Commands::executeGCode(&code);
Printer::defaultLoopActions();
}
}
while(c);
}
and even if i use it like for example GCode::executeString("G1 X100\n") it most of the time fills up command buffer completely and also blocks executing commands from repetier host.
can you please tell me where the trap is?
#if(FEATURE_BTCONTROLLER== true)
while(BT.available())
{
// get the new byte:
char inChar =(char)BT.read(); //(char)BT.read();
inputString += inChar;
//BT.println(inputString); //for debug
if (inChar=='\n')
{fertig=true;
break;
}
}
#endif
if(fertig)
{
BT.println(inputString); // for debug only to show string arrives correct, what it does
GCode::executeString(inputString);
// GCode::executeFString("M117 inputString");
BT.println("x\n"+inputString+" 2"); // for debug only
inputString="";
fertig=false;
BT.println(inputString); // for debug only
BT.println("OK"); // for debug only
}
if i send M117 inputString and use the GCode::executeString from above post green lines are not executed,seems it points to nirwana...
when use the GCode::executeFstring("M117 inputString") green lines are executed.
Both functions show "inputString" on display
{
GCode code;
// Send command into command buffer
if(code.parseAscii((char *)buf,false));// && (code.params & 518)) // Success
{
#ifdef DEBUG_PRINT
debugWaitLoop = 7;
#endif
Commands::executeGCode(&code);
Printer::defaultLoopActions();
}
}
do you mean the \n at end
or
replacing \n by \0(what i actually did)?
what´s the difference?
anyway ,it works fine now :-) thanks a lot!!
maybe you should think about implementing that function , that would enable
some possibilities for users to work with variables in UI.
but if you find the time, can you please explain why
"(don't use buflen as index to Kommando)"
as it seems seems i got some lousy bluetooth modules loosig data...(i use baudrate 38400) i tested the stuff with
direct connection via Serial1 up to 115200 baud and everything works well with no errors.
As i also have some multi-line commands I switched over to a modified copy of GCode::readFromSerial now for my
"terminal" what enables me to get acknowledge and request a resend also.