This commit is contained in:
Anders Sandstrom
2022-01-20 16:55:06 +01:00
parent 002221ccf1
commit e2de2fb0a8
5 changed files with 33818 additions and 27016 deletions

View File

@@ -225,13 +225,14 @@ void ecmcGrbl::doWriteWorker() {
grblCommandBuffer_.pop();
epicsMutexUnlock(grblCommandBufferMutex_);
printf("%s:%s:%d: Command length %d!!!\n",__FILE__,__FUNCTION__,__LINE__,strlen(command.c_str()));
printf("%s:%s:%d: Used bytes %d!!!\n",__FILE__,__FUNCTION__,__LINE__,serial_get_rx_buffer_available());
printf("%s:%s:%d: Available bytes %d!!!\n",__FILE__,__FUNCTION__,__LINE__,serial_get_rx_buffer_available());
// wait for grbl
while(RX_BUFFER_SIZE-serial_get_rx_buffer_available()<=strlen(command.c_str())) {
delay_ms(1);
ecmc_write_command_serial(strdup(command.c_str()));
while(serial_get_rx_buffer_available()<=strlen(command.c_str())) {
delay_ms(2);
}
printf("%s:%s:%d: Writing!!\n",__FILE__,__FUNCTION__,__LINE__);
ecmc_write_command_serial(strdup(command.c_str()));
}
else {
delay_ms(5);

View File

@@ -64,6 +64,7 @@ class ecmcGrbl : public asynPortDriver {
int grblInitDone_;
std::queue<std::string> grblCommandBuffer_;
epicsMutexId grblCommandBufferMutex_;
bool firstCommandWritten_;
};
#endif /* ECMC_GRBL_H_ */

View File

@@ -25,16 +25,16 @@
#define TX_RING_BUFFER (TX_BUFFER_SIZE+1)
uint8_t serial_rx_buffer[RX_RING_BUFFER];
uint8_t serial_rx_buffer_head = 0;
uint16_t serial_rx_buffer_head = 0;
volatile uint8_t serial_rx_buffer_tail = 0;
uint8_t serial_tx_buffer[TX_RING_BUFFER];
uint8_t serial_tx_buffer_head = 0;
volatile uint8_t serial_tx_buffer_tail = 0;
uint16_t serial_tx_buffer_head = 0;
volatile uint16_t serial_tx_buffer_tail = 0;
// Returns the number of bytes available in the RX serial buffer.
uint8_t serial_get_rx_buffer_available()
uint16_t serial_get_rx_buffer_available()
{
//printf("%s:%s:%d:\n",__FILE__,__FUNCTION__,__LINE__);
uint8_t rtail = serial_rx_buffer_tail; // Copy to limit multiple calls to volatile

View File

@@ -56,7 +56,7 @@ uint8_t serial_read();
void serial_reset_read_buffer();
// Returns the number of bytes available in the RX serial buffer.
uint8_t serial_get_rx_buffer_available();
uint16_t serial_get_rx_buffer_available();
// Returns the number of bytes used in the RX serial buffer.
// NOTE: Deprecated. Not used unless classic status reports are enabled in config.h.

File diff suppressed because it is too large Load Diff