Skip to content

Commit

Permalink
Merge pull request #209 from kike-canaries/air_gradient_drivers
Browse files Browse the repository at this point in the history
Air gradient PM driver test
  • Loading branch information
hpsaturn authored Jun 13, 2024
2 parents e937396 + 17acd44 commit d96782d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples/m5atom/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ build_flags =
lib_deps =
hpsaturn/CanAirIO Air Quality Sensors Library @ 0.7.4
fastled/FastLED@^3.5.0
m5stack/M5Atom@^0.0.7
m5stack/M5Atom@^0.1.2
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CanAirIO Air Quality Sensors Library",
"version": "0.7.4",
"version": "0.7.5",
"homepage":"https://canair.io",
"keywords":
[
Expand Down Expand Up @@ -86,7 +86,7 @@
{"name":"AM232X", "owner":"robtillaart", "version":"0.5.0"},
{"name":"sps30", "owner":"paulvha","version":"1.4.17"},
{"name":"MH-Z19", "owner":"wifwaf", "version":"1.5.4"},
{"name":"S8_UART", "owner":"jcomas", "version":"1.0.1"},
{"name":"S8_UART", "owner":"jcomas", "version":"1.0.2"},
{"name":"Sensirion Core","owner":"sensirion","version":"0.6.0"},
{"name":"Sensirion I2C SCD4x","owner":"sensirion","version":"0.4.0"},
{"name":"Sensirion I2C SEN5X","owner":"sensirion","version":"0.3.0"},
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=CanAirIO Air Quality Sensors Library
version=0.7.4
version=0.7.5
author=@hpsaturn, CanAirIO project <[email protected]>
maintainer=Antonio Vanegas <[email protected]>
url=https://github.com/kike-canaries/canairio_sensorlib
Expand Down
33 changes: 8 additions & 25 deletions src/Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,9 @@ void Sensors::startI2C() {
Wire.begin(I2C1_SDA_PIN, I2C1_SCL_PIN);
enableWire1();
#endif
#ifdef ESP32C3_AIRGRADIENT
Wire.begin(7, 6);
#endif
}

void Sensors::enableWire1() {
Expand Down Expand Up @@ -2006,36 +2009,16 @@ bool Sensors::serialInit(u_int pms_type, unsigned long speed_baud, int pms_rx, i
if (devmode)
Serial.printf("-->[SLIB] UART init with speed\t: %lu TX:%i RX:%i\r\n", speed_baud, pms_tx,
pms_rx);
#if ARDUINO_USB_CDC_ON_BOOT // Serial used for USB CDC
Serial0.begin(9600, SERIAL_8N1);
_serial = &Serial0;
return true;
#endif
switch (SENSOR_COMMS) {
case SERIALPORT:
Serial.begin(speed_baud);
_serial = &Serial;
break;
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(SAMD21G18A) || \
defined(ARDUINO_SAM_DUE)
case SERIALPORT1:
Serial1.begin(speed_baud);
_serial = &Serial1;
break;
#endif
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(ARDUINO_SAM_DUE)
case SERIALPORT2:
Serial2.begin(speed_baud);
_serial = &Serial2;
break;

case SERIALPORT3:
Serial3.begin(speed_baud);
_serial = &Serial3;
break;
#endif
#if defined(__AVR_ATmega32U4__)
case SERIALPORT1:
Serial1.begin(speed_baud);
_serial = &Serial1;
break;
#endif

#if defined(ARDUINO_ARCH_ESP32)
// on a Sparkfun ESP32 Thing the default pins for serial1 are used for acccessing flash memory
// you have to define different pins upfront in order to use serial1 port.
Expand Down
7 changes: 5 additions & 2 deletions src/Sensors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <dht_nonblocking.h>
#endif

#define CSL_VERSION "0.7.4"
#define CSL_REVISION 383
#define CSL_VERSION "0.7.5"
#define CSL_REVISION 384

/***************************************************************
* S E T U P E S P 3 2 B O A R D S A N D F I E L D S
Expand Down Expand Up @@ -69,6 +69,9 @@
#elif ESP32C3
#define PMS_RX 20
#define PMS_TX 21
#elif ESP32C3_AIRGRADIENT
#define PMS_RX 0
#define PMS_TX 1

#else // **DEFAULT** for legacy CanAirIO devices:
#define PMS_RX 17 // D1MIN1 / TTGOT7 / ESP32DEVKIT, also for main ESP32 dev boards use it
Expand Down
2 changes: 1 addition & 1 deletion unified-lib-deps.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lib_deps =
robtillaart/[email protected]
paulvha/[email protected]
wifwaf/[email protected]
jcomas/[email protected].1
jcomas/[email protected].2
sensirion/Sensirion [email protected]
sensirion/Sensirion I2C [email protected]
sensirion/Sensirion I2C SEN5X @ 0.3.0
Expand Down

0 comments on commit d96782d

Please sign in to comment.