Fixed Segfault #9
This commit is contained in:
@@ -63,7 +63,7 @@ int main(void) {
|
|||||||
nodedata.isoutside = currentNode->isoutside; //copy the boolean value
|
nodedata.isoutside = currentNode->isoutside; //copy the boolean value
|
||||||
printf("Acquiring rest response\n");
|
printf("Acquiring rest response\n");
|
||||||
|
|
||||||
printf("Temperature: %f, Humidity: %f, NodeID: %i, Outside: %s, AbsoluteHumidity: %f\n", nodedata.temperature, nodedata.humidity, nodedata.node_id, nodedata.isoutside ? "Yes" : "No", absoluteHumidity(nodedata));
|
printf("Temperature: %f, Humidity: %f, NodeID: %i, Outside: %s, AbsoluteHumidity: %f\n", nodedata.temperature, nodedata.humidity, nodedata.node_id, nodedata.isoutside ? "Yes" : "No", absoluteHumidity(&nodedata));
|
||||||
|
|
||||||
//Insert data into database
|
//Insert data into database
|
||||||
printf("Insert data into stats table\n");
|
printf("Insert data into stats table\n");
|
||||||
|
@@ -82,10 +82,11 @@ int getRestSensor(sensor *sensor) {
|
|||||||
//The ID is stored in the JSON root
|
//The ID is stored in the JSON root
|
||||||
cJSON *id = cJSON_GetObjectItemCaseSensitive(jsondata, "id");
|
cJSON *id = cJSON_GetObjectItemCaseSensitive(jsondata, "id");
|
||||||
|
|
||||||
|
if (temperature != NULL && humidity != NULL && id != NULL) {
|
||||||
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);
|
||||||
|
}
|
||||||
//free
|
//free
|
||||||
cJSON_Delete(jsondata);
|
cJSON_Delete(jsondata);
|
||||||
free(data);
|
free(data);
|
||||||
|
Reference in New Issue
Block a user