Skip to content

Commit 43379fb

Browse files
authored
Merge pull request #43 from sparkfun/release_candidate
Merging the release_candidate branch for v1.7
2 parents ca07fdf + d49c5dc commit 43379fb

File tree

14 files changed

+1132
-44
lines changed

14 files changed

+1132
-44
lines changed

ADDING_SENSORS.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# OpenLog Artemis : How To Add A New Sensor
2+
3+
These are _abbreviated_ instructions on how to add a new sensor to the OLA firmware. It's more of an aide-memoire really... Sorry about that.
4+
5+
Caveat: this is _currently_ how a new sensor is added, for version v1.n of the OLA firmware using v1.2.n of the Apollo3 boards (the OLA code is compiled using the SparkFun RedBoard Artemis ATP (All The Pins) board). This will change, dramatically, when we upgrade to v2 of Apollo3 and integrate BLE support.
6+
7+
## Use The Release Candidate Branch
8+
9+
First up, please target any commits at the _**release_candidate**_ branch, so they can be tested before being merged into the _master_ branch.
10+
11+
- https://github.com/sparkfun/OpenLog_Artemis/tree/release_candidate
12+
13+
## OpenLog_Artemis.ino
14+
15+
- [Add the new sensor to the comments at the start of the file](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-7d096a133c17fd6db382abb9a3c6ea7b42ec505961876cecf404a55be5945347R71)
16+
17+
- [#include the library .h file remembering to include the library manager helper link](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-7d096a133c17fd6db382abb9a3c6ea7b42ec505961876cecf404a55be5945347R203)
18+
19+
## Sensors.ino
20+
21+
### gatherDeviceValues
22+
23+
- This is where the sensor readings are actually read. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-fba25af49a58a7a24fb75cb34321e25dd4a94a9d3515ac051fcaa4502e444f7fR725-R798)
24+
25+
### printHelperText
26+
27+
- [Add helper text for the sensor readings](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-fba25af49a58a7a24fb75cb34321e25dd4a94a9d3515ac051fcaa4502e444f7fR1132-R1165)
28+
29+
## autoDetect.ino
30+
31+
### addDevice
32+
33+
- This code is called to add the discovered device to the linked list of active devices. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR234-R239). The class name comes from the library. The config struct is defined in settings.h.
34+
35+
### beginQwiicDevices
36+
37+
- This is the code that is called to start (begin) the device. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR453-R461). Update _qwiicPowerOnDelayMillis_ if this device needs extra time to get its act together on power-up.
38+
39+
### configureDevice
40+
41+
- If the sensor needs to be configured before use, that gets done here. [Add a case for the new sensor, even if it doesn't need to be configured.](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR705-R707)
42+
43+
### getConfigFunctionPtr
44+
45+
- [Add a pointer to the sensor menu function (defined in menuAttachedDevices.ino)](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR795-R797)
46+
47+
### swap
48+
49+
- [Add the device's I2C address(es) here - just for reference (we don't use these #defines any longer)](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR929)
50+
51+
### testDevice
52+
53+
- This is the code used to detect the sensor. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR987-R994). Provide some indication of how robust the detection is. Confidence would be high if the .begin writes and reads unique data to/from the sensor. Confidence is low if .begin only uses the standard _isConnected_ I2C address test.
54+
55+
### getDeviceName
56+
57+
- This is where the sensor name is defined as text. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-68cc245ab0d3c1bed2bfc22b403edc3ed73d347a35a21179b3a6ec27a458803bR1423-R1425). Keep it brief and follow the same format as the other sensors: usually _TYPE_ (PRESSURE, TEMPERATURE etc.) followed by the abbreviated manufacturer's part number
58+
59+
## menuAttachedDevices.ino
60+
61+
### menuAttachedDevices
62+
63+
- This is the code which lists all the attached devices as a menu. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-6174875faf8039f2627c16aaf48e4db57f5a2c8c883061ac97202d74e9a46ef8R309-R311)
64+
65+
### menuConfigure_
66+
67+
- [Add a new menuConfigure_ for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-6174875faf8039f2627c16aaf48e4db57f5a2c8c883061ac97202d74e9a46ef8R2026-R2141)
68+
- Boolean settings are simple to toggle. [Make them exclusive if you need to](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-6174875faf8039f2627c16aaf48e4db57f5a2c8c883061ac97202d74e9a46ef8R1942-R1948)
69+
- _int64_t_ values are requested using _getNumber_ (defined in support.ino)
70+
- _double_ values are requested using _getDouble_ (defined in support.ino)
71+
72+
## nvm.ino
73+
74+
### recordDeviceSettingsToFile
75+
76+
- This function gets called to write the device settings to file. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-629ae89c3c660583493d544d3a7902728f4a8eefb65800c3acb64aea37d5d88dR611-R629). Include all of the sensor settings.
77+
78+
### parseDeviceLine
79+
80+
- This function gets called when the device settings are read back from file. [Add a case for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-629ae89c3c660583493d544d3a7902728f4a8eefb65800c3acb64aea37d5d88dR1116-R1150)
81+
82+
## settings.h
83+
84+
### enum
85+
86+
- [Add the device to the enumerated sensors](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-c853eddd04f78093fed5ec20b822c3c224bfa5f268738ce4c479b45667f86fe9R25). Insert the new one above _DEVICE_TOTAL_DEVICES_
87+
88+
### settings struct
89+
90+
- [Add a settings struct for the new sensor](https://github.com/sparkfun/OpenLog_Artemis/commit/2a26acd279fa93cfe84f1bc518c0e7a041b3bc44#diff-c853eddd04f78093fed5ec20b822c3c224bfa5f268738ce4c479b45667f86fe9R265-R281). Include both _log_ and _powerOnDelayMillis_
91+
92+
## README.md
93+
94+
- Add the new sensor to the list in [README.md](./README.md). Include a link to the product page
95+
- Update the OLA product page on Sparkle - add the new sensor to the list
96+
97+
## CHANGELOG.md
98+
99+
- Update [CHANGELOG.md](./CHANGELOG.md). Start a new version if you need to. Add the new sensor to the change notes
172 KB
Binary file not shown.
170 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change Log
22
======================
33

4+
v1.7
5+
---------
6+
7+
* Corrected the readVin after sleep bug [39](https://github.com/sparkfun/OpenLog_Artemis/issues/39)
8+
* Corrected detection of the MCP9600 (Qwiic Thermocouple) [41](https://github.com/sparkfun/OpenLog_Artemis/issues/41)
9+
* Added support for the MPR MicroPressure Sensor [35](https://github.com/sparkfun/OpenLog_Artemis/issues/35)
10+
* Added support for the SN-GCJA5 Particle Sensor
11+
* IMU full scale and Digital Low Pass Filter settings can now be configured via Menu 3 [42](https://github.com/sparkfun/OpenLog_Artemis/issues/42)
12+
413
v1.6
514
---------
615

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### How to Contribute
1+
# OpenLog Artemis : How to Contribute
22

33
Thank you so *much* for offering to help out. We truly appreciate it.
44

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
Find way to store device configs into EEPROM
3333
Log four pressure sensors and graph them on plotter
3434
(checked) Test GPS - not sure about %d with int32s. Does lat, long, and alt look correct?
35-
Test NAU7802s
36-
Test SCD30s
37-
Add a 'does not like to be powered cycled' setting for each device type.
35+
(done) Test NAU7802s
36+
(done) Test SCD30s (Add an extended delay for the SCD30. (Issue #5))
37+
(won't do?) Add a 'does not like to be powered cycled' setting for each device type. I think this has been superceded by "Add individual power-on delays for each sensor type?.
3838
(done) Add support for logging VIN
3939
(done) Investigate error in time between logs (https://github.com/sparkfun/OpenLog_Artemis/issues/13)
4040
(done) Invesigate RTC reset issue (https://github.com/sparkfun/OpenLog_Artemis/issues/13 + https://forum.sparkfun.com/viewtopic.php?f=123&t=53157)
@@ -44,8 +44,7 @@
4444
(done) Add a fix so that the MS8607 does not also appear as an MS5637
4545
(done) Add "set RTC from GPS" functionality
4646
(done) Add UTCoffset functionality (including support for negative numbers)
47-
Figure out how to give the u-blox time to establish a fix if it has been powered down between log intervals.
48-
Maybe add a waitForValidFix feature? Or maybe we can work around using a big value for "Set Qwiic bus power up delay"?
47+
(done) Figure out how to give the u-blox time to establish a fix if it has been powered down between log intervals. The user can specify up to 60s for the Qwiic power-on delay.
4948
Add support for VREG_ENABLE
5049
(done) Add support for PWR_LED
5150
(done) Use the WDT to reset the Artemis when power is reconnected (previously the Artemis would have stayed in deep sleep)
@@ -65,10 +64,15 @@
6564
(done) Correct the measurement count misbehaviour (Issue #31)
6665
(done) Use the corrected IMU temperature calculation (Issue #28)
6766
(done) Add individual power-on delays for each sensor type. Add an extended delay for the SCD30. (Issue #5)
67+
(done) v1.7: Fix readVin after sleep bug: https://github.com/sparkfun/OpenLog_Artemis/issues/39
68+
(done) Change detectQwiicDevices so that the MCP9600 (Qwiic Thermocouple) is detected correctly
69+
(done) Add support for the MPRLS0025PA micro pressure sensor
70+
(done) Add support for the SN-GCJA5 particle sensor
71+
(done) Add IMU accelerometer and gyro full scale and digital low pass filter settings to menuIMU
6872
*/
6973

7074
const int FIRMWARE_VERSION_MAJOR = 1;
71-
const int FIRMWARE_VERSION_MINOR = 6;
75+
const int FIRMWARE_VERSION_MINOR = 7;
7276

7377
//Define the OLA board identifier:
7478
// This is an int which is unique to this variant of the OLA and which allows us
@@ -78,7 +82,7 @@ const int FIRMWARE_VERSION_MINOR = 6;
7882
// the variant * 0x100 (OLA = 1; GNSS_LOGGER = 2; GEOPHONE_LOGGER = 3)
7983
// the major firmware version * 0x10
8084
// the minor firmware version
81-
#define OLA_IDENTIFIER 0x116
85+
#define OLA_IDENTIFIER 0x117 // Stored as 279 decimal in OLA_settings.txt
8286

8387
#include "settings.h"
8488

@@ -195,6 +199,8 @@ ICM_20948_SPI myICM;
195199
#include "SparkFun_Qwiic_Humidity_AHT20.h" //Click here to get the library: http://librarymanager/All#Qwiic_Humidity_AHT20 by SparkFun
196200
#include "SparkFun_SHTC3.h" // Click here to get the library: http://librarymanager/All#SparkFun_SHTC3
197201
#include "SparkFun_ADS122C04_ADC_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_ADS122C04
202+
#include "SparkFun_MicroPressure.h" // Click here to get the library: http://librarymanager/All#SparkFun_MicroPressure
203+
#include "SparkFun_Particle_Sensor_SN-GCJA5_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_Particle_Sensor_SN-GCJA5
198204

199205
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
200206

@@ -675,7 +681,35 @@ void beginIMU()
675681
checkBattery();
676682
delay(1);
677683
}
678-
684+
685+
//Update the full scale and DLPF settings
686+
ICM_20948_Status_e retval = myICM.enableDLPF(ICM_20948_Internal_Acc, settings.imuAccDLPF);
687+
if (retval != ICM_20948_Stat_Ok)
688+
{
689+
Serial.println(F("Error: Could not configure the IMU Accelerometer DLPF!"));
690+
}
691+
retval = myICM.enableDLPF(ICM_20948_Internal_Gyr, settings.imuGyroDLPF);
692+
if (retval != ICM_20948_Stat_Ok)
693+
{
694+
Serial.println(F("Error: Could not configure the IMU Gyro DLPF!"));
695+
}
696+
ICM_20948_dlpcfg_t dlpcfg;
697+
dlpcfg.a = settings.imuAccDLPFBW;
698+
dlpcfg.g = settings.imuGyroDLPFBW;
699+
retval = myICM.setDLPFcfg((ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), dlpcfg);
700+
if (retval != ICM_20948_Stat_Ok)
701+
{
702+
Serial.println(F("Error: Could not configure the IMU DLPF BW!"));
703+
}
704+
ICM_20948_fss_t FSS;
705+
FSS.a = settings.imuAccFSS;
706+
FSS.g = settings.imuGyroFSS;
707+
retval = myICM.setFullScale((ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), FSS);
708+
if (retval != ICM_20948_Stat_Ok)
709+
{
710+
Serial.println(F("Error: Could not configure the IMU Full Scale!"));
711+
}
712+
679713
online.IMU = true;
680714
}
681715
else

0 commit comments

Comments
 (0)