ESP: first implementation; compiles fine; not tested with MCU
This commit is contained in:
1 parent
5bdcb51bff
commit
6bda641ce8
36 files changed
+6234
No files matched your search
@@ -0,0 +1,54 @@
|
||||
// nightlight.h — illuminator control and what the device does after dark.
|
||||
//
|
||||
// A HARDWARE WARNING WORTH READING BEFORE YOU BUY ANYTHING
|
||||
// The obvious choice for a wildlife camera is an infrared illuminator (850 nm
|
||||
// or 940 nm), because birds barely perceive it and white light at a feeder at
|
||||
// night is disruptive. But the OV2640 module on the XIAO Sense ships with an
|
||||
// **IR cut filter bonded over the sensor**, which blocks exactly those
|
||||
// wavelengths. An IR LED on an unmodified Sense produces a black frame.
|
||||
//
|
||||
// So, three options, in the order I would try them:
|
||||
// 1. Accept no night capture. Set night_behaviour = NIGHT_SLEEP. Most garden
|
||||
// birds are diurnal; you lose very little and save the whole problem.
|
||||
// 2. Warm, dim, continuous white light (NIGHTLIGHT_ALWAYS at low duty).
|
||||
// Continuous is markedly better than a flash per burst: animals habituate
|
||||
// to steady light and startle at sudden light. Still disturbs wildlife.
|
||||
// 3. Remove the IR filter and use 850 nm. Best images, irreversible, and it
|
||||
// wrecks daytime colour rendition unless you fit a switchable filter.
|
||||
//
|
||||
// The firmware supports all three. Option 2 is what NIGHTLIGHT_ON_BURST and
|
||||
// NIGHTLIGHT_ALWAYS drive; option 3 needs no code change at all.
|
||||
//
|
||||
// NIGHT WINDOW
|
||||
// `night_start_min` / `night_end_min` are minutes from local midnight. The Pi
|
||||
// knows the site latitude, so the intended use is for it to push real
|
||||
// sunset/sunrise daily via apply_config. The defaults (21:00-06:00) are a
|
||||
// fallback for before that exists.
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
void nightBegin();
|
||||
|
||||
// Is the current local time inside the configured night window?
|
||||
// Always false while the clock is unsynced — better to capture pointless dark
|
||||
// frames than to sleep through a day because the device thinks it is 03:00.
|
||||
bool nightIsNight();
|
||||
|
||||
// Call every loop tick. Handles dusk/dawn transitions: swaps the camera
|
||||
// profile, and drives the illuminator for NIGHTLIGHT_ALWAYS.
|
||||
void nightTick();
|
||||
|
||||
// Bracket a capture burst. No-ops unless mode is NIGHTLIGHT_ON_BURST and it
|
||||
// is actually night; includes the settle delay the sensor needs to adapt.
|
||||
void nightIlluminateBurstBegin();
|
||||
void nightIlluminateBurstEnd();
|
||||
|
||||
bool nightlightIsOn();
|
||||
|
||||
// Seconds until night_end_min, for NIGHT_SLEEP. 0 if it is not night.
|
||||
uint32_t nightSecondsUntilMorning();
|
||||
|
||||
// Should the capture pipeline be running right now? False at night under
|
||||
// NIGHT_IDLE and NIGHT_SLEEP.
|
||||
bool nightCaptureAllowed();
|
||||
Reference in new issue
Block a user