Skip to content

Commit

Permalink
update library.json, license, minor edits (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Dec 22, 2021
1 parent b469dc9 commit 9847929
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 48 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-2021 Rob Tillaart
Copyright (c) 2021-2022 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions MTP40C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FILE: MTP40C.h
// AUTHOR: Rob Tillaart
// DATE: 2021-08-20
// VERSION: 0.2.0
// VERSION: 0.2.1
// PURPOSE: Arduino library for MTP40C MTP40D CO2 sensor
// URL: https://github.com/RobTillaart/MTP40C
//
Expand All @@ -11,6 +11,7 @@
// 0.1.1 2021-08-23 added examples, minor fixes
// 0.2.0 2021-08-27 added MTP40D derived class
// + many fixes after testing
// 0.2.1 2021-12-22 update library.json, license, minor edits


#include "MTP40C.h"
Expand Down Expand Up @@ -391,5 +392,5 @@ MTP40D::MTP40D(Stream * str) : MTP40(str)
};



// -- END OF FILE --

15 changes: 8 additions & 7 deletions MTP40C.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// FILE: MTP40C.h
// AUTHOR: Rob Tillaart
// DATE: 2021-08-20
// VERSION: 0.2.0
// VERSION: 0.2.1
// PURPOSE: Arduino library for MTP40C + MTP40D CO2 sensor
// URL: https://github.com/RobTillaart/MTP40C
//
Expand All @@ -17,15 +17,15 @@
#include "Arduino.h"


#define MTP40_LIB_VERSION (F("0.2.0"))
#define MTP40_LIB_VERSION (F("0.2.1"))


#define MTP40_DEFAULT_ADDRESS 0x64
#define MTP40_DEFAULT_ADDRESS 0x64

#define MTP40_OK 0x00
#define MTP40_INVALID_AIR_PRESSURE 0x01
#define MTP40_INVALID_GAS_LEVEL 0x02
#define MTP40_INVALID_ADDRESS 0xFF
#define MTP40_OK 0x00
#define MTP40_INVALID_AIR_PRESSURE 0x01
#define MTP40_INVALID_GAS_LEVEL 0x02
#define MTP40_INVALID_ADDRESS 0xFF


class MTP40
Expand Down Expand Up @@ -118,3 +118,4 @@ class MTP40D : public MTP40


// -- END OF FILE --

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ moments. Valid values are 24 - 720 .
- optimize performance if possible
- caching? what?
- seek optimum delay() between calls.
- investigate wire length

#### Other

- serial bus with multiple devices? => diodes
- improve readability code (e.g. parameter names)


## Operations
Expand Down
2 changes: 1 addition & 1 deletion examples/MTP40C_getAddress/MTP40C_getAddress.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40C_getAddress.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-21
// URL: https://github.com/RobTillaart/MTP40C
Expand Down Expand Up @@ -56,3 +55,4 @@ void loop()


// -- END OF FILE --

4 changes: 2 additions & 2 deletions examples/MTP40C_getCO2/MTP40C_getCO2.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//
// FILE: MTP40C_getCO2.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-21
// URL: https://github.com/RobTillaart/MTP40C
//
// any board that support two or more hardware serial ports
// any board that support two or more hardware serial ports
// Serial and Serial1, e.g. for MEGA, LEONARDO, MICRO, ESP32,ESP8266
// Uno, Nano or Mini will fail to compile.

Expand Down Expand Up @@ -61,3 +60,4 @@ void loop()


// -- END OF FILE --

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40C_getCO2_SW_SERIAL.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-21
// URL: https://github.com/RobTillaart/MTP40C
Expand Down Expand Up @@ -56,3 +55,4 @@ void loop()


// -- END OF FILE --

6 changes: 3 additions & 3 deletions examples/MTP40C_getCO2_plotter/MTP40C_getCO2_plotter.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//
// FILE: MTP40C_getCO2_plotter.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-23
// URL: https://github.com/RobTillaart/MTP40C
//
// any board that support two or more hardware serial ports
// any board that support two or more hardware serial ports
// Serial and Serial1, e.g. for MEGA, LEONARDO, MICRO, ESP32,ESP8266
// Uno, Nano or Mini will fail to compile.
//
Expand Down Expand Up @@ -44,10 +43,11 @@ void loop()
{
if (millis() - mtp.lastRead() >= 5000)
{
Serial.print(mtp.getGasConcentration());
Serial.print(mtp.getGasConcentration());
Serial.println();
}
}


// -- END OF FILE --

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40C_getPressureReference.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-21
// URL: https://github.com/RobTillaart/MTP40C
Expand Down Expand Up @@ -57,3 +56,4 @@ void loop()


// -- END OF FILE --

