SapFlow Probe
A low-cost HRM probe for measuring a tree's water consumption
|
Functions | |
void | setup () |
One-time initialization. More... | |
int | schedule (struct pt *pt) |
Controls the schedule of heating and sleeping. More... | |
void | loop () |
Implicit loop. More... | |
Variables | |
struct measure_stack m1 | m2 |
Persistent variables for measurement. | |
struct pt schedule_thd measure2_thd baseline2_thd | delta2_thd |
< Control structure for schedule() thread More... | |
void loop | ( | ) |
Implicit loop.
This function is called inside a hidden loop in the Arduino framework. We're using it for protothread scheduling. All the real work happens inside the protothreads.
References m2, measure(), and schedule().
int schedule | ( | struct pt * | pt | ) |
Controls the schedule of heating and sleeping.
It waits on each instance of baseline() and delta(), ensuring they each complete before continuing to the next stage. This function is in the main .ino because you will need to modify it when adding additional probes.
This is the schedule:
pt | A pointer to the protothread control structure. |
References baseline(), delta(), delta2_thd, HEATER, m2, rtc_ds, and sleep_cycle().
Referenced by loop().
void setup | ( | ) |
One-time initialization.
This function is called when the microcontroller first starts up or is reset. It's good for things that should only happen once. You do not need to call it yourself. It initializes some hardware, puts the protothreads in a known state, and begins the measurement cycle (which starts with sleep)
References measure_stack::addr, hardware_init(), m2, rtc_ds, and measure_stack::treeID.
struct pt schedule_thd measure2_thd baseline2_thd delta2_thd |
< Control structure for schedule() thread
< Control structure for measure() thread < Control structure for baseline() thread Control structure for delta() thread
Referenced by schedule().