295abb37ee
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.
68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
// 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 WII5ModeLowBattery.h
|
|
* @brief Declares WII5ModePosition (position mode).
|
|
*
|
|
* @note The WII5ModePosition.h / WII5ModeLowBattery.h header pair are
|
|
* swapped relative to their filenames in this codebase: this file
|
|
* (WII5ModeLowBattery.h) declares class WII5ModePosition, and
|
|
* WII5ModePosition.h declares class WII5ModeLowBattery. The corresponding
|
|
* .cpp files match their filenames. TODO: untangle and rename.
|
|
*/
|
|
|
|
#ifndef WII5ModePosition_h
|
|
#define WII5ModePosition_h
|
|
|
|
#include <Arduino.h>
|
|
#include <WII5.h>
|
|
#include <TimeLib.h>
|
|
|
|
enum WII5POSITION_STEPS {
|
|
WII5POSITION_START,
|
|
WII5POSITION_STROBE,
|
|
WII5POSITION_TIME,
|
|
WII5POSITION_GPS_START,
|
|
WII5POSITION_GPS_WAIT,
|
|
WII5POSITION_IRIDIUM_WAIT,
|
|
WII5POSITION_END
|
|
};
|
|
|
|
/**
|
|
* @brief Position mode: periodic GPS + Iridium telemetry only.
|
|
*
|
|
* Lower-power than full Capture mode: turns on GPS, gets a fix, sends
|
|
* a position via Iridium SBD, then idles until the next position window.
|
|
* No IMU capture, no SD writes.
|
|
*/
|
|
class WII5ModePosition : public WII5Mode {
|
|
public:
|
|
WII5ModePosition() {}
|
|
/** @brief Reset to WII5POSITION_START. */
|
|
void reset();
|
|
/** @brief One-time bring-up. */
|
|
void begin();
|
|
/** @brief State-machine tick. */
|
|
void loop();
|
|
/** @brief Begin a position acquisition cycle. */
|
|
void start();
|
|
/** @brief Abort the current cycle. */
|
|
void stop();
|
|
|
|
protected:
|
|
bool first;
|
|
elapsedMillis displayWait;
|
|
elapsedMillis wait;
|
|
WII5POSITION_STEPS step;
|
|
WII5POSITION_STEPS lastStep;
|
|
uint32_t minutes; // since midnight.
|
|
};
|
|
|
|
extern WII5ModePosition wii5ModePosition;
|
|
|
|
#endif
|