SapFlow Probe
A low-cost HRM probe for measuring a tree's water consumption
measure.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "pinout.h"
4 #include "schedule.h"
5 #include "sd_log.h"
6 #include "debug.h"
7 #include <Adafruit_MAX31865.h>
8 
10 static bool sample_trigger;
11 
12 #define Rnom 100.0
13 #define Rref 430.0
14 
15 
20 struct temperature{
21  float upper;
22  float lower;
23  float heater;
24 };
25 
26 static struct temperature latest;
27 static struct temperature reference;
28 
29 static struct pt measure_thd;
30 static struct pt sample_timer_thd;
31 static struct pt baseline_thd;
32 static struct pt delta_thd;
33 
41 int measure(struct pt *pt = &measure_thd);
42 
53 int sample_timer(struct pt *pt = &sample_timer_thd);
54 
62 int baseline(struct pt *pt = &baseline_thd);
63 
72 int delta(struct pt *pt = &delta_thd);
measure_thd
static struct pt measure_thd
Protothread control structure for measure()
Definition: measure.h:29
temperature::heater
float heater
Temperature (Celcius) at the heater probe.
Definition: measure.h:23
baseline_thd
static struct pt baseline_thd
Protothread control structure for baseline()
Definition: measure.h:31
schedule.h
temperature::upper
float upper
Temperature (Celcius) at the upper probe.
Definition: measure.h:21
sample_trigger
static bool sample_trigger
global flag for synchronizing live data processing. Set by sample_timer()
Definition: measure.h:10
reference
static struct temperature reference
The baseline temperature reading, computed by the baseline() protothread.
Definition: measure.h:27
delta
int delta(struct pt *pt=&delta_thd)
Calculates temperature delta and sapflow.
Definition: measure.cpp:91
measure
int measure(struct pt *pt=&measure_thd)
Captures a measurement from the three probes.
Definition: measure.cpp:22
temperature::lower
float lower
Temperature (Celcius) at the lower probe.
Definition: measure.h:22
baseline
int baseline(struct pt *pt=&baseline_thd)
Calculates baseline temperature.
Definition: measure.cpp:65
sd_log.h
pinout.h
delta_thd
static struct pt delta_thd
Protothread control structure for delta()
Definition: measure.h:32
latest
static struct temperature latest
The most recent temperature reading, measured by the measure() protothread.
Definition: measure.h:26
sample_timer_thd
static struct pt sample_timer_thd
Protothread control structure for sample_timer()
Definition: measure.h:30
temperature
Stores a tuple of temperature values.
Definition: measure.h:20
sample_timer
int sample_timer(struct pt *pt=&sample_timer_thd)
Controls timing of the measurements.
Definition: measure.cpp:8
debug.h