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,82 @@
|
||||
// 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 WII5RadioLoRa.cpp
|
||||
* @brief LoRa radio driver (RFM95) — optional, gated on WII5_RADIO_LORA.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
WII5RadioLoRa
|
||||
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <WII5.h>
|
||||
|
||||
#ifdef WII5_RADIO_LORA
|
||||
|
||||
#include <WII5RadioLoRa.h>
|
||||
|
||||
void WII5RadioLoRa::begin() {
|
||||
powerSetPin(POWER_RADIO_PIN, POWER_RADIO_ON);
|
||||
powerOn(true);
|
||||
running = true;
|
||||
// sh3dNodeRadio.begin(wii5BufferRadio, WII5_BUFFER_RADIO, &wii5RadioRF95);
|
||||
// sh3dNodeNetwork.begin();
|
||||
sh3dNodeBroadcast.begin();
|
||||
}
|
||||
|
||||
// start / stop — currently no-ops. Radio power is managed in begin(); modes
|
||||
// don't (yet) toggle the radio on demand. Kept as overrides of the WII5Power
|
||||
// virtuals so callers can still invoke them safely.
|
||||
void WII5RadioLoRa::start(bool force) {
|
||||
(void)force;
|
||||
}
|
||||
|
||||
void WII5RadioLoRa::stop(bool force) {
|
||||
(void)force;
|
||||
}
|
||||
|
||||
|
||||
void WII5RadioLoRa::loop() {
|
||||
sh3dNodeRadio.loop();
|
||||
if (passthrough && sh3dNodeRadio.lastValid) {
|
||||
console.printf(F("Radio:record - yay. Length = %d. RSSI = %d."),
|
||||
sh3dNodeRadio.lastLength,
|
||||
sh3dNodeRadio.lastRadio.rssi,
|
||||
sh3dNodeRadio.lastRadio.snr
|
||||
);
|
||||
console.printf("DATA: ");
|
||||
console.printf((char*)sh3dNodeRadio.buffer);
|
||||
console.printf("\r\n");
|
||||
sh3dNodeRadio.lastClear();
|
||||
}
|
||||
|
||||
sh3dNodeNetwork.loop();
|
||||
if (sh3dNodeNetwork.lastValid) {
|
||||
console.printf(F("Radio:packet: type=%d\r\n"),(int(sh3dNodeNetwork.lastPacketType)));
|
||||
}
|
||||
}
|
||||
|
||||
// No disable ATM
|
||||
void WII5RadioLoRa::setPassthrough(bool in) {
|
||||
passthrough = in;
|
||||
}
|
||||
bool WII5RadioLoRa::getPassthrough() {
|
||||
return passthrough;
|
||||
}
|
||||
void WII5RadioLoRa::setDebug(bool in) {
|
||||
debug = in;
|
||||
}
|
||||
bool WII5RadioLoRa::getDebug() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
WII5RadioLoRa wii5RadioLoRa;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user