mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 04:49:01 +08:00
parent
4a20cc01f4
commit
e471be57a6
@ -26,6 +26,7 @@
|
||||
#if defined(ESP_SAVE_SETTINGS)
|
||||
#include "esp3d_message.h"
|
||||
#include "esp3d_settings.h"
|
||||
#include "esp3d_string.h"
|
||||
|
||||
#if ESP_SAVE_SETTINGS == SETTINGS_IN_EEPROM
|
||||
#include <EEPROM.h>
|
||||
@ -386,7 +387,7 @@ bool ESP3DSettings::writeByte(int pos, const uint8_t value) {
|
||||
|
||||
bool ESP3DSettings::is_string(const char *s, uint len) {
|
||||
for (uint p = 0; p < len; p++) {
|
||||
if (!isPrintable(char(s[p]))) {
|
||||
if (!esp3d_string::isPrintableChar(char(s[p]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -431,7 +432,7 @@ const char *ESP3DSettings::readString(int pos, bool *haserror) {
|
||||
// read until max size is reached or \0 is found
|
||||
while (i < size_max && b != 0) {
|
||||
b = EEPROM.read(pos + i);
|
||||
byte_buffer[i] = isPrintable(char(b)) ? b : 0;
|
||||
byte_buffer[i] = esp3d_string::isPrintableChar(char(b)) ? b : 0;
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -778,7 +779,7 @@ bool ESP3DSettings::isValidStringSetting(const char *value,
|
||||
}
|
||||
// only printable char allowed
|
||||
for (size_t i = 0; i < strlen(value); i++) {
|
||||
if (!isPrintable(value[i])) {
|
||||
if (!esp3d_string::isPrintableChar(value[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -179,3 +179,11 @@ const char* esp3d_string::formatBytes(uint64_t bytes) {
|
||||
}
|
||||
return res.c_str();
|
||||
}
|
||||
|
||||
bool esp3d_string::isPrintableChar(char ch){
|
||||
int c = static_cast<int>(ch);
|
||||
if (c==9 || (c >= 32 && c <= 126) || c>=128) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
@ -27,6 +27,7 @@ const char* generateUUID(const char* seed);
|
||||
const char* getContentType(const char* filename);
|
||||
const char* encodeString(const char* s);
|
||||
const char* formatBytes(uint64_t bytes);
|
||||
bool isPrintableChar(char c);
|
||||
} // namespace esp3d_string
|
||||
|
||||
#endif //_ESP3D_STRING_H
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define _VERSION_ESP3D_H
|
||||
|
||||
// version and sources location
|
||||
#define FW_VERSION "3.0.0.a226"
|
||||
#define FW_VERSION "3.0.0.a227"
|
||||
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
|
||||
|
||||
#endif //_VERSION_ESP3D_H
|
||||
|
@ -25,6 +25,7 @@
|
||||
#ifdef BLUETOOTH_FEATURE
|
||||
#include "../../core/esp3d_commands.h"
|
||||
#include "../../core/esp3d_settings.h"
|
||||
#include "../../esp3d_string.h"
|
||||
#include "../network/netconfig.h"
|
||||
#include "BT_service.h"
|
||||
#include "BluetoothSerial.h"
|
||||
@ -215,7 +216,7 @@ void BTService::push2buffer(uint8_t *sbuf, size_t len) {
|
||||
_buffer_size++;
|
||||
}
|
||||
flushbuffer();
|
||||
} else if (isPrintable(char(sbuf[i]))) {
|
||||
} else if (esp3d_string::isPrintableChar(char(sbuf[i]))) {
|
||||
if (_buffer_size < ESP3D_BT_BUFFER_SIZE) {
|
||||
_buffer[_buffer_size] = sbuf[i];
|
||||
_buffer_size++;
|
||||
|
@ -23,6 +23,8 @@
|
||||
COMMUNICATION_PROTOCOL == RAW_SERIAL || defined(ESP_SERIAL_BRIDGE_OUTPUT)
|
||||
#include "../../core/esp3d_commands.h"
|
||||
#include "../../core/esp3d_settings.h"
|
||||
#include "../../core/esp3d_string.h"
|
||||
|
||||
#include "serial_service.h"
|
||||
|
||||
#if COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
@ -406,7 +408,7 @@ void ESP3DSerialService::push2buffer(uint8_t *sbuf, size_t len) {
|
||||
_buffer_size++;
|
||||
}
|
||||
flushbuffer();
|
||||
} else if (isPrintable(char(sbuf[i]))) {
|
||||
} else if (esp3d_string::isPrintableChar(char(sbuf[i]))) {
|
||||
if (_buffer_size < ESP3D_SERIAL_BUFFER_SIZE) {
|
||||
_buffer[_buffer_size] = sbuf[i];
|
||||
_buffer_size++;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "../../core/esp3d_commands.h"
|
||||
#include "../../core/esp3d_message.h"
|
||||
#include "../../core/esp3d_settings.h"
|
||||
#include "../../core/esp3d_string.h"
|
||||
#include "../../include/esp3d_version.h"
|
||||
#include "telnet_server.h"
|
||||
|
||||
@ -245,7 +246,7 @@ void Telnet_Server::push2buffer(uint8_t *sbuf, size_t len) {
|
||||
_buffer_size++;
|
||||
}
|
||||
flushbuffer();
|
||||
} else if (isPrintable(char(sbuf[i]))) {
|
||||
} else if (esp3d_string::isPrintableChar(char(sbuf[i]))) {
|
||||
if (_buffer_size < ESP3D_TELNET_BUFFER_SIZE) {
|
||||
_buffer[_buffer_size] = sbuf[i];
|
||||
_buffer_size++;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "../../core/esp3d_commands.h"
|
||||
#include "../../core/esp3d_message.h"
|
||||
#include "../../core/esp3d_settings.h"
|
||||
#include "../../core/esp3d_string.h"
|
||||
#include "../authentication/authentication_service.h"
|
||||
#include "websocket_server.h"
|
||||
|
||||
@ -288,7 +289,7 @@ void WebSocket_Server::push2RXbuffer(uint8_t *sbuf, size_t len) {
|
||||
_RXbufferSize++;
|
||||
}
|
||||
flushRXbuffer();
|
||||
} else if (isPrintable(char(sbuf[i]))) {
|
||||
} else if (esp3d_string::isPrintableChar(char(sbuf[i]))) {
|
||||
if (_RXbufferSize < RXBUFFERSIZE) {
|
||||
_RXbuffer[_RXbufferSize] = sbuf[i];
|
||||
_RXbufferSize++;
|
||||
|
@ -271,3 +271,28 @@ upload_speed = 115200
|
||||
extra_scripts = pre:platformIO/extra_script.py
|
||||
lib_ignore =
|
||||
ESP32SSPD
|
||||
|
||||
[env:esp8285]
|
||||
platform = espressif8266@4.1.0
|
||||
board = esp8285
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
monitor_echo = yes
|
||||
monitor_filters = send_on_enter, colorize, esp8266_exception_decoder
|
||||
; set frequency to 160MHz
|
||||
board_build.f_cpu = 160000000L
|
||||
; set frequency to 40MHz
|
||||
board_build.f_flash = 40000000L
|
||||
board_build.flash_mode = dout
|
||||
upload_resetmethod = ck
|
||||
board_build.ldscript = eagle.flash.1m256.ld
|
||||
build_flags =
|
||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
-DNONOSDK221=1
|
||||
-DNDEBUG
|
||||
-DVTABLES_IN_FLASH
|
||||
-DWAVEFORM_LOCKED_PWM
|
||||
upload_speed = 115200
|
||||
extra_scripts = pre:platformIO/extra_script.py
|
||||
lib_ignore =
|
||||
ESP32SSPD
|
||||
|
Loading…
x
Reference in New Issue
Block a user