Skip to content

Commit

Permalink
add changelog.md (#5)
Browse files Browse the repository at this point in the history
* add changelog.md
  • Loading branch information
RobTillaart authored Nov 22, 2022
1 parent 0d104fc commit 2fefd9a
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 49 deletions.
19 changes: 18 additions & 1 deletion .arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:

packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# selected only those that work
platforms:
- uno
# - due
# - zero
# - leonardo
- m4
- esp32
# - esp8266
- esp8266
# - mega2560
- rpipico
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Change Log pressure

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.2.2] - 2022-11-22
- add changelog.md
- add RP2040 to build-CI
- minor edits


## [0.2.1] - 2021-12-23
- update library.json
- update license
- add experimental gas law

## [0.2.0] - 2021-11-25
- Fix formulas

----

## [0.1.0] - 2021-11-25
- Initial version


























## [0.1.1] - 2022-10-14

- add parameter to begin(float percentage)
- refactored stop()
- refactored setPercentage()
- remapped the 0-100% to 2000-2500 microseconds of servo as
the full 1600-2500 range was only active above 50~60%
depending on the voltage used.
- add forward(), backward() + example.
- add setInvert(flag = false)
- updated readme.md


## [0.1.0] - 2022-10-13

- initial version
- add stop(), get- and setPercentage()
- add getSeconds(), resetSeconds() for simple duration management.
- **low percentages < 50% do not work.**


52 changes: 42 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ In fact it just hides all conversion constants.

Pressure is implemented as a float so this limits the precision of the value.

Note: as the conversion is 2 steps the conversion error might be larger than in a single conversion step.
If other constants / conversions are needed please open an issue on GitHub.

Note: as a conversion uses two steps the conversion error might be (bit) larger
than in a single conversion step as there are two multiplications involved.

Note: constants need to be verified.

Expand All @@ -32,7 +35,7 @@ Note: constants need to be verified.
- **pressure(float value = 0.0)** Constructor, with optional initial value.


#### setters
#### Setters

- **void setMilliBar(float value)** sets pressure in milliBar.
- **void setBar(float value)** sets pressure in bar.
Expand All @@ -48,7 +51,7 @@ Note: constants need to be verified.
- **void setMSW(float value)** sets pressure in Meters of Sea Water. (under water pressure unit).


#### getters
#### Getters

- **float getMilliBar()** returns pressure in milliBar.
- **float getBar()** returns pressure in bar.
Expand All @@ -66,14 +69,20 @@ Note: constants need to be verified.

#### Gas law (experimental see below)

- **change(float T1, float T2, float V1 = 1, float V2 = 1, float N1 = 1, float N2 = 1)**
apply changing temperature (**Kelvin**), volume (m3) and moles. If an parameter does not change
just fill in the value 1 for both before and after.
The **change()** function is applied to the current internal pressure.

- **void change(float T1, float T2, float V1, float V2, float N1, float N2)**
- apply changing temperature (**Kelvin**),
- volume (m3) and moles.
- If an parameter does not change fill in 1 for both before (T1,V1, N1) and after (T2,V2,n2).
- **void changeT(float T1, float T2)** only change temperature. T in **Kelvin**.
- **void changeV(float V1, float V2)** only change volume.
- **void changeN(float N1, float N2)** only change moles.


#### constants
#### Constants

The library has a number of constants to convert units.
The library has a number of constants to convert units. See the pressure.h file.
These constants can be used to write specific convertors or define specific constants.

A dedicated conversion is faster as it has only one float multiplication runtime.
Expand All @@ -94,7 +103,6 @@ float out = in * (PSI2MSW);
```



## Operation

```cpp
Expand All @@ -116,7 +124,7 @@ Version 0.1.0 has incorrect setters. fixed in version 0.2.0.

#### Experimental 0.2.1

Apply the ideal gas law : **PxV / nxT = Constant**
Apply the ideal gas law : **P x V / n x T = Constant**

- **void change(float T1, float T2, float V1, float V2, float N1, float N2)**
- T (temperature) in Kelvin,
Expand All @@ -137,14 +145,38 @@ x = P.getPressure()
- do we need a **changeTC(float T1, float T2)** only change temperature, T in Celsius
- should functions return bool true on success ?

```cpp
Kelvin = Celsius + 273.15;
Kelvin = (Fahrenheit - 32) \* 5 / 9 + 273.15;
Kelvin = Fahrenheit \* 5 / 9 + 290.93; // one operator less.
```


## Future

#### must
- update documentation
- find a good reference for conversion formula constants.


#### should
- test with gas law.
- calculate getter constants from setter constants. 1.0 / XXX
- rename parameters so they make more sense?
```
void setMilliBar(float milliBar ) { _pressure = milliBar; };
void setBar(float Bar) { _pressure = Bar * BAR2MILLIBAR; };
void setPSI(float PSI) { _pressure = PSI * PSI2MILLIBAR; };
```



