Skip to content

Commit 16997bb

Browse files
committed
0.3.3 pressure
1 parent 91a9129 commit 16997bb

File tree

15 files changed

+63
-20
lines changed

15 files changed

+63
-20
lines changed

libraries/pressure/.github/workflows/arduino-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
runs-on: ubuntu-latest
77
timeout-minutes: 5
88
steps:
9-
- uses: actions/checkout@v4
10-
- uses: arduino/arduino-lint-action@v1
9+
- uses: actions/checkout@v5
10+
- uses: arduino/arduino-lint-action@v2
1111
with:
1212
library-manager: update
1313
compliance: strict

libraries/pressure/.github/workflows/arduino_test_runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
timeout-minutes: 20
99

1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212
- uses: ruby/setup-ruby@v1
1313
with:
1414
ruby-version: 2.6

libraries/pressure/.github/workflows/jsoncheck.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ on:
55
paths:
66
- '**.json'
77
pull_request:
8+
paths:
9+
- '**.json'
810

911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
1214
timeout-minutes: 5
1315
steps:
14-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1517
- name: json-syntax-check
1618
uses: limitusus/json-syntax-check@v2
1719
with:

libraries/pressure/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.3.2] - 2025-11-26
10+
- add setKGCM2() + getKGCM2()
11+
- update GitHub actions
12+
- minor edits
13+
914
## [0.3.2] - 2024-10-27
1015
- fix #7, improve gas law functions
1116
- add conversion factor functions

libraries/pressure/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2024 Rob Tillaart
3+
Copyright (c) 2021-2025 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

libraries/pressure/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ than in a single conversion step as there are two multiplications involved.
3131

3232
Note: constants need to be verified.
3333

34+
As always, feedback is welcome.
35+
3436

3537
### Related
3638

37-
- https://github.com/RobTillaart/temperature (a bit)
39+
- https://github.com/RobTillaart/pressure - pressure conversions
40+
- https://github.com/RobTillaart/Temperature - temperature conversions
41+
- https://github.com/RobTillaart/MS5837 - temperature pressure sensor (incl pressure to altitude)
42+
- https://github.com/RobTillaart/MS5611 - temperature pressure sensor (incl pressure to altitude)
43+
- https://github.com/RobTillaart/MSP300 - industrial pressure transducer
44+
- https://swharden.com/blog/2017-04-29-precision-pressure-meter-project/
3845

3946

4047
## Interface
@@ -62,7 +69,7 @@ Note: constants need to be verified.
6269
- **void setCmHg(float value)** sets pressure in centimetre mercury.
6370
- **void setCmH2O(float value)** sets pressure in centimetre water.
6471
- **void setMSW(float value)** sets pressure in Meters of Sea Water. (under water pressure unit).
65-
72+
- **void setKGCM2(float value)** sets pressure in Kg per square cm.
6673

6774
### Getters
6875

@@ -78,7 +85,7 @@ Note: constants need to be verified.
7885
- **float getCmHg()** returns pressure in centimetre mercury.
7986
- **float getCmH2O()** returns pressure in centimetre water.
8087
- **float getMSW()** returns pressure in Meters of Sea Water. (under water pressure unit).
81-
88+
- **float getKGCM2()** returns pressure in Kg per square cm.
8289

8390
### Gas law, applied
8491

libraries/pressure/examples/pressure_demo/pressure_demo.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ pressure P;
1414
void setup()
1515
{
1616
Serial.begin(115200);
17+
Serial.println();
1718
Serial.println(__FILE__);
1819
Serial.print("PRESSURE_LIB_VERSION: ");
1920
Serial.println(PRESSURE_LIB_VERSION);
21+
Serial.println();
2022

2123
// convert one pressure to 12 output units.
2224
P.setMilliBar(1019.1);
@@ -33,11 +35,12 @@ void setup()
3335
Serial.print("CmHg: \t"); Serial.println(P.getCmHg(),3);
3436
Serial.print("CMH20: \t"); Serial.println(P.getCmH2O(),3);
3537
Serial.print("MSW: \t"); Serial.println(P.getMSW(),3);
38+
Serial.print("KGCM2: \t"); Serial.println(P.getKGCM2(),3);
3639
}
3740

3841
void loop()
3942
{
4043
}
4144

4245

43-
// -- END OF FILE --
46+
// -- END OF FILE --

libraries/pressure/examples/pressure_gas_law/pressure_gas_law.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pressure P;
1414
void setup()
1515
{
1616
Serial.begin(115200);
17+
Serial.println();
1718
Serial.println(__FILE__);
1819
Serial.print("PRESSURE_LIB_VERSION: ");
1920
Serial.println(PRESSURE_LIB_VERSION);
@@ -64,4 +65,4 @@ void loop()
6465
}
6566

6667

67-
// -- END OF FILE --
68+
// -- END OF FILE --

libraries/pressure/examples/pressure_gas_law_table/pressure_gas_law_table.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ float pressure = 1019.1;
1515
void setup()
1616
{
1717
Serial.begin(115200);
18+
Serial.println();
1819
Serial.println(__FILE__);
1920
Serial.print("PRESSURE_LIB_VERSION: ");
2021
Serial.println(PRESSURE_LIB_VERSION);
@@ -28,6 +29,8 @@ void setup()
2829
Serial.print("\t");
2930
Serial.println(1019.1 * P.factorTemperatureKelvin(25, t), 3);
3031
}
32+
33+
Serial.println("\ndone...");
3134

3235
}
3336

libraries/pressure/examples/pressure_specific/pressure_specific.ino

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ volatile float value = 1.234;
1919
void setup()
2020
{
2121
Serial.begin(115200);
22+
Serial.println();
2223
Serial.println(__FILE__);
2324
Serial.print("PRESSURE_LIB_VERSION: ");
2425
Serial.println(PRESSURE_LIB_VERSION);
26+
Serial.println();
2527

2628
start = micros();
2729
for (int i = 0; i < 1000; i++)
@@ -39,7 +41,7 @@ void setup()
3941
start = micros();
4042
for (int i = 0; i < 1000; i++)
4143
{
42-
x = PSI2MSW(value);
44+
x = psi2msw(value);
4345
}
4446
stop = micros();
4547
Serial.print("TIME:\t");
@@ -66,11 +68,14 @@ void loop()
6668
{
6769
}
6870

69-
inline float PSI2MSW(float value)
71+
//
72+
// dedicated conversion
73+
#define PSI2MSW (PSI2MILLIBAR * MILLIBAR2MSW)
74+
75+
inline float psi2msw(float value)
7076
{
71-
return value * (PSI2MILLIBAR * MILLIBAR2MSW);
77+
return value * PSI2MSW;
7278
}
7379

7480

75-
// -- END OF FILE --
76-
81+
// -- END OF FILE --

0 commit comments

Comments
 (0)