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:
allexoK
2025-08-26 20:38:28 +02:00
committed by GitHub
parent 149bbdc553
commit 247f7ee8e2
6 changed files with 187 additions and 149 deletions

View File

@@ -230,6 +230,10 @@ void ClassFlowControll::setAutoStartInterval(long &_interval)
_interval = AutoInterval * 60 * 1000; // AutoInterval: minutes -> ms _interval = AutoInterval * 60 * 1000; // AutoInterval: minutes -> ms
} }
void ClassFlowControll::setSleepWhileIdle(bool& _sleepwhileidle){
_sleepwhileidle = SleepWhileIdle;
}
ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type) ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
{ {
ClassFlow* cfc = NULL; 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)) { if ((toUpper(splitted[0]) == "DATALOGACTIVE") && (splitted.size() > 1)) {
LogFile.SetDataLogToSD(alphanumericToBoolean(splitted[1])); LogFile.SetDataLogToSD(alphanumericToBoolean(splitted[1]));
} }

View File

@@ -37,6 +37,7 @@ protected:
bool AutoStart; bool AutoStart;
float AutoInterval; float AutoInterval;
bool SleepWhileIdle;
void SetInitialParameter(void); void SetInitialParameter(void);
std::string aktstatusWithTime; std::string aktstatusWithTime;
std::string aktstatus; std::string aktstatus;
@@ -72,6 +73,7 @@ public:
bool getIsAutoStart(); bool getIsAutoStart();
void setAutoStartInterval(long &_interval); void setAutoStartInterval(long &_interval);
void setSleepWhileIdle(bool& _sleepwhileidle);
std::string* getActStatusWithTime(); std::string* getActStatusWithTime();
std::string* getActStatus(); std::string* getActStatus();

View File

@@ -43,6 +43,7 @@ bool bTaskAutoFlowCreated = false;
bool flowisrunning = false; bool flowisrunning = false;
long auto_interval = 0; long auto_interval = 0;
bool sleep_while_idle = false;
bool autostartIsEnabled = false; bool autostartIsEnabled = false;
int countRounds = 0; int countRounds = 0;
@@ -1659,6 +1660,7 @@ void task_autodoFlow(void *pvParameter)
doInit(); doInit();
flowctrl.setAutoStartInterval(auto_interval); flowctrl.setAutoStartInterval(auto_interval);
flowctrl.setSleepWhileIdle(sleep_while_idle);
autostartIsEnabled = flowctrl.getIsAutoStart(); autostartIsEnabled = flowctrl.getIsAutoStart();
if (isSetupModusActive()) if (isSetupModusActive())
@@ -1739,9 +1741,20 @@ void task_autodoFlow(void *pvParameter)
if (auto_interval > fr_delta_ms) if (auto_interval > fr_delta_ms)
{ {
const TickType_t xDelay = (auto_interval - fr_delta_ms) / portTICK_PERIOD_MS; if(sleep_while_idle){
ESP_LOGD(TAG, "Autoflow: sleep for: %ldms", (long)xDelay); vTaskDelay(10000 / portTICK_PERIOD_MS);//A little more time so the user can finish config
vTaskDelay(xDelay); 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);
}
} }
} }

View File

@@ -349,7 +349,7 @@
#define CAM_PIN_D7 GPIO_NUM_16 #define CAM_PIN_D7 GPIO_NUM_16
#define CAM_PIN_D6 GPIO_NUM_17 #define CAM_PIN_D6 GPIO_NUM_17
#define CAM_PIN_D5 GPIO_NUM_18 #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_D3 GPIO_NUM_10
#define CAM_PIN_D2 GPIO_NUM_8 #define CAM_PIN_D2 GPIO_NUM_8
#define CAM_PIN_D1 GPIO_NUM_9 #define CAM_PIN_D1 GPIO_NUM_9

View File

