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.
90 lines
2.0 KiB
C++
90 lines
2.0 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 WII5.cpp
|
|
* @brief Top-level base class and global buffer declarations.
|
|
*/
|
|
|
|
/*
|
|
|
|
WII5 - Base class for all - not much used here now
|
|
|
|
Main methods:
|
|
* debugDo ???
|
|
* setError(id, string); - includes auto update of time etc
|
|
*/
|
|
|
|
#include <Arduino.h>
|
|
#include <WII5.h>
|
|
|
|
/*
|
|
BUFFERS:
|
|
The buffers are defined here to allow for central control of
|
|
space, and potential to reuse them. They should be statically allocated.
|
|
Need to do more work on shared buffers. Especially for serial ports.
|
|
*/
|
|
|
|
#ifdef WII5_BUFFER_STRING
|
|
char wii5BufferString[WII5_BUFFER_STRING];
|
|
#endif
|
|
|
|
#ifdef WII5_BUFFER_CONSOLE_BINARY
|
|
char wii5BufferConsoleBinary[WII5_BUFFER_CONSOLE_BINARY];
|
|
#endif
|
|
|
|
#ifdef WII5_BUFFER_CONSOLE_PRINT
|
|
char wii5BufferConsolePrint[WII5_BUFFER_CONSOLE_PRINT];
|
|
#endif
|
|
|
|
#ifdef WII5_BUFFER_CONSOLE_CMD
|
|
char wii5BufferConsoleCmd[WII5_BUFFER_CONSOLE_CMD];
|
|
#endif
|
|
|
|
#ifdef WII5_RADIO_LORA
|
|
char wii5BufferRadio[WII5_BUFFER_RADIO];
|
|
#endif
|
|
|
|
#ifdef WII5_COMMS_IRIDIUM
|
|
char wii5BufferIridium[WII5_BUFFER_IRIDIUM]; // Used for Serial In / Out
|
|
char wii5BinaryIridium[WII5_IRIDIUM_BIN_MAX]; // Used to send and receive data to the modem
|
|
#endif
|
|
#ifdef WII5_BUFFER_SPARTON
|
|
char wii5BufferSparton[WII5_BUFFER_SPARTON];
|
|
#endif
|
|
#ifdef WII5_BUFFER_GPS
|
|
char wii5BufferGPS[WII5_BUFFER_GPS];
|
|
#endif
|
|
|
|
#ifdef WII5_RADIO_LORA
|
|
RH_RF95 wii5RadioRF95(RADIO_CS);
|
|
#endif
|
|
|
|
void debugDo(uint32_t n) {
|
|
static uint32_t count = 0;
|
|
count++;
|
|
SerialConsole.print(F("DEBUG POINT: "));
|
|
SerialConsole.print(n);
|
|
SerialConsole.print(" ");
|
|
SerialConsole.println(count);
|
|
SerialConsole.flush();
|
|
}
|
|
|
|
// Simple reusable class to help with multiple boards
|
|
WII5_DRIVERS WII5::driverId() {
|
|
return WII5DRIVER_UNKNOWN;
|
|
}
|
|
WII5_CONTROLLERS WII5::controllerId() {
|
|
return WII5CONTROLLER_UNKNOWN;
|
|
}
|
|
|
|
bool WII5::SJ(DdW when) {
|
|
if (when >= 1483511955)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|