Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*** OLD *** Migrate configuration -> Superseeded by PR2017 #2001

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FeatureRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ haveing this state in the mqtt broker can trigger functions like closing the ate

* Implementation of an authentication mechanism.

#### #8 MQTT configurable readout intervall
#### #8 MQTT configurable readout interval

Make the readout intervall configurable via MQTT.
Make the readout interval configurable via MQTT.

* Change the mqtt part to receive and process input and not only sending

Expand Down
9 changes: 5 additions & 4 deletions code/components/jomjol_fileserver_ota/server_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,6 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
directory = "/fileserver" + directory;
// ESP_LOGD(TAG, "Directory danach 2: %s", directory.c_str());

/* Redirect onto root to see the updated file list */
httpd_resp_set_status(req, "303 See Other");
httpd_resp_set_hdr(req, "Location", directory.c_str());

/* Redirect onto root to see the updated file list */
httpd_resp_set_status(req, "303 See Other");
httpd_resp_set_hdr(req, "Location", directory.c_str());
Expand Down Expand Up @@ -996,8 +992,13 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st

ESP_LOGI(TAG, "Filename to extract: %s, Zwischenfilename: %s", zw.c_str(), filename_zw.c_str());

std::string folder = filename_zw.substr(0, filename_zw.find_last_of('/'));
MakeDir(folder);

// extrahieren in zwischendatei
DeleteFile(filename_zw);


FILE* fpTargetFile = fopen(filename_zw.c_str(), "wb");
uint writtenbytes = fwrite(p, 1, (uint)uncomp_size, fpTargetFile);
fclose(fpTargetFile);
Expand Down
8 changes: 4 additions & 4 deletions code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ClassFlowAlignment.h"
#include "ClassFlowMakeImage.h"
#include "ClassFlowTakeImage.h"
#include "ClassFlow.h"
#include "server_tflite.h"

Expand Down Expand Up @@ -46,9 +46,9 @@ ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)

for (int i = 0; i < ListFlowControll->size(); ++i)
{
if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0)
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0)
{
ImageBasis = ((ClassFlowMakeImage*) (*ListFlowControll)[i])->rawImage;
ImageBasis = ((ClassFlowTakeImage*) (*ListFlowControll)[i])->rawImage;
}
}

Expand All @@ -74,7 +74,7 @@ bool ClassFlowAlignment::ReadParameter(FILE* pfile, string& aktparamgraph)
if (!this->GetNextParagraph(pfile, aktparamgraph))
return false;

if (aktparamgraph.compare("[Alignment]") != 0) //Paragraph does not fit MakeImage
if (aktparamgraph.compare("[Alignment]") != 0) //Paragraph does not fit Alignment
return false;

while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
Expand Down
40 changes: 20 additions & 20 deletions code/components/jomjol_flowcontroll/ClassFlowControll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _

ESP_LOGD(TAG, "Step %s start", _stepname.c_str());

