mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 20:09:14 +03:00
optimization
This commit is contained in:
@@ -33,13 +33,12 @@ class Scenario {
|
|||||||
void calculate1() {
|
void calculate1() {
|
||||||
_scenBlok = selectToMarker(_scenarioTmp, "end\n");
|
_scenBlok = selectToMarker(_scenarioTmp, "end\n");
|
||||||
_condition = selectToMarker(_scenBlok, "\n");
|
_condition = selectToMarker(_scenBlok, "\n");
|
||||||
_conditionParam = selectFromMarkerToMarker(_condition, " ", 0);
|
|
||||||
_eventParam = selectToMarker(eventBuf, ",");
|
_eventParam = selectToMarker(eventBuf, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isIncommingEventInScenario() {
|
bool isIncommingEventInScenario() {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (_conditionParam == _eventParam) {
|
if (_condition.indexOf(_eventParam) != -1) {
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -49,6 +48,8 @@ class Scenario {
|
|||||||
_scenarioTmp += "\n";
|
_scenarioTmp += "\n";
|
||||||
_scenarioTmp.replace("\r\n", "\n");
|
_scenarioTmp.replace("\r\n", "\n");
|
||||||
_scenarioTmp.replace("\r", "\n");
|
_scenarioTmp.replace("\r", "\n");
|
||||||
|
|
||||||
|
_conditionParam = selectFromMarkerToMarker(_condition, " ", 0);
|
||||||
_conditionSign = selectFromMarkerToMarker(_condition, " ", 1);
|
_conditionSign = selectFromMarkerToMarker(_condition, " ", 1);
|
||||||
_conditionValue = selectFromMarkerToMarker(_condition, " ", 2);
|
_conditionValue = selectFromMarkerToMarker(_condition, " ", 2);
|
||||||
if (!isDigitStr(_conditionValue)) _conditionValue = jsonReadStr(configLiveJson, _conditionValue);
|
if (!isDigitStr(_conditionValue)) _conditionValue = jsonReadStr(configLiveJson, _conditionValue);
|
||||||
|
|||||||
17
src/main.cpp
17
src/main.cpp
@@ -86,6 +86,23 @@ void setup() {
|
|||||||
|
|
||||||
just_load = false;
|
just_load = false;
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
|
String buf = "Geeks-for-Geeks";
|
||||||
|
int buf_len = buf.length() + 1;
|
||||||
|
char char_array[buf_len];
|
||||||
|
buf.toCharArray(char_array, buf_len);
|
||||||
|
char* token = strtok(char_array, "-");
|
||||||
|
while (token != NULL) {
|
||||||
|
printf("%s\n", token);
|
||||||
|
token = strtok(NULL, "-");
|
||||||
|
}
|
||||||
|
|
||||||
|
//char str[] = "Geeks for Geeks";
|
||||||
|
//char* token;
|
||||||
|
//char* rest = str;
|
||||||
|
//while ((token = strtok_r(rest, " ", &rest))) {
|
||||||
|
// printf("%s\n", token);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user