#### could
- defaults for functions? 0 like constructor?
- move code to .cpp file ?
- change could return int indicating
- 1: a change is made.
- 0: no change is made
- -1: parameter negative
- change could return a float indicating the new pressure in mBar?

4 changes: 3 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Syntax Colouring Map For I2C_ASDX
# Syntax Colouring Map For pressure


# Data types (KEYWORD1)
Expand Down Expand Up @@ -42,6 +42,8 @@ changeN KEYWORD2


# Constants (LITERAL1)
PRESSURE_LIB_VERSION LITERAL1

BAR2MILLIBAR LITERAL1
ATM2MILLIBAR LITERAL1
PSI2MILLIBAR LITERAL1
Expand Down
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/pressure.git"
},
"version": "0.2.1",
"version": "0.2.2",
"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=pressure
version=0.2.1
version=0.2.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for pressure conversion
Expand Down
65 changes: 30 additions & 35 deletions pressure.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,50 @@
//
// FILE: pressure.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.1
// VERSION: 0.2.2
// PURPOSE: Arduino library for pressure conversion
// URL: https://github.com/RobTillaart/pressure
//
// HISTORY
// 0.1.0 2021-11-25 Initial version
// 0.2.0 2021-11-25 Fix formulas
// 0.2.1 2021-12-23 update library.json, license
// add experimental gas law.


#define PRESSURE_LIB_VERSION (F("0.2.1"))

#define PRESSURE_LIB_VERSION (F("0.2.2"))


// CONSTANTS NEED TO BE VERIFIED
// Temperature 25°C ?

// CONSTANTS SETTERS
#define BAR2MILLIBAR 1000
#define ATM2MILLIBAR 1013.25
#define PSI2MILLIBAR 68.9475729318
#define DYNES2MILLIBAR 0.001
#define INHG2MILLIBAR 33.85355
#define INH2O2MILLIBAR 2.4908890833333
#define PASCAL2MILLIBAR 0.01
#define TORR2MILLIBAR 1.33322368
#define CMHG2MILLIBAR 13.3322368
#define CMH2O2MILLIBAR 0.980665
#define MSW2MILLIBAR 0.01
#define BAR2MILLIBAR 1000
#define ATM2MILLIBAR 1013.25
#define PSI2MILLIBAR 68.9475729318
#define DYNES2MILLIBAR 0.001
#define INHG2MILLIBAR 33.85355
#define INH2O2MILLIBAR 2.4908890833333
#define PASCAL2MILLIBAR 0.01
#define TORR2MILLIBAR 1.33322368
#define CMHG2MILLIBAR 13.3322368
#define CMH2O2MILLIBAR 0.980665
#define MSW2MILLIBAR 0.01

// CONSTANTS GETTERS
#define MILLIBAR2BAR 0.001
#define MILLIBAR2ATM 9.86923267e-4
#define MILLIBAR2PSI 0.0145037738
#define MILLIBAR2DYNES 1000
#define MILLIBAR2INHG 2.9539e-2
#define MILLIBAR2INH2O 0.40146307866177
#define MILLIBAR2PASCAL 100
#define MILLIBAR2TORR 0.750061683
#define MILLIBAR2CMHG 0.0750061683
#define MILLIBAR2CMH2O 1.0197162129779
#define MILLIBAR2MSW 100
#define MILLIBAR2BAR 0.001
#define MILLIBAR2ATM 9.86923267e-4
#define MILLIBAR2PSI 0.0145037738
#define MILLIBAR2DYNES 1000
#define MILLIBAR2INHG 2.9539e-2
#define MILLIBAR2INH2O 0.40146307866177
#define MILLIBAR2PASCAL 100
#define MILLIBAR2TORR 0.750061683
#define MILLIBAR2CMHG 0.0750061683
#define MILLIBAR2CMH2O 1.0197162129779
#define MILLIBAR2MSW 100


class pressure
{
public:
// CONSTRUCTOR
pressure(float value = 0) { _pressure = value; };
pressure(float value = 0.0) { _pressure = value; };


void setMilliBar(float value) { _pressure = value; };
Expand Down Expand Up @@ -81,16 +76,16 @@ class pressure
float getMSW() { return _pressure * MILLIBAR2MSW; }


// EXPERIMENTAL
// temperature in Kelvin!
// EXPERIMENTAL
// temperature in KELVIN !
void change(float T1, float T2, float V1, float V2, float N1, float N2)
{
changeT(T1, T2);
changeV(V1, V2);
changeN(N1, N2);
}

// temperature in Kelvin!
// temperature in KELVIN!
void changeT(float T1, float T2)
{
if ((T1 != T2) && (T1 > 0) && (T2 > 0)) _pressure *= (T2 / T1);
Expand All @@ -110,7 +105,7 @@ class pressure


private:
float _pressure;
float _pressure; // millibar.
};


Expand Down

0 comments on commit 2fefd9a

Please sign in to comment.