Skip to content

Commit

Permalink
fixed issue with Serial2 validation for ESP32C3
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Feb 6, 2023
1 parent ddff9ac commit 8f728a4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CanAirIO Air Quality Sensors Library",
"version": "0.6.5",
"version": "0.6.6",
"homepage":"https://canair.io",
"keywords":
[
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.6.5
version=0.6.6
author=@hpsaturn, CanAirIO project <[email protected]>
maintainer=Antonio Vanegas <[email protected]>
url=https://github.com/kike-canaries/canairio_sensorlib
Expand Down
15 changes: 8 additions & 7 deletions src/Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ bool Sensors::pmGenericRead() {
String txtMsg = hwSerialRead(lenght_buffer);
if (txtMsg[0] == 66) {
if (txtMsg[1] == 77) {
DEBUG("-->[SLIB] UART PMGENERIC read \t\t: done!");
DEBUG("-->[SLIB] UART PMGENERIC read!\t: :D");
pm25 = txtMsg[6] * 256 + (char)(txtMsg[7]);
pm10 = txtMsg[8] * 256 + (char)(txtMsg[9]);

Expand Down Expand Up @@ -1650,7 +1650,7 @@ void Sensors::disableWire1() {
}

bool Sensors::serialInit(u_int pms_type, unsigned long speed_baud, int pms_rx, int pms_tx) {
if(devmode)Serial.printf("-->[SLIB] UART init with speed\t: %lu RX:%i TX:%i\n", speed_baud, pms_rx, pms_tx);
if(devmode)Serial.printf("-->[SLIB] UART init with speed\t: %lu TX:%i RX:%i\n", speed_baud, pms_tx, pms_rx);
switch (SENSOR_COMMS) {
case SERIALPORT:
Serial.begin(speed_baud);
Expand Down Expand Up @@ -1692,19 +1692,20 @@ bool Sensors::serialInit(u_int pms_type, unsigned long speed_baud, int pms_rx, i
Serial1.begin(speed_baud, SERIAL_8N1, pms_rx, pms_tx, false);
_serial = &Serial1;
break;
#ifdef Serial2
case SERIALPORT2:
#if SOC_UART_NUM > 2
DEBUG("-->[SLIB] UART COMM port \t: Serial2");
if (pms_type == SENSORS::SSPS30)
Serial2.begin(speed_baud);
else
Serial2.begin(speed_baud, SERIAL_8N1, pms_rx, pms_tx, false);
_serial = &Serial2;
break;
#else
DEBUG("-->[SLIB] UART COMM port \t: Undefined");
return false;
#endif // Serial2
#else
DEBUG("-->[SLIB] Force UART port \t: Serial1");
Serial1.begin(speed_baud, SERIAL_8N1, pms_rx, pms_tx);
_serial = &Serial1;
#endif
#endif
default:

Expand Down
2 changes: 1 addition & 1 deletion src/Sensors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <dht_nonblocking.h>
#endif

#define CSL_VERSION "0.6.5"
#define CSL_VERSION "0.6.6"
#define CSL_REVISION 373

/***************************************************************
Expand Down

0 comments on commit 8f728a4

Please sign in to comment.