|
@@ -41,7 +41,7 @@ bool bTaskAutoFlowCreated = false;
|
|
|
bool flowisrunning = false;
|
|
bool flowisrunning = false;
|
|
|
|
|
|
|
|
long auto_interval = 0;
|
|
long auto_interval = 0;
|
|
|
-bool auto_isrunning = false;
|
|
|
|
|
|
|
+bool autostartIsEnabled = false;
|
|
|
|
|
|
|
|
int countRounds = 0;
|
|
int countRounds = 0;
|
|
|
bool isPlannedReboot = false;
|
|
bool isPlannedReboot = false;
|
|
@@ -257,7 +257,7 @@ esp_err_t handler_flow_start(httpd_req_t *req) {
|
|
|
|
|
|
|
|
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
|
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
|
|
|
|
|
|
|
- if (auto_isrunning) {
|
|
|
|
|
|
|
+ if (autostartIsEnabled) {
|
|
|
xTaskAbortDelay(xHandletask_autodoFlow); // Delay will be aborted if task is in blocked (waiting) state. If task is already running, no action
|
|
xTaskAbortDelay(xHandletask_autodoFlow); // Delay will be aborted if task is in blocked (waiting) state. If task is already running, no action
|
|
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Flow start triggered by REST API /flow_start");
|
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Flow start triggered by REST API /flow_start");
|
|
|
const char* resp_str = "The flow is going to be started immediately or is already running";
|
|
const char* resp_str = "The flow is going to be started immediately or is already running";
|
|
@@ -286,7 +286,7 @@ esp_err_t MQTTCtrlFlowStart(std::string _topic) {
|
|
|
|
|
|
|
|
ESP_LOGD(TAG, "MQTTCtrlFlowStart: topic %s", _topic.c_str());
|
|
ESP_LOGD(TAG, "MQTTCtrlFlowStart: topic %s", _topic.c_str());
|
|
|
|
|
|
|
|
- if (auto_isrunning)
|
|
|
|
|
|
|
+ if (autostartIsEnabled)
|
|
|
{
|
|
{
|
|
|
xTaskAbortDelay(xHandletask_autodoFlow); // Delay will be aborted if task is in blocked (waiting) state. If task is already running, no action
|
|
xTaskAbortDelay(xHandletask_autodoFlow); // Delay will be aborted if task is in blocked (waiting) state. If task is already running, no action
|
|
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Flow start triggered by MQTT topic " + _topic);
|
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Flow start triggered by MQTT topic " + _topic);
|
|
@@ -657,7 +657,14 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|
|
|
|
|
|
|
string out2 = out.substr(0, out.length() - 4) + "_org.jpg";
|
|
string out2 = out.substr(0, out.length() - 4) + "_org.jpg";
|
|
|
|
|
|
|
|
- if ((*flowctrl.getActStatus() == "Flow finished") && psram_init_shared_memory_for_take_image_step()) {
|
|
|
|
|
|
|
+ std::string state = *flowctrl.getActStatus();
|
|
|
|
|
+
|
|
|
|
|
+ /* To be able to provide the image, several conditions must be met due to the shared PSRAM usage:
|
|
|
|
|
+ - Ether the round most be completed or not started yet
|
|
|
|
|
+ - Or we must be in Setup Mode
|
|
|
|
|
+ - Additionally, the initialization of the shared PSRAM must be successful */
|
|
|
|
|
+ if (((state == "Flow finished") || (state == "Initialization") || (state == "Initialization (delayed)") || isSetupModusActive()) &&
|
|
|
|
|
+ psram_init_shared_memory_for_take_image_step()) {
|
|
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Taking image for Alignment Mark Update...");
|
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Taking image for Alignment Mark Update...");
|
|
|
|
|
|
|
|
CAlignAndCutImage *caic = new CAlignAndCutImage("cutref", in);
|
|
CAlignAndCutImage *caic = new CAlignAndCutImage("cutref", in);
|
|
@@ -679,7 +686,8 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|
|
zw = "CutImage Done";
|
|
zw = "CutImage Done";
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Taking image for Alignment Mark not possible while device is busy with a round!");
|
|
|
|
|
|
|
+ LogFile.WriteToFile(ESP_LOG_WARN, TAG, std::string("Taking image for Alignment Mark not possible while device") +
|
|
|
|
|
+ " is busy with a round (Current State: '" + state + "')!");
|
|
|
zw = "Device Busy";
|
|
zw = "Device Busy";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -955,16 +963,25 @@ void task_autodoFlow(void *pvParameter)
|
|
|
ESP_LOGD(TAG, "task_autodoFlow: start");
|
|
ESP_LOGD(TAG, "task_autodoFlow: start");
|
|
|
doInit();
|
|
doInit();
|
|
|
|
|
|
|
|
- auto_isrunning = flowctrl.isAutoStart(auto_interval);
|
|
|
|
|
|
|
+ flowctrl.setAutoStartInterval(auto_interval);
|
|
|
|
|
+ autostartIsEnabled = flowctrl.getIsAutoStart();
|
|
|
|
|
|
|
|
if (isSetupModusActive())
|
|
if (isSetupModusActive())
|
|
|
{
|
|
{
|
|
|
- auto_isrunning = false;
|
|
|
|
|
|
|
+ LogFile.WriteToFile(ESP_LOG_INFO, TAG, "We are in Setup Mode -> Not starting Auto Flow!");
|
|
|
|
|
+ autostartIsEnabled = false;
|
|
|
std::string zw_time = getCurrentTimeString(LOGFILE_TIME_FORMAT);
|
|
std::string zw_time = getCurrentTimeString(LOGFILE_TIME_FORMAT);
|
|
|
flowctrl.doFlowTakeImageOnly(zw_time);
|
|
flowctrl.doFlowTakeImageOnly(zw_time);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (autostartIsEnabled) {
|
|
|
|
|
+ LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Starting Flow...");
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Autostart is not enabled -> Not starting Flow");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- while (auto_isrunning)
|
|
|
|
|
|
|
+ while (autostartIsEnabled)
|
|
|
{
|
|
{
|
|
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "----------------------------------------------------------------"); // Clear separation between runs
|
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "----------------------------------------------------------------"); // Clear separation between runs
|
|
|
std::string _zw = "Round #" + std::to_string(++countRounds) + " started";
|
|
std::string _zw = "Round #" + std::to_string(++countRounds) + " started";
|
|
@@ -1038,7 +1055,7 @@ void task_autodoFlow(void *pvParameter)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-void StartMainFlowTask()
|
|
|
|
|
|
|
+void InitializeFlowTask()
|
|
|
{
|
|
{
|
|
|
BaseType_t xReturned;
|
|
BaseType_t xReturned;
|
|
|
|
|
|