mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-01 18:32:37 +02:00
Change input client index to avoid overflow
This commit replaces PR 221, that got out of sync.
This commit is contained in:
@@ -35,7 +35,7 @@ ESPResponseStream::ESPResponseStream(WebServer * webserver){
|
||||
#endif
|
||||
|
||||
ESPResponseStream::ESPResponseStream(){
|
||||
_client = CLIENT_NONE;
|
||||
_client = CLIENT_INPUT;
|
||||
#if defined (ENABLE_HTTP) && defined(ENABLE_WIFI)
|
||||
_header_sent=false;
|
||||
_webserver = NULL;
|
||||
@@ -72,7 +72,7 @@ String ESPResponseStream::formatBytes (uint64_t bytes)
|
||||
}
|
||||
|
||||
void ESPResponseStream::print(const char *data){
|
||||
if (_client == CLIENT_NONE) return;
|
||||
if (_client == CLIENT_INPUT) return;
|
||||
#if defined (ENABLE_HTTP) && defined(ENABLE_WIFI)
|
||||
if (_webserver) {
|
||||
if (!_header_sent) {
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
// Grbl versioning system
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#define GRBL_VERSION_BUILD "20191018"
|
||||
#define GRBL_VERSION_BUILD "20191022"
|
||||
|
||||
//#include <sdkconfig.h>
|
||||
#include <Arduino.h>
|
||||
|
@@ -53,7 +53,7 @@
|
||||
// this is a generic send function that everything should use, so interfaces could be added (Bluetooth, etc)
|
||||
void grbl_send(uint8_t client, const char *text)
|
||||
{
|
||||
if (client == CLIENT_NONE) return;
|
||||
if (client == CLIENT_INPUT) return;
|
||||
#ifdef ENABLE_BLUETOOTH
|
||||
if (SerialBT.hasClient() && ( client == CLIENT_BT || client == CLIENT_ALL ) )
|
||||
{
|
||||
@@ -81,7 +81,7 @@ void grbl_send(uint8_t client, const char *text)
|
||||
// This is a formating version of the grbl_send(CLIENT_ALL,...) function that work like printf
|
||||
void grbl_sendf(uint8_t client, const char *format, ...)
|
||||
{
|
||||
if (client == CLIENT_NONE) return;
|
||||
if (client == CLIENT_INPUT) return;
|
||||
char loc_buf[64];
|
||||
char * temp = loc_buf;
|
||||
va_list arg;
|
||||
|
@@ -99,13 +99,13 @@
|
||||
#define MESSAGE_SLEEP_MODE 11
|
||||
#define MESSAGE_SD_FILE_QUIT 60 // mc_reset was called during an SD job
|
||||
|
||||
#define CLIENT_NONE 0
|
||||
#define CLIENT_SERIAL 1
|
||||
#define CLIENT_SERIAL 1
|
||||
#define CLIENT_BT 2
|
||||
#define CLIENT_WEBUI 3
|
||||
#define CLIENT_TELNET 4
|
||||
#define CLIENT_INPUT 5
|
||||
#define CLIENT_ALL 0xFF
|
||||
#define CLIENT_COUNT 5 // total number of client types regardless if they are used
|
||||
#define CLIENT_COUNT 5 // total number of client types regardless if they are used
|
||||
|
||||
// functions to send data to the user.
|
||||
void grbl_send(uint8_t client, const char *text);
|
||||
|
@@ -89,7 +89,7 @@ void serialCheckTask(void *pvParameters)
|
||||
data = Serial.read();
|
||||
}
|
||||
else if (inputBuffer.available()){
|
||||
client = CLIENT_NONE;
|
||||
client = CLIENT_INPUT;
|
||||
data = inputBuffer.read();
|
||||
}
|
||||
else
|
||||
@@ -228,7 +228,7 @@ void serialCheck()
|
||||
}
|
||||
else if (inputBuffer.available())
|
||||
{
|
||||
client = CLIENT_NONE;
|
||||
client = CLIENT_INPUT;
|
||||
data = inputBuffer.read();
|
||||
}
|
||||
#if defined (ENABLE_BLUETOOTH) || (defined (ENABLE_WIFI) && defined(ENABLE_HTTP) && defined(ENABLE_SERIAL2SOCKET_IN))
|
||||
|
Reference in New Issue
Block a user