10-22-2021 11:22 AM
I am using bme680 for iaq calculation and another sensor is one of optical sensor which gives some optical data ...because of infinite bsec_iot_loop i can't do anything for this optical sensor .so please help me how to do other tasks while using Bsec_iot_loop(), I also trying timer-based interrupt to read optical data but after some time error occurs.is any method to calculate iaq .I have used the nrf52840 controller .and i want to run only one thread so please help me also i post my query on the community forum.
Solved! Go to Solution.
10-25-2021 04:34 PM
Hello pallyapd,
nrf52840 had freertos support, you could start a task for optical sensor, and start another task for BSEC, run bsec_iot_loop().
10-26-2021 09:11 AM
i don't want to use freertos .my application include ble mesh and all framework is ready .so any other way to solve this instead of this os.?
11-03-2021 03:35 AM
Hi,
You can certainly avoid using bsec_iot_loop() in your code. I think that is just an example provided by Bosch. In my code I implemented a function to perform the equivalent functionality but without the loop. The key is to pass the current timestamp to bsec_sensor_control(), which in turn tells you if measurements should be run, and also when to run the next measurement. Then in your code use a timer or another method to delay the next call until the appropriate time.
So basically (simplified):
int64_t time_stamp = get_timestamp_us() * 1000ULL;
bsec_sensor_control(time_stamp, &sensor_settings); bme680_bsec_trigger_measurement(&sensor_settings, sleep); bme680_bsec_read_data(time_stamp, bsec_inputs, &num_bsec_inputs, sensor_settings.process_data); bme680_bsec_process_data(bsec_inputs, num_bsec_inputs, output_ready);
int64_t time_stamp_interval_ms = (sensor_settings.next_call - get_timestamp_us() * 1000ULL) / 1000000ULL; return (time_stamp_interval_ms > 0) ? time_stamp_interval_ms : 0;
I hope this helps.
11-03-2021 03:49 AM
Hello gbeloev,
Thanks for your sharing.
Yes, we can modify it to the code we want based on the example code. @pallyapd, could your refer gbeloev's suggestion for your SW platform?