@@ -1,145 +1,145 @@
[TakeImage] [TakeImage]
;RawImagesLocation = /log/source ;RawImagesLocation = /log/source
;RawImagesRetention = 15 ;RawImagesRetention = 15
WaitBeforeTakingPicture = 2 WaitBeforeTakingPicture = 2
CamGainceiling = x8 CamGainceiling = x8
CamQuality = 10 CamQuality = 10
CamBrightness = 0 CamBrightness = 0
CamContrast = 0 CamContrast = 0
CamSaturation = 0 CamSaturation = 0
CamSharpness = 0 CamSharpness = 0
CamAutoSharpness = false CamAutoSharpness = false
CamSpecialEffect = no_effect CamSpecialEffect = no_effect
CamWbMode = auto CamWbMode = auto
CamAwb = true CamAwb = true
CamAwbGain = true CamAwbGain = true
CamAec = true CamAec = true
CamAec2 = true CamAec2 = true
CamAeLevel = 2 CamAeLevel = 2
CamAecValue = 600 CamAecValue = 600
CamAgc = true CamAgc = true
CamAgcGain = 8 CamAgcGain = 8
CamBpc = true CamBpc = true
CamWpc = true CamWpc = true
CamRawGma = true CamRawGma = true
CamLenc = true CamLenc = true
CamHmirror = false CamHmirror = false
CamVflip = false CamVflip = false
CamDcw = true CamDcw = true
CamDenoise = 0 CamDenoise = 0
CamZoom = false CamZoom = false
CamZoomOffsetX = 0 CamZoomOffsetX = 0
CamZoomOffsetY = 0 CamZoomOffsetY = 0
CamZoomSize = 0 CamZoomSize = 0
LEDIntensity = 50 LEDIntensity = 50
Demo = false Demo = false
[Alignment] [Alignment]
InitialRotate = 0.0 InitialRotate = 0.0
SearchFieldX = 20 SearchFieldX = 20
SearchFieldY = 20 SearchFieldY = 20
AlignmentAlgo = default AlignmentAlgo = default
/config/ref0.jpg 103 271 /config/ref0.jpg 103 271
/config/ref1.jpg 442 142 /config/ref1.jpg 442 142
[Digits] [Digits]
Model = /config/dig-cont_0712_s3_q.tflite Model = /config/dig-cont_0712_s3_q.tflite
CNNGoodThreshold = 0.5 CNNGoodThreshold = 0.5
;ROIImagesLocation = /log/digit ;ROIImagesLocation = /log/digit
;ROIImagesRetention = 3 ;ROIImagesRetention = 3
main.dig1 294 126 30 54 false main.dig1 294 126 30 54 false
main.dig2 343 126 30 54 false main.dig2 343 126 30 54 false
main.dig3 391 126 30 54 false main.dig3 391 126 30 54 false
[Analog] [Analog]
Model = /config/ana-cont_1300_s2.tflite Model = /config/ana-cont_1300_s2.tflite
CNNGoodThreshold = 0.5 CNNGoodThreshold = 0.5
;ROIImagesLocation = /log/analog ;ROIImagesLocation = /log/analog
;ROIImagesRetention = 3 ;ROIImagesRetention = 3
main.ana1 432 230 92 92 false main.ana1 432 230 92 92 false
main.ana2 379 332 92 92 false main.ana2 379 332 92 92 false
main.ana3 283 374 92 92 false main.ana3 283 374 92 92 false
main.ana4 155 328 92 92 false main.ana4 155 328 92 92 false
[PostProcessing] [PostProcessing]
main.DecimalShift = 0 main.DecimalShift = 0
main.AnalogDigitTransitionStart = 9.2 main.AnalogDigitTransitionStart = 9.2
main.ChangeRateThreshold = 2 main.ChangeRateThreshold = 2
PreValueUse = true PreValueUse = true
PreValueAgeStartup = 720 PreValueAgeStartup = 720
main.AllowNegativeRates = false main.AllowNegativeRates = false
main.MaxRateValue = 0.05 main.MaxRateValue = 0.05
;main.MaxRateType = AbsoluteChange ;main.MaxRateType = AbsoluteChange
main.ExtendedResolution = false main.ExtendedResolution = false
main.IgnoreLeadingNaN = false main.IgnoreLeadingNaN = false
ErrorMessage = true ErrorMessage = true
main.CheckDigitIncreaseConsistency = false main.CheckDigitIncreaseConsistency = false
;[MQTT] ;[MQTT]
;Uri = mqtt://IP-ADRESS:1883 ;Uri = mqtt://IP-ADRESS:1883
;MainTopic = watermeter ;MainTopic = watermeter
;ClientID = watermeter ;ClientID = watermeter
;user = USERNAME ;user = USERNAME
;password = PASSWORD ;password = PASSWORD
RetainMessages = false RetainMessages = false
HomeassistantDiscovery = false HomeassistantDiscovery = false
;MeterType = other ;MeterType = other
;CACert = /config/certs/RootCA.pem ;CACert = /config/certs/RootCA.pem
;ClientCert = /config/certs/client.pem.crt ;ClientCert = /config/certs/client.pem.crt
;ClientKey = /config/certs/client.pem.key ;ClientKey = /config/certs/client.pem.key
;ValidateServerCert = true ;ValidateServerCert = true
;DomoticzTopicIn = domoticz/in ;DomoticzTopicIn = domoticz/in
;main.DomoticzIDX = 0 ;main.DomoticzIDX = 0
;[InfluxDB] ;[InfluxDB]
;Uri = undefined ;Uri = undefined
;Database = undefined ;Database = undefined
;user = undefined ;user = undefined
;password = undefined ;password = undefined
;main.Measurement = undefined ;main.Measurement = undefined
;main.Field = undefined ;main.Field = undefined
;[InfluxDBv2] ;[InfluxDBv2]
;Uri = undefined ;Uri = undefined
;Bucket = undefined ;Bucket = undefined
;Org = undefined ;Org = undefined
;Token = undefined ;Token = undefined
;main.Measurement = undefined ;main.Measurement = undefined
;main.Field = undefined ;main.Field = undefined
;[Webhook] ;[Webhook]
;Uri = undefined ;Uri = undefined
;ApiKey = undefined ;ApiKey = undefined
;UploadImg = 0 ;UploadImg = 0
;[GPIO] [GPIO]
;MainTopicMQTT = wasserzaehler/GPIO ;IO0 = input disabled 10 false false
;IO0 = input disabled 10 false false ;IO1 = input disabled 10 false false
;IO1 = input disabled 10 false false ;IO3 = input disabled 10 false false
;IO3 = input disabled 10 false false ;IO4 = built-in-led disabled 10 false false
;IO4 = built-in-led disabled 10 false false IO12 = external-flash-ws281x disabled 10 false false
;IO12 = input-pullup disabled 10 false false ;IO13 = input-pullup disabled 10 false false
;IO13 = input-pullup disabled 10 false false LEDType = WS2812
LEDType = WS2812 LEDNumbers = 4
LEDNumbers = 2 LEDColor = 200 200 200
LEDColor = 150 150 150
[AutoTimer]
[AutoTimer] Interval = 5
Interval = 5 SleepWhileIdle = false
[DataLogging] [DataLogging]
DataLogActive = true DataLogActive = true
DataFilesRetention = 3 DataFilesRetention = 3
[Debug] [Debug]
LogLevel = 1 LogLevel = 1
LogfilesRetention = 3 LogfilesRetention = 3
[System] [System]
TimeZone = CET-1CEST,M3.5.0,M10.5.0/3 TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
;TimeServer = pool.ntp.org ;TimeServer = pool.ntp.org
;Hostname = undefined ;Hostname = undefined
RSSIThreshold = -75 RSSIThreshold = -75
CPUFrequency = 160 CPUFrequency = 160
Tooltip = true Tooltip = true
SetupMode = true SetupMode = true

