Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version name #112

Merged
merged 3 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
######################################################

SRC_VER=`cat library.properties | grep version | sed -n -e 's/^.*version=//p'`
SRC_REV=`cat platformio.ini | grep SRC_REV | sed -n -e 's/^.*SRC_REV=//p'`
HDR_VER=`cat src/Sensors.hpp | grep CSL_VERSION | awk '{ print $3 }'`
SRC_REV=`cat src/Sensors.hpp | grep CSL_REVISION | awk '{ print $3 }'`
DATE=`date +%Y%m%d`
RELDIR="releases"
RELNAME="CanAirIOAirQualitySensorsLibrary-${SRC_VER}.tar.gz"
Expand All @@ -30,6 +31,29 @@ showHelp () {
echo ""
}

validate_version() {
if [ "\"${SRC_VER}\"" != "${HDR_VER}" ]; then
echo ""
echo "Error: Version mistmatch with header version!"
echo ""
echo "revision library: $SRC_REV"
echo "version library : \"$SRC_VER\""
echo "version header : $HDR_VER"
exit 1
fi
}

validate_branch () {
current_branch=`git rev-parse --abbrev-ref HEAD`

if [ ${current_branch} != "master" ]; then
echo ""
echo "Error: you are in ${current_branch} branch please change to master branch."
echo ""
exit 1
fi
}

clean () {
rm -f $OUTPUT
}
Expand Down Expand Up @@ -76,18 +100,11 @@ publish_pio () {
pio package publish
}

current_branch=`git rev-parse --abbrev-ref HEAD`

if [ ${current_branch} != "master" ]; then
echo ""
echo "Error: you are in ${current_branch} branch please change to master branch."
echo ""
exit 1
fi

if [ "$1" = "" ]; then
showHelp
else
validate_version
validate_branch
case "$1" in
clean)
clean
Expand Down
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.4.1",
"version": "0.4.2",
"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.4.1
version=0.4.2
author=@hpsaturn, CanAirIO project <[email protected]>
maintainer=Antonio Vanegas <[email protected]>
url=https://github.com/kike-canaries/canairio_sensorlib
Expand Down
5 changes: 2 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ upload_speed = 1500000
monitor_speed = 115200
monitor_filters = time
build_flags =
-D SRC_REV=340
-D CORE_DEBUG_LEVEL=0
lib_deps =
adafruit/Adafruit Unified Sensor @ 1.1.4
adafruit/Adafruit Unified Sensor @ 1.1.4
adafruit/Adafruit BME280 Library @ 2.2.1
adafruit/Adafruit BMP280 Library @ 2.4.3
adafruit/Adafruit BME680 Library @ 2.0.1
Expand All @@ -27,7 +26,7 @@ lib_deps =
paulvha/sps30 @ 1.4.11
wifwaf/MH-Z19 @ 1.5.3
sparkfun/SparkFun SCD30 Arduino Library @ 1.0.16
sensirion/Sensirion Core @ 0.5.3
sensirion/Sensirion Core @ 0.5.3
sensirion/Sensirion I2C SCD4x @ 0.3.1
https://github.com/hpsaturn/DHT_nonblocking.git
https://github.com/paulvha/SN-GCJA5.git
Expand Down
18 changes: 14 additions & 4 deletions src/Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ void Sensors::init(int pms_type, int pms_rx, int pms_tx) {
#endif
if (devmode) Serial.println("-->[SLIB] debug is enable.");

Serial.println("-->[SLIB] temperature offset: " + String(toffset));
Serial.println("-->[SLIB] altitude offset: " + String(altoffset));
Serial.println("-->[SLIB] forced only i2c sensors: " + String(i2conly));
Serial.println("-->[SLIB] Sensorlib version :\t" + getLibraryVersion());
Serial.println("-->[SLIB] Sensorlib revision:\t" + String(getLibraryRevision()));
Serial.println("-->[SLIB] temperature offset:\t" + String(toffset));
Serial.println("-->[SLIB] altitude offset :\t" + String(altoffset));
Serial.println("-->[SLIB] only i2c sensors :\t" + String(i2conly));

if (!i2conly && !sensorSerialInit(pms_type, pms_rx, pms_tx)) {
DEBUG("-->[SLIB] not found any PM sensor via UART");
Expand Down Expand Up @@ -93,7 +95,7 @@ void Sensors::init(int pms_type, int pms_rx, int pms_tx) {
/// set loop time interval for each sensor sample
void Sensors::setSampleTime(int seconds) {
sample_time = seconds;
Serial.println("-->[SLIB] new sample time: " + String(seconds));
Serial.println("-->[SLIB] new sample time :\t" + String(seconds));
if(getMainDeviceSelected().equals("SCD30")){
scd30.setMeasurementInterval(seconds);
Serial.println("-->[SLIB] SCD30 interval time to: " + String(seconds));
Expand Down Expand Up @@ -284,6 +286,14 @@ void Sensors::detectI2COnly(bool enable) {
i2conly = enable;
}

String Sensors::getLibraryVersion() {
return String(CSL_VERSION);
}

int16_t Sensors::getLibraryRevision() {
return CSL_REVISION;
}

/******************************************************************************
* U A R T S E N S O R P R I V A T E M E T H O D S
******************************************************************************/
Expand Down
18 changes: 10 additions & 8 deletions src/Sensors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
#include <s8_uart.h>
#include <SensirionI2CScd4x.h>

using namespace std;
#include <vector>

/******************************************************************************
* S E T U P ESP32 B O A R D S A N D F I E L D S
* -------------------------------------------
* Please select the board on platformio.ini file or pass it via build flag
******************************************************************************/
#define CSL_VERSION "0.4.2"
#define CSL_REVISION 341

/***************************************************************
* 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
***************************************************************/
#ifdef WEMOSOLED
#define PMS_RX 13 // config for Wemos board & TTGO18650
#define PMS_TX 15 // some old TTGO18650 have PMS_RX 18 & PMS_TX 17
Expand Down Expand Up @@ -212,6 +210,10 @@ class Sensors {

void detectI2COnly(bool enable);

String getLibraryVersion();

int16_t getLibraryRevision();

private:
/// DHT library
uint32_t delayMS;
Expand Down