if ((_stepname.compare("[MakeImage]") == 0) || (_stepname.compare(";[MakeImage]") == 0)){
_classname = "ClassFlowMakeImage";
if ((_stepname.compare("[TakeImage]") == 0) || (_stepname.compare(";[TakeImage]") == 0)){
_classname = "ClassFlowTakeImage";
}
if ((_stepname.compare("[Alignment]") == 0) || (_stepname.compare(";[Alignment]") == 0)){
_classname = "ClassFlowAlignment";
Expand Down Expand Up @@ -67,7 +67,7 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _

for (int i = 0; i < FlowControll.size(); ++i)
if (FlowControll[i]->name().compare(_classname) == 0){
if (!(FlowControll[i]->name().compare("ClassFlowMakeImage") == 0)) // if it is a MakeImage, the image does not need to be included, this happens automatically with the html query.
if (!(FlowControll[i]->name().compare("ClassFlowTakeImage") == 0)) // if it is a TakeImage, the image does not need to be included, this happens automatically with the html query.
FlowControll[i]->doFlow("");
result = FlowControll[i]->getHTMLSingleStep(_host);
}
Expand All @@ -80,7 +80,7 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _

std::string ClassFlowControll::TranslateAktstatus(std::string _input)
{
if (_input.compare("ClassFlowMakeImage") == 0)
if (_input.compare("ClassFlowTakeImage") == 0)
return ("Take Image");
if (_input.compare("ClassFlowAlignment") == 0)
return ("Aligning");
Expand Down Expand Up @@ -176,7 +176,7 @@ bool ClassFlowControll::StartMQTTService() {
/* Start the MQTT service */
for (int i = 0; i < FlowControll.size(); ++i) {
if (FlowControll[i]->name().compare("ClassFlowMQTT") == 0) {
return ((ClassFlowMQTT*) (FlowControll[i]))->Start(AutoIntervall);
return ((ClassFlowMQTT*) (FlowControll[i]))->Start(AutoInterval);
}
}
return false;
Expand All @@ -188,7 +188,7 @@ void ClassFlowControll::SetInitialParameter(void)
{
AutoStart = false;
SetupModeActive = false;
AutoIntervall = 10; // Minutes
AutoInterval = 10; // Minutes
flowdigit = NULL;
flowanalog = NULL;
flowpostprocessing = NULL;
Expand All @@ -198,9 +198,9 @@ void ClassFlowControll::SetInitialParameter(void)
}


bool ClassFlowControll::isAutoStart(long &_intervall)
bool ClassFlowControll::isAutoStart(long &_interval)
{
_intervall = AutoIntervall * 60 * 1000; // AutoInterval: minutes -> ms
_interval = AutoInterval * 60 * 1000; // AutoInterval: minutes -> ms
return AutoStart;
}

Expand All @@ -211,10 +211,10 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)

_type = trim(_type);

if (toUpper(_type).compare("[MAKEIMAGE]") == 0)
if (toUpper(_type).compare("[TAKEIMAGE]") == 0)
{
cfc = new ClassFlowMakeImage(&FlowControll);
flowmakeimage = (ClassFlowMakeImage*) cfc;
cfc = new ClassFlowTakeImage(&FlowControll);
flowtakeimage = (ClassFlowTakeImage*) cfc;
}
if (toUpper(_type).compare("[ALIGNMENT]") == 0)
{
Expand Down Expand Up @@ -330,13 +330,13 @@ void ClassFlowControll::setActStatus(std::string _aktstatus)
}


void ClassFlowControll::doFlowMakeImageOnly(string time)
void ClassFlowControll::doFlowTakeImageOnly(string time)
{
std::string zw_time;

for (int i = 0; i < FlowControll.size(); ++i)
{
if (FlowControll[i]->name() == "ClassFlowMakeImage") {
if (FlowControll[i]->name() == "ClassFlowTakeImage") {
zw_time = getCurrentTimeString("%H:%M:%S");
std::string flowStatus = TranslateAktstatus(FlowControll[i]->name());
aktstatus = flowStatus + " (" + zw_time + ")";
Expand Down Expand Up @@ -535,7 +535,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)


if ((toUpper(aktparamgraph).compare("[AUTOTIMER]") != 0) && (toUpper(aktparamgraph).compare("[DEBUG]") != 0) &&
(toUpper(aktparamgraph).compare("[SYSTEM]") != 0 && (toUpper(aktparamgraph).compare("[DATALOGGING]") != 0))) // Paragraph passt nicht zu MakeImage
(toUpper(aktparamgraph).compare("[SYSTEM]") != 0 && (toUpper(aktparamgraph).compare("[DATALOGGING]") != 0))) // Paragraph passt nicht zu Debug oder DataLogging
return false;

while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
Expand All @@ -549,9 +549,9 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
}
}

if ((toUpper(splitted[0]) == "INTERVALL") && (splitted.size() > 1))
if ((toUpper(splitted[0]) == "INTERVAL") && (splitted.size() > 1))
{
AutoIntervall = std::stof(splitted[1]);
AutoInterval = std::stof(splitted[1]);
}

if ((toUpper(splitted[0]) == "DATALOGACTIVE") && (splitted.size() > 1))
Expand Down Expand Up @@ -597,13 +597,13 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)

/* TimeServer and TimeZone got already read from the config, see setupTime () */

if ((toUpper(splitted[0]) == "RSSITHREASHOLD") && (splitted.size() > 1))
if ((toUpper(splitted[0]) == "RSSITHRESHOLD") && (splitted.size() > 1))
{
if (ChangeRSSIThreashold(WLAN_CONFIG_FILE, atoi(splitted[1].c_str())))
if (ChangeRSSIThreshold(WLAN_CONFIG_FILE, atoi(splitted[1].c_str())))
{
// reboot necessary so that the new wlan.ini is also used !!!
fclose(pfile);
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Rebooting to activate new RSSITHREASHOLD ...");
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Rebooting to activate new RSSITHRESHOLD ...");
esp_restart();
hard_restart();
doReboot();
Expand Down Expand Up @@ -668,7 +668,7 @@ int ClassFlowControll::CleanTempFolder() {

esp_err_t ClassFlowControll::SendRawJPG(httpd_req_t *req)
{
return flowmakeimage != NULL ? flowmakeimage->SendRawJPG(req) : ESP_FAIL;
return flowtakeimage != NULL ? flowtakeimage->SendRawJPG(req) : ESP_FAIL;
}


Expand Down
10 changes: 5 additions & 5 deletions code/components/jomjol_flowcontroll/ClassFlowControll.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string>

#include "ClassFlow.h"
#include "ClassFlowMakeImage.h"
#include "ClassFlowTakeImage.h"
#include "ClassFlowAlignment.h"
#include "ClassFlowCNNGeneral.h"
#include "ClassFlowPostProcessing.h"
Expand All @@ -30,11 +30,11 @@ class ClassFlowControll :
ClassFlowCNNGeneral* flowanalog;
ClassFlowCNNGeneral* flowdigit;
// ClassFlowDigit* flowdigit;
ClassFlowMakeImage* flowmakeimage;
ClassFlowTakeImage* flowtakeimage;
ClassFlow* CreateClassFlow(std::string _type);

bool AutoStart;
float AutoIntervall;
float AutoInterval;
bool SetupModeActive;
void SetInitialParameter(void);
std::string aktstatus;
Expand All @@ -43,7 +43,7 @@ class ClassFlowControll :
public:
void InitFlow(std::string config);
bool doFlow(string time);
void doFlowMakeImageOnly(string time);
void doFlowTakeImageOnly(string time);
bool getStatusSetupModus(){return SetupModeActive;};
string getReadout(bool _rawvalue, bool _noerror);
string getReadoutAll(int _type);
Expand All @@ -69,7 +69,7 @@ class ClassFlowControll :

std::string doSingleStep(std::string _stepname, std::string _host);

bool isAutoStart(long &_intervall);
bool isAutoStart(long &_interval);

std::string* getActStatus();
void setActStatus(std::string _aktstatus);
Expand Down
6 changes: 3 additions & 3 deletions code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
if (!this->GetNextParagraph(pfile, aktparamgraph))
return false;

if (toUpper(aktparamgraph).compare("[MQTT]") != 0) // Paragraph does not fit MakeImage
if (toUpper(aktparamgraph).compare("[MQTT]") != 0) // Paragraph does not fit MQTT
return false;

while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
Expand Down Expand Up @@ -184,9 +184,9 @@ string ClassFlowMQTT::GetMQTTMainTopic()
}


bool ClassFlowMQTT::Start(float AutoIntervall)
bool ClassFlowMQTT::Start(float AutoInterval)
{
roundInterval = AutoIntervall; // Minutes
roundInterval = AutoInterval; // Minutes
keepAlive = roundInterval * 60 * 2.5; // Seconds, make sure it is greater thatn 2 rounds!

std::stringstream stream;
Expand Down
2 changes: 1 addition & 1 deletion code/components/jomjol_flowcontroll/ClassFlowMQTT.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ClassFlowMQTT :
ClassFlowMQTT(std::vector<ClassFlow*>* lfc, ClassFlow *_prev);

string GetMQTTMainTopic();
bool Start(float AutoIntervall);
bool Start(float AutoInterval);

bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);
Expand Down
12 changes: 6 additions & 6 deletions code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "ClassFlowPostProcessing.h"
#include "Helper.h"
#include "ClassFlowMakeImage.h"
#include "ClassFlowTakeImage.h"
#include "ClassLogFile.h"

#include <iomanip>
Expand Down Expand Up @@ -285,17 +285,17 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc, C
ListFlowControll = NULL;
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
ListFlowControll = lfc;
flowMakeImage = NULL;
flowTakeImage = NULL;
UpdatePreValueINI = false;
IgnoreLeadingNaN = false;
flowAnalog = _analog;
flowDigit = _digit;

for (int i = 0; i < ListFlowControll->size(); ++i)
{
if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0)
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0)
{
flowMakeImage = (ClassFlowMakeImage*) (*ListFlowControll)[i];
flowTakeImage = (ClassFlowTakeImage*) (*ListFlowControll)[i];
}
}
}
Expand Down Expand Up @@ -503,7 +503,7 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
return false;


if (aktparamgraph.compare("[PostProcessing]") != 0) // Paragraph does not fit MakeImage
if (aktparamgraph.compare("[PostProcessing]") != 0) // Paragraph does not fit PostProcessing
return false;

InitNUMBERS();
Expand Down Expand Up @@ -715,7 +715,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)

// Update decimal point, as the decimal places can also change when changing from CNNType Auto --> xyz:

imagetime = flowMakeImage->getTimeImageTaken();
imagetime = flowTakeImage->getTimeImageTaken();
if (imagetime == 0)
time(&imagetime);

Expand Down
4 changes: 2 additions & 2 deletions code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define CLASSFFLOWPOSTPROCESSING_H

#include "ClassFlow.h"
#include "ClassFlowMakeImage.h"
#include "ClassFlowTakeImage.h"
#include "ClassFlowCNNGeneral.h"
#include "ClassFlowDefineTypes.h"

Expand All @@ -28,7 +28,7 @@ class ClassFlowPostProcessing :

string FilePreValue;

ClassFlowMakeImage *flowMakeImage;
ClassFlowTakeImage *flowTakeImage;

bool LoadPreValue(void);
string ShiftDecimal(string in, int _decShift);
Expand Down
Loading