From fbaeb54b60cb106a79dd6eb0a961987313419d03 Mon Sep 17 00:00:00 2001 From: Ta180m Date: Fri, 21 Feb 2020 16:35:26 -0600 Subject: New calibration method --- libraries/detectorBuilding/detectorBuilding.cpp | 3 +++ libraries/detectorBuilding/detectorBuilding.h | 2 ++ libraries/detectorBuilding/keywords.txt | 1 + 3 files changed, 6 insertions(+) diff --git a/libraries/detectorBuilding/detectorBuilding.cpp b/libraries/detectorBuilding/detectorBuilding.cpp index 8c38009..6a06bae 100644 --- a/libraries/detectorBuilding/detectorBuilding.cpp +++ b/libraries/detectorBuilding/detectorBuilding.cpp @@ -22,6 +22,9 @@ inline double k2f(double k) { return c2f(k2c(k)); } // Kelvin to Fahrenheit inline double a2d(int a) { return V_in * a / analog_max; } inline int d2a(double d) { return d * analog_max / V_in; } +// Voltage to resistance conversion +inline double v2r(double V_out) { return R_k * (V_in / V_out - 1); } + // Utility functions // No C++ standard library :( void sort(double a[], int n) { diff --git a/libraries/detectorBuilding/detectorBuilding.h b/libraries/detectorBuilding/detectorBuilding.h index b9cf4ee..668048c 100644 --- a/libraries/detectorBuilding/detectorBuilding.h +++ b/libraries/detectorBuilding/detectorBuilding.h @@ -19,6 +19,8 @@ inline double k2f(double k); inline double a2d(int a); inline int d2a(double d); +inline double v2r(double V_out); + void sort(double a[], int n); void calculate(); diff --git a/libraries/detectorBuilding/keywords.txt b/libraries/detectorBuilding/keywords.txt index 4c7390c..ee7800a 100644 --- a/libraries/detectorBuilding/keywords.txt +++ b/libraries/detectorBuilding/keywords.txt @@ -6,5 +6,6 @@ f2k KEYWORD2 k2f KEYWORD2 a2d KEYWORD2 d2a KEYWORD2 +v2r KEYWORD2 sort KEYWORD2 calculate KEYWORD2 \ No newline at end of file -- cgit v1.2.3-70-g09d2