Firmware flow
Enter and clear the local alert state
Selected trigger and disarm branches from the alert-interface component.
The firmware checks the trigger first and the disarm input second. A trigger event while idle enables the local alert; a disarm event while active disables it and restores the prompt after a delay.
This is a manually triggered interface example. It is not evidence of automatic accident detection, remote notification, or the collection's greenhouse and BLDC implementations.
Read the implementation
Selected firmware excerpt. The diagram explains the code; it is not a hardware test.
Selected source excerpt
if (debouncedPressed(BTN_TRIGGER_PIN, lastTriggerReadMs) && state == IDLE) {
state = ALERT_ACTIVE;
setAlertOutputs(true);
lcdPtr->clear();
lcdCenteredPrint(0, "!!! ACCIDENT !!!");
lcdCenteredPrint(1, "Gathering data");
}
if (debouncedPressed(BTN_DISARM_PIN, lastDisarmReadMs) && state == ALERT_ACTIVE) {
state = IDLE;
setAlertOutputs(false);
lcdPtr->clear();
lcdCenteredPrint(0, "Alert DISARMED");
lcdCenteredPrint(1, "System idle");
delay(900);
lcdPtr->clear();
lcdCenteredPrint(0, "Press TRIGGER");
lcdCenteredPrint(1, "to simulate");
}Technical notes
Manual alert and disarm
A trigger event while idle enables the local alert. The code then checks the disarm input, which disables the outputs and returns to idle when an alert is active.
Local feedback
The alert component drives LEDs, pulses a buzzer and presents GPS and IMU-derived status information. Disarming shows a message, waits 900 milliseconds and restores the prompt.
Collection scope
This excerpt covers the alert-interface component. It does not establish automatic accident detection, remote emergency notification or the collection's separate greenhouse and BLDC implementations.