This commit is contained in:
jomjol
2021-07-29 20:14:36 +02:00
parent fa3842b2b4
commit 1bcaf09855
11 changed files with 35 additions and 22 deletions

View File

@@ -39,18 +39,27 @@ bool ConfigFile::GetNextParagraph(std::string& aktparamgraph, bool &disabled, bo
bool ConfigFile::getNextLine(std::string *rt, bool &disabled, bool &eof)
{
eof = false;
char zw[1024];
char zw[1024] = "";
if (pFile == NULL)
{
*rt = "";
return false;
}
fgets(zw, 1024, pFile);
printf("%s", zw);
if ((strlen(zw) == 0) && feof(pFile))
if (fgets(zw, 1024, pFile))
{
printf("%s", zw);
if ((strlen(zw) == 0) && feof(pFile))
{
*rt = "";
eof = true;
return false;
}
}
else
{
*rt = "";
eof = true;
eof = true;
return false;
}
*rt = zw;

View File

@@ -216,6 +216,7 @@ void GpioHandler::init()
clear();
}
ESP_LOGI(TAG_SERVERGPIO, "read GPIO config and init GPIO");
if (!readConfig()) {
clear();
@@ -225,6 +226,7 @@ void GpioHandler::init()
return;
}
for(std::map<gpio_num_t, GpioPin*>::iterator it = gpioMap->begin(); it != gpioMap->end(); ++it) {
it->second->init();
}

View File

@@ -130,11 +130,9 @@ bool ClassFlow::getNextLine(FILE* pfile, string *rt)
*rt = trim(*rt);
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '[')) // Kommentarzeilen (; oder #) und Leerzeilen überspringen, es sei denn es ist ein neuer auskommentierter Paragraph
{
*rt = "";
if (!fgets(zw, 1024, pfile))
{
*rt = "";
return false;
}
printf("%s", zw);
*rt = zw;
*rt = trim(*rt);

View File

@@ -173,9 +173,12 @@ void ClassFlowControll::InitFlow(std::string config)
}
else
{
fgets(zw, 1024, pFile);
printf("%s", zw);
line = std::string(zw);
line = "";
if (fgets(zw, 1024, pFile) && !feof(pFile))
{
printf("Read: %s", zw);
line = std::string(zw);
}
}
}