View File

@@ -1974,6 +1974,19 @@
<td>$TOOLTIP_AutoTimer_Interval</td> <td>$TOOLTIP_AutoTimer_Interval</td>
</tr> </tr>
<tr>
<td class="indent1">
<class id="AutoTimer_SleepWhileIdle_text" style="color:black;">Sleep While Idle</class>
</td>
<td>
<select id="AutoTimer_SleepWhileIdle_value1">
<option value="true">enabled (true)</option>
<option value="false" selected>disabled (false)</option>
</select>
</td>
<td>$TOOLTIP_AutoTimer_SleepWhileIdle</td>
</tr>
<!------------- Data Logging ------------------> <!------------- Data Logging ------------------>
<tr style="border-bottom: 2px solid lightgray;"> <tr style="border-bottom: 2px solid lightgray;">
<td colspan="3" style="padding-left: 0px; padding-bottom: 3px;"><h4>Data Logging</h4></td> <td colspan="3" style="padding-left: 0px; padding-bottom: 3px;"><h4>Data Logging</h4></td>
@@ -2402,6 +2415,7 @@ function UpdateInput() {
//WriteParameter(param, category, "AutoTimer", "AutoStart", false); //WriteParameter(param, category, "AutoTimer", "AutoStart", false);
WriteParameter(param, category, "AutoTimer", "Interval", false); WriteParameter(param, category, "AutoTimer", "Interval", false);
WriteParameter(param, category, "AutoTimer", "SleepWhileIdle", false);
WriteParameter(param, category, "DataLogging", "DataLogActive", false); WriteParameter(param, category, "DataLogging", "DataLogActive", false);
WriteParameter(param, category, "DataLogging", "DataFilesRetention", false); WriteParameter(param, category, "DataLogging", "DataFilesRetention", false);
@@ -2578,6 +2592,7 @@ function ReadParameterAll() {
//ReadParameter(param, "AutoTimer", "AutoStart", false); //ReadParameter(param, "AutoTimer", "AutoStart", false);
ReadParameter(param, "AutoTimer", "Interval", false); ReadParameter(param, "AutoTimer", "Interval", false);
ReadParameter(param, "AutoTimer", "SleepWhileIdle", false);
ReadParameter(param, "DataLogging", "DataLogActive", false); ReadParameter(param, "DataLogging", "DataLogActive", false);
ReadParameter(param, "DataLogging", "DataFilesRetention", false); ReadParameter(param, "DataLogging", "DataFilesRetention", false);