mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-11 22:16:56 +03:00
Esp32s3 test (#3836)
* Added ethernet functionality * change smart leds to GPIO47 for now * Make etherenet code specific for the esp32-s3 board * Add 'sleep if idle' option for sleeping between rounds and change IO47 to IO12 for LED * minor fix, remove space * minor fix, add space * remove space
This commit is contained in:
@@ -230,6 +230,10 @@ void ClassFlowControll::setAutoStartInterval(long &_interval)
|
||||
_interval = AutoInterval * 60 * 1000; // AutoInterval: minutes -> ms
|
||||
}
|
||||
|
||||
void ClassFlowControll::setSleepWhileIdle(bool& _sleepwhileidle){
|
||||
_sleepwhileidle = SleepWhileIdle;
|
||||
}
|
||||
|
||||
ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
||||
{
|
||||
ClassFlow* cfc = NULL;
|
||||
@@ -575,6 +579,10 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
}
|
||||
}
|
||||
|
||||
if ((toUpper(splitted[0]) == "SLEEPWHILEIDLE") && (splitted.size() > 1)) {
|
||||
SleepWhileIdle = alphanumericToBoolean(splitted[1]);
|
||||
}
|
||||
|
||||
if ((toUpper(splitted[0]) == "DATALOGACTIVE") && (splitted.size() > 1)) {
|
||||
LogFile.SetDataLogToSD(alphanumericToBoolean(splitted[1]));
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ protected:
|
||||
|
||||
bool AutoStart;
|
||||
float AutoInterval;
|
||||
bool SleepWhileIdle;
|
||||
void SetInitialParameter(void);
|
||||
std::string aktstatusWithTime;
|
||||
std::string aktstatus;
|
||||
@@ -72,6 +73,7 @@ public:
|
||||
|
||||
bool getIsAutoStart();
|
||||
void setAutoStartInterval(long &_interval);
|
||||
void setSleepWhileIdle(bool& _sleepwhileidle);
|
||||
|
||||
std::string* getActStatusWithTime();
|
||||
std::string* getActStatus();
|
||||
|
||||
@@ -43,6 +43,7 @@ bool bTaskAutoFlowCreated = false;
|
||||
bool flowisrunning = false;
|
||||
|
||||
long auto_interval = 0;
|
||||
bool sleep_while_idle = false;
|
||||
bool autostartIsEnabled = false;
|
||||
|
||||
int countRounds = 0;
|
||||
@@ -1659,6 +1660,7 @@ void task_autodoFlow(void *pvParameter)
|
||||
doInit();
|
||||
|
||||
flowctrl.setAutoStartInterval(auto_interval);
|
||||
flowctrl.setSleepWhileIdle(sleep_while_idle);
|
||||
autostartIsEnabled = flowctrl.getIsAutoStart();
|
||||
|
||||
if (isSetupModusActive())
|
||||
@@ -1739,9 +1741,20 @@ void task_autodoFlow(void *pvParameter)
|
||||
|
||||
if (auto_interval > fr_delta_ms)
|
||||
{
|
||||
const TickType_t xDelay = (auto_interval - fr_delta_ms) / portTICK_PERIOD_MS;
|
||||
ESP_LOGD(TAG, "Autoflow: sleep for: %ldms", (long)xDelay);
|
||||
vTaskDelay(xDelay);
|
||||
if(sleep_while_idle){
|
||||
vTaskDelay(10000 / portTICK_PERIOD_MS);//A little more time so the user can finish config
|
||||
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
|
||||
if (auto_interval > fr_delta_ms){
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Deep sleep for " + std::to_string(auto_interval - fr_delta_ms));
|
||||
|
||||
esp_sleep_enable_timer_wakeup((auto_interval - fr_delta_ms) * 1000); // Time in microseconds
|
||||
esp_deep_sleep_start();
|
||||
}
|
||||
}else{
|
||||
const TickType_t xDelay = (auto_interval - fr_delta_ms) / portTICK_PERIOD_MS;
|
||||
ESP_LOGD(TAG, "Autoflow: sleep for: %ldms", (long)xDelay);
|
||||
vTaskDelay(xDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@
|
||||
#define CAM_PIN_D7 GPIO_NUM_16
|
||||
#define CAM_PIN_D6 GPIO_NUM_17
|
||||
#define CAM_PIN_D5 GPIO_NUM_18
|
||||
#define CAM_PIN_D4 GPIO_NUM_12
|
||||
#define CAM_PIN_D4 GPIO_NUM_47
|
||||
#define CAM_PIN_D3 GPIO_NUM_10
|
||||
#define CAM_PIN_D2 GPIO_NUM_8
|
||||
#define CAM_PIN_D1 GPIO_NUM_9
|
||||
|
||||
Reference in New Issue
Block a user