Initial public release of WII5 Buoy firmware
Firmware for an autonomous wave-measurement buoy (ATmega2560-based WII5 v2 board). Reads wave motion from a Sparton AHRS-M1/M2 IMU, samples GPS and battery state, and reports back over Iridium SBD satellite telemetry. Originally developed 2012-2024. This is the first public release. Code, documentation, and field-tested operating modes (Capture, Sleep, Position, ManualTest, SelfTest, LowBattery) are licensed under Apache 2.0 — see LICENSE and NOTICE. See README.md for an overview and build instructions, CONTRIBUTING.md for how to contribute, and DEPLOYMENTS.md for the field-deployment log.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
|
||||
//
|
||||
// This file is part of WII5 Buoy firmware.
|
||||
// See LICENSE for full terms.
|
||||
|
||||
/**
|
||||
* @file WII5ModePosition.h
|
||||
* @brief Declares WII5ModeLowBattery (low-battery mode).
|
||||
*
|
||||
* @note The WII5ModePosition.h / WII5ModeLowBattery.h header pair are
|
||||
* swapped relative to their filenames in this codebase: this file
|
||||
* (WII5ModePosition.h) declares class WII5ModeLowBattery, and
|
||||
* WII5ModeLowBattery.h declares class WII5ModePosition. The corresponding
|
||||
* .cpp files match their filenames. TODO: untangle and rename.
|
||||
*/
|
||||
|
||||
#ifndef WII5ModeLowBattery_h
|
||||
#define WII5ModeLowBattery_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <WII5.h>
|
||||
#include <TimeLib.h>
|
||||
|
||||
enum WII5LOWBATTERY_STEPS {
|
||||
WII5LOWBATTERY_START,
|
||||
WII5LOWBATTERY_STROBE,
|
||||
WII5LOWBATTERY_TIME,
|
||||
WII5LOWBATTERY_GPS_START,
|
||||
WII5LOWBATTERY_GPS_WAIT,
|
||||
WII5LOWBATTERY_IRIDIUM_WAIT,
|
||||
WII5LOWBATTERY_END
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Low-battery mode: degraded operation when supply is depleted.
|
||||
*
|
||||
* Suppresses Capture mode's heavy operations (IMU, SD writes), keeps
|
||||
* a minimum-viable position+telemetry cadence, and pesters Iridium
|
||||
* with a battery-low alert. The buoy returns to its default mode once
|
||||
* battery voltage recovers (or via an explicit Iridium override).
|
||||
*/
|
||||
class WII5ModeLowBattery : public WII5Mode {
|
||||
public:
|
||||
WII5ModeLowBattery() {}
|
||||
/** @brief Reset to WII5LOWBATTERY_START. */
|
||||
void reset();
|
||||
/** @brief One-time bring-up. */
|
||||
void begin();
|
||||
/** @brief State-machine tick. */
|
||||
void loop();
|
||||
/** @brief Begin a low-battery alert cycle. */
|
||||
void start();
|
||||
/** @brief Abort the current cycle. */
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
bool first;
|
||||
elapsedMillis displayWait;
|
||||
elapsedMillis wait;
|
||||
WII5LOWBATTERY_STEPS step;
|
||||
WII5LOWBATTERY_STEPS lastStep;
|
||||
uint32_t minutes; // since midnight.
|
||||
};
|
||||
|
||||
extern WII5ModeLowBattery wii5ModeLowBattery;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user