// SPDX-License-Identifier: Apache-2.0 // Copyright (c) 2012-2024 Scott Penrose 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 #include #include 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