update README and remove duplicate file
This commit is contained in:
parent
06baae7e04
commit
d942cd8d9e
43
README.md
43
README.md
@ -28,7 +28,7 @@ The loggers spit out the following every minute:
|
||||
|
||||
>Note: disregard measured gas resistance if the heat stability bit is not 1.
|
||||
|
||||
## spi demo
|
||||
## bme680_{i2c,spi} demo output
|
||||
```
|
||||
par_t1: 26203
|
||||
par_t2: 26519
|
||||
@ -67,48 +67,9 @@ gas resistance: 12100.310308 Ohm
|
||||
=== heat_stab_r: 1
|
||||
```
|
||||
|
||||
## i2c demo
|
||||
```
|
||||
par_t1: 26125
|
||||
par_t2: 26370
|
||||
par_t3: 3
|
||||
par_p1: 36262
|
||||
par_p2: -10371
|
||||
par_p3: 88
|
||||
par_p4: 6713
|
||||
par_p5: -103
|
||||
par_p6: 30
|
||||
par_p7: 31
|
||||
par_p8: -251
|
||||
par_p9: -3158
|
||||
par_p10: 30
|
||||
par_h1: 776
|
||||
par_h2: 1010
|
||||
par_h3: 0
|
||||
par_h4: 45
|
||||
par_h5: 20
|
||||
par_h6: 120
|
||||
par_h7: -100
|
||||
par_g1: 183
|
||||
par_g2: 59281
|
||||
par_g3: 18
|
||||
range_switching_error: 19
|
||||
res_heat_range: 1
|
||||
res_heat_val: 39
|
||||
float mode
|
||||
tfine: 97289.819111
|
||||
temp: 19.001918 degC
|
||||
press: 100226.479673 Pa
|
||||
humidity: 67.022216 % RH
|
||||
gas resistance: 14702.868852 Ohm
|
||||
== for heater target=300.0 and ambient temp=19.0 (degC)
|
||||
=== gas_valid_r: 1
|
||||
=== heat_stab_r: 1
|
||||
```
|
||||
|
||||
## Burn-in / logging
|
||||
|
||||
See file `example/log.c`
|
||||
See file `cmd/log.c`
|
||||
|
||||

|
||||

|
||||
|
101
example/log.c
101
example/log.c
@ -1,101 +0,0 @@
|
||||
#define _DEFAULT_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "bme680.h"
|
||||
#include "i2c.h"
|
||||
|
||||
#define AMBIENT_TEMP_GUESS 19.0
|
||||
#define HEATER_TARGET 300.0
|
||||
|
||||
|
||||
int main(void) {
|
||||
|
||||
bme680_t bme680;
|
||||
uint8_t mode;
|
||||
double temperature = AMBIENT_TEMP_GUESS;
|
||||
time_t curr_time;
|
||||
char date[100];
|
||||
|
||||
bme680.dev.init = i2c_init;
|
||||
bme680.dev.read = i2c_read;
|
||||
bme680.dev.write = i2c_write;
|
||||
bme680.dev.deinit = i2c_deinit;
|
||||
bme680.dev.sleep = usleep;
|
||||
|
||||
mode = BME680_MODE_FLOAT | BME680_I2C | BME680_ENABLE_GAS;
|
||||
|
||||
|
||||
if (bme680_init(&bme680, mode) != 0) {
|
||||
fprintf(stderr, "bme680_init()\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
START:
|
||||
bme680_reset(&bme680);
|
||||
|
||||
if (bme680_calibrate(&bme680) != 0) {
|
||||
fprintf(stderr, "bme680_calibrate()\n");
|
||||
bme680_deinit(&bme680);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
bme680.cfg.osrs_t = BME680_OVERSAMPLE_X16;
|
||||
bme680.cfg.osrs_p = BME680_OVERSAMPLE_X16;
|
||||
bme680.cfg.osrs_h = BME680_OVERSAMPLE_X8;
|
||||
bme680.cfg.filter = BME680_IIR_COEFF_127;
|
||||
|
||||
bme680.cfg.res_heat[0] = bme680_calc_target(&bme680, HEATER_TARGET, temperature);
|
||||
bme680.cfg.idac_heat[0] = BME680_IDAC(100);
|
||||
bme680.cfg.gas_wait[0] = BME680_GAS_WAIT(25, BME680_GAS_WAIT_X4);
|
||||
|
||||
bme680.setpoint = 0;
|
||||
|
||||
if (bme680_configure(&bme680) != 0) {
|
||||
fprintf(stderr, "bme680_configure()\n");
|
||||
bme680_deinit(&bme680);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (bme680_start(&bme680) != 0) {
|
||||
fprintf(stderr, "bme680_start()\n");
|
||||
bme680_deinit(&bme680);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (bme680_poll(&bme680) != 0) {
|
||||
fprintf(stderr, "bme680_poll()\n");
|
||||
bme680_deinit(&bme680);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (bme680_read(&bme680) != 0) {
|
||||
fprintf(stderr, "bme680_read()\n");
|
||||
bme680_deinit(&bme680);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
curr_time = time(NULL);
|
||||
strftime(date, 100, "%FT%T%z", localtime(&curr_time));
|
||||
printf("%s %g %g %g %g %d\n",
|
||||
date,
|
||||
bme680.fcomp.temp,
|
||||
bme680.fcomp.press,
|
||||
bme680.fcomp.hum,
|
||||
bme680.fcomp.gas_res,
|
||||
!!bme680.heat_stab);
|
||||
|
||||
temperature = bme680.fcomp.temp;
|
||||
|
||||
// 60 secs
|
||||
usleep(1000*1000*60);
|
||||
goto START;
|
||||
|
||||
bme680_deinit(&bme680);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user