File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ extern int bebopr_pre_init( void);
15
15
// Configuration
16
16
17
17
extern int config_e_axis_is_always_relative ( void );
18
+ extern char config_keep_alive_char ( void );
18
19
19
20
// determines stepper driver control
20
21
extern int config_use_pololu_drivers ( void );
Original file line number Diff line number Diff line change @@ -324,3 +324,16 @@ int config_e_axis_is_always_relative( void)
324
324
{
325
325
return 0 ;
326
326
}
327
+
328
+ /*
329
+ * Specify the character code that should be used for keep-alive messages.
330
+ * This character should not disturb the communication.
331
+ * Pronterface seems to accept most characters, but only a newline
332
+ * does not disturb the program.
333
+ * Repsnapper also accepts the newline without causing problems.
334
+ */
335
+ char config_keep_alive_char ( void )
336
+ {
337
+ return '\n' ;
338
+ }
339
+
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ static void* comm_thread( void* arg)
63
63
char pending_input ;
64
64
char pending_output ;
65
65
int prescaler = 0 ;
66
+ char keep_alive_char = config_keep_alive_char ();
66
67
/*
67
68
* The data from the stdout pipe does not become available until
68
69
* stdout is flushed. So the timer is set to a short cycle that
@@ -83,7 +84,7 @@ static void* comm_thread( void* arg)
83
84
} else if (rc == 0 || (rc < 0 && errno == EINTR )) {
84
85
// timeout, send dummy character to keep connection alive
85
86
if (++ prescaler > keep_alive_timeout / timeout ) {
86
- printf ( "%c" , 10 ); // only safe code for pronterface !
87
+ printf ( "%c" , keep_alive_char );
87
88
fprintf ( stderr , "<KEEP ALIVE SENT>" );
88
89
prescaler = 0 ;
89
90
}
You can’t perform that action at this time.
0 commit comments