Skip to content
Snippets Groups Projects
Commit c5c2ef05 authored by schneider's avatar schneider
Browse files

chore(bsec): code style

parent ab5d0ff3
No related branches found
No related tags found
No related merge requests found
...@@ -52,10 +52,21 @@ int64_t get_timestamp_us() ...@@ -52,10 +52,21 @@ int64_t get_timestamp_us()
* *
* @return none * @return none
*/ */
void output_ready(int64_t timestamp, float iaq, uint8_t iaq_accuracy, float temperature, float humidity, void output_ready(
float pressure, float raw_temperature, float raw_humidity, float gas, bsec_library_return_t bsec_status, int64_t timestamp,
float static_iaq, float co2_equivalent, float breath_voc_equivalent) float iaq,
{ uint8_t iaq_accuracy,
float temperature,
float humidity,
float pressure,
float raw_temperature,
float raw_humidity,
float gas,
bsec_library_return_t bsec_status,
float static_iaq,
float co2_equivalent,
float breath_voc_equivalent
) {
return; return;
printf("bosch data time: %u, iaq: %u, iaq_a: %u, temp10: %u, hum10: %u, pres: %u, raw_temp10: %u, raw_hum10: %u, gas: %u, static_iaq: %u, co21e6: %u, breath_voc1e6: %u\n", printf("bosch data time: %u, iaq: %u, iaq_a: %u, temp10: %u, hum10: %u, pres: %u, raw_temp10: %u, raw_hum10: %u, gas: %u, static_iaq: %u, co21e6: %u, breath_voc1e6: %u\n",
(unsigned int)(timestamp / 9e6), (unsigned int)(timestamp / 9e6),
...@@ -69,8 +80,7 @@ void output_ready(int64_t timestamp, float iaq, uint8_t iaq_accuracy, float temp ...@@ -69,8 +80,7 @@ void output_ready(int64_t timestamp, float iaq, uint8_t iaq_accuracy, float temp
(unsigned int)(gas), (unsigned int)(gas),
(unsigned int)(static_iaq), (unsigned int)(static_iaq),
(unsigned int)(co2_equivalent * 1e6), (unsigned int)(co2_equivalent * 1e6),
(unsigned int)(breath_voc_equivalent * 1e6) (unsigned int)(breath_voc_equivalent * 1e6));
);
} }
static int bsec_load(char *path, uint8_t *buffer, uint32_t n_buffer) static int bsec_load(char *path, uint8_t *buffer, uint32_t n_buffer)
...@@ -86,7 +96,8 @@ static int bsec_load(char *path, uint8_t *buffer, uint32_t n_buffer) ...@@ -86,7 +96,8 @@ static int bsec_load(char *path, uint8_t *buffer, uint32_t n_buffer)
} }
uint32_t header; uint32_t header;
if ((res = epic_file_read(fd, &header, sizeof(header))) != sizeof(header)) { if ((res = epic_file_read(fd, &header, sizeof(header))) !=
sizeof(header)) {
printf("Header failed\n"); printf("Header failed\n");
goto done; goto done;
} }
...@@ -141,7 +152,8 @@ void state_save(const uint8_t *state_buffer, uint32_t length) ...@@ -141,7 +152,8 @@ void state_save(const uint8_t *state_buffer, uint32_t length)
} }
uint32_t header = length; uint32_t header = length;
if ((res = epic_file_write(fd, &header, sizeof(header))) != sizeof(header)) { if ((res = epic_file_write(fd, &header, sizeof(header))) !=
sizeof(header)) {
printf("Header failed\n"); printf("Header failed\n");
goto done; goto done;
} }
...@@ -218,17 +230,24 @@ void vBSECTask(void *pvParameters) ...@@ -218,17 +230,24 @@ void vBSECTask(void *pvParameters)
/* Switch on ultra_low-power mode and provide no temperature offset */ /* Switch on ultra_low-power mode and provide no temperature offset */
ret = bsec_iot_init(BSEC_SAMPLE_RATE_ULP, 0.0f, card10_bosch_i2c_write, card10_bosch_i2c_read, card10_bosch_delay, state_load, config_load); ret = bsec_iot_init(BSEC_SAMPLE_RATE_ULP, 0.0f, card10_bosch_i2c_write, card10_bosch_i2c_read, card10_bosch_delay, state_load, config_load);
#else #else
ret = bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, card10_bosch_i2c_write, card10_bosch_i2c_read, card10_bosch_delay, state_load, config_load); ret = bsec_iot_init(
BSEC_SAMPLE_RATE_LP,
0.0f,
card10_bosch_i2c_write,
card10_bosch_i2c_read,
card10_bosch_delay,
state_load,
config_load
);
#endif #endif
if (ret.bme680_status) if (ret.bme680_status) {
{
/* Could not intialize BME680 or BSEC library */ /* Could not intialize BME680 or BSEC library */
while(1); while (1)
} ;
else if (ret.bsec_status) } else if (ret.bsec_status) {
{
/* Could not intialize BSEC library */ /* Could not intialize BSEC library */
while(1); while (1)
;
} }
/* Call to endless loop function which reads and processes data based on sensor settings */ /* Call to endless loop function which reads and processes data based on sensor settings */
#if 0 #if 0
...@@ -239,7 +258,14 @@ void vBSECTask(void *pvParameters) ...@@ -239,7 +258,14 @@ void vBSECTask(void *pvParameters)
//bsec_iot_loop(card10_bosch_delay, get_timestamp_us, output_ready, state_save, 10000); //bsec_iot_loop(card10_bosch_delay, get_timestamp_us, output_ready, state_save, 10000);
/* State is saved every 100 samples, which means every 1200 * 3 secs = 60 minutes */ /* State is saved every 100 samples, which means every 1200 * 3 secs = 60 minutes */
bsec_iot_loop(card10_bosch_delay, get_timestamp_us, output_ready, state_save, 1200); bsec_iot_loop(
card10_bosch_delay,
get_timestamp_us,
output_ready,
state_save,
1200
);
#endif #endif
while(1); while (1)
;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment