-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
404 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* EEZ Modular Firmware | ||
* Copyright (C) 2021-present, Envox d.o.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <math.h> | ||
|
||
#include <eez/alloc.h> | ||
#include <eez/system.h> | ||
#include <eez/scripting/scripting.h> | ||
|
||
#include <eez/flow/components.h> | ||
#include <eez/flow/flow_defs_v3.h> | ||
#include <eez/flow/queue.h> | ||
|
||
using namespace eez::gui; | ||
|
||
namespace eez { | ||
namespace flow { | ||
|
||
void executeLogComponent(Assets *assets, FlowState *flowState, Component *component, ComponenentExecutionState *&componentExecutionState) { | ||
auto propertyValue = component->propertyValues.item(assets, defs_v3::LOG_ACTION_COMPONENT_PROPERTY_VALUE); | ||
|
||
Value value; | ||
if (!evalExpression(assets, flowState, propertyValue->evalInstructions, value)) { | ||
throwError("log component value eval error\n"); | ||
return; | ||
} | ||
|
||
const char *valueStr = value.toString(assets); | ||
if (valueStr && *valueStr) { | ||
DebugTrace(valueStr); | ||
if (valueStr[strlen(valueStr) - 1] != '\n') { | ||
DebugTrace("\n"); | ||
} | ||
} | ||
} | ||
|
||
} // namespace flow | ||
} // namespace eez |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* EEZ Modular Firmware | ||
* Copyright (C) 2021-present, Envox d.o.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <math.h> | ||
|
||
#include <eez/alloc.h> | ||
#include <eez/system.h> | ||
#include <eez/scripting/scripting.h> | ||
|
||
#include <eez/flow/components.h> | ||
#include <eez/flow/flow_defs_v3.h> | ||
#include <eez/flow/queue.h> | ||
|
||
using namespace eez::gui; | ||
|
||
namespace eez { | ||
namespace flow { | ||
|
||
void executeSwitchComponent(Assets *assets, FlowState *flowState, Component *component, ComponenentExecutionState *&componentExecutionState) { | ||
struct SwitchTest { | ||
uint16_t outputIndex; | ||
uint8_t conditionInstructions[1]; | ||
}; | ||
|
||
struct SwitchActionComponent : public Component { | ||
ListOfAssetsPtr<SwitchTest> tests; | ||
}; | ||
|
||
auto switchActionComponent = (SwitchActionComponent *)component; | ||
|
||
for (uint32_t testIndex = 0; testIndex < switchActionComponent->tests.count; testIndex++) { | ||
auto test = switchActionComponent->tests.item(assets, testIndex); | ||
|
||
Value conditionValue; | ||
if (!evalExpression(assets, flowState, test->conditionInstructions, conditionValue)) { | ||
throwError("switch component eval src expression\n"); | ||
return; | ||
} | ||
|
||
if (conditionValue.getBoolean()) { | ||
auto flowDefinition = assets->flowDefinition.ptr(assets); | ||
auto &nullValue = *flowDefinition->constants.item(assets, NULL_VALUE_INDEX); | ||
auto &componentOutput = *component->outputs.item(assets, test->outputIndex); | ||
propagateValue(assets, flowState, componentOutput, nullValue); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
} // namespace flow | ||
} // namespace eez |
Oops, something went wrong.