2 changes: 1 addition & 1 deletion examples/MTP40C_selfCalibration/MTP40C_selfCalibration.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40C_selfCalibration.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-23
// URL: https://github.com/RobTillaart/MTP40C
Expand Down Expand Up @@ -79,3 +78,4 @@ void loop()


// -- END OF FILE --

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40C_setPressureReference.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-21
// URL: https://github.com/RobTillaart/MTP40C
Expand Down Expand Up @@ -41,7 +40,7 @@ void setup()
Serial.println(mtp.getAirPressureReference(), 1);
delay(100);


Serial.print("1013:\t");
Serial.println(mtp.setAirPressureReference(1013.0));
delay(5000);
Expand Down Expand Up @@ -70,3 +69,4 @@ void loop()


// -- END OF FILE --

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40C_singlePointCorrection.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-23
// URL: https://github.com/RobTillaart/MTP40C
Expand Down
3 changes: 1 addition & 2 deletions examples/MTP40D_I2C_demo/MTP40D_I2C_demo.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//
// FILE: MTP40D_I2C_demo.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40D I2C interface
// DATE: 2021-08-27
// URL: https://github.com/RobTillaart/MTP40C
//

//
// TODO TEST WITH SENSOR
// do not expect this to work yet

Expand Down
6 changes: 3 additions & 3 deletions examples/MTP40D_PWM_demo/MTP40D_PWM_demo.ino
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
//
// FILE: MTP40D_PWM_demo.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of MTP40D PWM interface
// DATE: 2021-08-27
// URL: https://github.com/RobTillaart/MTP40C
//

//
// TODO TEST WITH MTP40D SENSOR
//
// Connect the PWM output to the interrup pin 2 or 3 of the UNO.
// Connect the PWM output to the interrupt pin 2 or 3 of the UNO.
// other processors interrupts pins work slightly different


Expand Down Expand Up @@ -61,3 +60,4 @@ uint16_t duration2PPM(uint16_t d)


// -- END OF FILE --

5 changes: 2 additions & 3 deletions examples/MTP40_scanner/MTP40_scanner.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MTP40_scanner.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: demo of MTP40C library
// DATE: 2021-08-21
// URL: https://github.com/RobTillaart/MTP40C
Expand All @@ -16,7 +15,7 @@

SoftwareSerial sws(6, 7);

MTP40C mtp(&sws); // use hardware Serial1 for MTP40C sensor
MTP40C mtp(&sws); // optional use hardware Serial1 for MTP40C sensor


void setup()
Expand Down Expand Up @@ -102,5 +101,5 @@ void detect_scan()
}



// -- END OF FILE --

2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/MTP40C.git"
},
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",
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=MTP40C
version=0.2.0
version=0.2.1
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for MTP40, MTP40C and MTP40D CO2 sensor
Expand Down
26 changes: 10 additions & 16 deletions test/unit_test_001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

unittest_setup()
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", (char *) MTP40_LIB_VERSION);
}


Expand All @@ -58,10 +59,17 @@ unittest_teardown()
}


unittest(test_getType)
unittest(test_constants)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);
assertEqual(MTP40_OK , 0x00);
assertEqual(MTP40_INVALID_AIR_PRESSURE, 0x01);
assertEqual(MTP40_INVALID_GAS_LEVEL , 0x02);
assertEqual(MTP40_INVALID_ADDRESS , 0xFF);
}


unittest(test_getType)
{
MTP40C sensorC = MTP40C(&Serial);
assertEqual(2, sensorC.getType());

Expand All @@ -76,8 +84,6 @@ unittest(test_getType)

unittest(test_begin)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);

for (int addr = 248; addr < 256; addr++)
Expand All @@ -92,8 +98,6 @@ unittest(test_begin)

unittest(test_address)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);
// assertTrue(sensor.begin()); blocks!

Expand All @@ -108,8 +112,6 @@ unittest(test_address)

unittest(test_air_pressure)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);
// assertTrue(sensor.begin()); // default address

Expand All @@ -123,8 +125,6 @@ unittest(test_air_pressure)

unittest(test_gas_concentration)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);
// assertTrue(sensor.begin());

Expand All @@ -134,8 +134,6 @@ unittest(test_gas_concentration)

unittest(test_single_point_correction)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);
// assertTrue(sensor.begin());

Expand All @@ -149,8 +147,6 @@ unittest(test_single_point_correction)

unittest(test_self_calibration)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);
// assertTrue(sensor.begin()); // default address

Expand All @@ -162,8 +158,6 @@ unittest(test_self_calibration)

unittest(test_self_calibration_hours)
{
fprintf(stderr, "MTP40_LIB_VERSION:\t%s\n", MTP40_LIB_VERSION);

MTP40C sensor = MTP40C(&Serial);
// assertTrue(sensor.begin()); // default address

Expand Down

0 comments on commit 9847929

Please sign in to comment.