Fixed segfault in configreader
This commit is contained in:
@@ -25,29 +25,35 @@ int main(void) {
|
||||
int i;
|
||||
for (i = 0; i < cfgreadpinamount(); i++) {
|
||||
data.pin = cfgreadpinnumber(i);
|
||||
getData(&data);
|
||||
printf("Pin: %i, %.2f, %.2f\n", data.pin, data.temperature, data.humidity);
|
||||
//getData(&data);
|
||||
//printf("Pin: %i, %.2f, %.2f\n", data.pin, data.temperature, data.humidity);
|
||||
//insertData(&data);
|
||||
}
|
||||
|
||||
sensornode nodes; //Settings of ESP8266 sensor nodes
|
||||
int nodecount = 0;
|
||||
printf("Reading Sensornodes\n");
|
||||
cfgreadsensornodes(&nodes, nodecount); //read settings
|
||||
printf("Reading Sensornodes done Nodecount: %i\n", nodecount);
|
||||
sensor nodedata; //Should be a linked list for further data usage
|
||||
sensornode *currentNode = &nodes;
|
||||
|
||||
printf("First IP: %s\n", nodes.ip);
|
||||
|
||||
for (i = 0; i < nodecount; i++) {
|
||||
for (i = 0; i <= nodecount; i++) {
|
||||
//start rest requests
|
||||
strcpy(nodedata.ip, currentNode->ip);
|
||||
getRestSensor(&nodedata);
|
||||
printf("Acquiring rest response\n");
|
||||
|
||||
printf("Temperature: %f, Humidity: %f, NodeID: %i", nodedata.temperature, nodedata.humidity, nodedata.node_id);
|
||||
printf("Temperature: %f, Humidity: %f, NodeID: %i\n", nodedata.temperature, nodedata.humidity, nodedata.node_id);
|
||||
|
||||
//Insert data into database
|
||||
|
||||
currentNode = currentNode->next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
cfgdestroy();
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user