Magic strings removal

This commit is contained in:
Anton Viktorov
2017-02-17 13:31:47 +03:00
parent 912e4c69a8
commit b1bf4316dc
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -71,7 +71,9 @@ void Can232::serialEvent() {
}
void Can232::initFunc() {
inputString.reserve(200);
if (!inputString.reserve(INPUT_STRING_BUFFER_SIZE)) {
dbg0("inputString.reserve failed in initFunc. less optimal String work is expected");
}
// lw232AutoStart = true; //todo: read from eeprom
// lw232AutoPoll = false; //todo: read from eeprom
// lw232TimeStamp = //read from eeprom
@@ -90,7 +92,7 @@ void Can232::setFilterFunc(INT8U (*userFunc)(INT32U)) {
void Can232::loopFunc() {
if (stringComplete) {
int len = inputString.length();
if (len > 0 && len < 29) {
if (len > 0 && len < LW232_FRAME_MAX_SIZE) {
strcpy((char*)lw232Message, inputString.c_str());
exec();
}
+2
View File
@@ -117,6 +117,8 @@
#define LW232_FRAME_MAX_LENGTH 0x08
#define LW232_FRAME_MAX_SIZE (sizeof("Tiiiiiiiildddddddddddddddd\r")+1)
#define LW232_INPUT_STRING_BUFFER_SIZE 200
#define LW232_OFF '0'
#define LW232_ON_ONE '1'
#define LW232_ON_TWO '2'