Rest return fixes; Sensornode delay fix
This commit is contained in:
@@ -107,8 +107,8 @@ void loop() {
|
|||||||
|
|
||||||
//set new milli counter
|
//set new milli counter
|
||||||
//millis will overflow after approx. 52 days. To prevent errors we're checking the limits
|
//millis will overflow after approx. 52 days. To prevent errors we're checking the limits
|
||||||
if (millis() + MEASURESECONDS * 1000 <= ULONG_MAX) {
|
if (millis() + (MEASURESECONDS * 1000) <= ULONG_MAX) {
|
||||||
millitotal = millis() + 2000;
|
millitotal = millis() + (MEASURESECONDS * 1000);
|
||||||
} else {
|
} else {
|
||||||
millitotal = 0;
|
millitotal = 0;
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ int main(void) {
|
|||||||
//start rest requests
|
//start rest requests
|
||||||
nodedata[i].pin = 0; //This data isn't relevant for a sensornode
|
nodedata[i].pin = 0; //This data isn't relevant for a sensornode
|
||||||
strcpy(nodedata[i].ip, currentNode->ip);
|
strcpy(nodedata[i].ip, currentNode->ip);
|
||||||
getRestSensor(&nodedata[i]);
|
if (getRestSensor(&nodedata[i])) {
|
||||||
nodedata[i].isoutside = currentNode->isoutside; //copy the boolean value
|
nodedata[i].isoutside = currentNode->isoutside; //copy the boolean value
|
||||||
printf("Acquiring rest response\n");
|
printf("Acquiring rest response\n");
|
||||||
|
|
||||||
@@ -70,6 +70,7 @@ int main(void) {
|
|||||||
//Insert data into database
|
//Insert data into database
|
||||||
printf("Insert data into stats table\n");
|
printf("Insert data into stats table\n");
|
||||||
insertData(&nodedata[i]);
|
insertData(&nodedata[i]);
|
||||||
|
}
|
||||||
|
|
||||||
currentNode = currentNode->next;
|
currentNode = currentNode->next;
|
||||||
}
|
}
|
||||||
|
@@ -86,6 +86,11 @@ int getRestSensor(sensor *sensor) {
|
|||||||
sensor->temperature = (float)temperature->valuedouble;
|
sensor->temperature = (float)temperature->valuedouble;
|
||||||
sensor->humidity = (float)humidity->valuedouble;
|
sensor->humidity = (float)humidity->valuedouble;
|
||||||
sensor->node_id = atoi(id->valuestring);
|
sensor->node_id = atoi(id->valuestring);
|
||||||
|
} else {
|
||||||
|
//free
|
||||||
|
cJSON_Delete(jsondata);
|
||||||
|
free(data);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
//free
|
//free
|
||||||
cJSON_Delete(jsondata);
|
cJSON_Delete(jsondata);
|
||||||
|
Reference in New Issue
Block a user