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.
103 lines
2.6 KiB
Arduino
103 lines
2.6 KiB
Arduino
// 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_gps.ino
|
|
* @brief Test sketch: GPS NMEA passthrough.
|
|
*/
|
|
|
|
#include <WII5Sh3dConsole.h>
|
|
#include <WII5.h>
|
|
#include <WII5GPS.h>
|
|
|
|
#define SerialGPS Serial1
|
|
|
|
void setup() {
|
|
// Serial
|
|
Serial.begin(57600);
|
|
console.begin();
|
|
console.add(&Serial);
|
|
console.printf(F("WII5: Test GPS"));
|
|
|
|
// GPS
|
|
wii5Gps.begin();
|
|
// wii5Gps.begin(&SerialGPS);
|
|
// wii5Gps.setMode(WII5GPS_PASSTHROUGH);
|
|
|
|
wii5Gps.start();
|
|
// wii5Gps.setMode(WII5GPS_PASSTHROUGH);
|
|
}
|
|
|
|
void loop() {
|
|
if (SerialGPS.available()) {
|
|
char c = SerialGPS.read();
|
|
Serial.write(c);
|
|
}
|
|
return;
|
|
|
|
console.loop();
|
|
wii5Gps.loop();
|
|
if (console.available()) {
|
|
console.printf(F("CONSOLE: Got command %c=%d \r\n"),
|
|
console.getCommand(),
|
|
console.getVal()
|
|
);
|
|
switch(console.getCommand()) {
|
|
case '0':
|
|
console.printf(F("setMode WII5GPS_OFF\n"));
|
|
wii5Gps.setMode(WII5GPS_OFF);
|
|
break;
|
|
case '1':
|
|
console.printf(F("setMode WII5GPS_QUIET\n"));
|
|
wii5Gps.setMode(WII5GPS_QUIET);
|
|
break;
|
|
case '2':
|
|
console.printf(F("setMode WII5GPS_PASSTHROUGH\n"));
|
|
wii5Gps.setMode(WII5GPS_PASSTHROUGH);
|
|
break;
|
|
case '3':
|
|
console.printf(F("setMode WII5GPS_TIMEONCE\n"));
|
|
wii5Gps.setMode(WII5GPS_TIMEONCE);
|
|
break;
|
|
case '4':
|
|
console.printf(F("setMode WII5GPS_POSONCE\n"));
|
|
wii5Gps.setMode(WII5GPS_POSONCE);
|
|
break;
|
|
case '5':
|
|
console.printf(F("setMode WII5GPS_POSACCURATE\n"));
|
|
wii5Gps.setMode(WII5GPS_POSACCURATE);
|
|
break;
|
|
case '6':
|
|
console.printf(F("setMode WII5GPS_POSREPEAT\n"));
|
|
wii5Gps.setMode(WII5GPS_POSREPEAT);
|
|
break;
|
|
|
|
case 'D':
|
|
// TODO dump;
|
|
wii5Gps.dump();
|
|
break;
|
|
|
|
case 'S':
|
|
// Status
|
|
// - Number of bytes received
|
|
// - Lock status etc
|
|
break;
|
|
|
|
default:
|
|
console.printf(F("GPS Help:\r\n"));
|
|
console.printf(F(" 0 - mode off\r\n"));
|
|
console.printf(F(" 1 - mode Quiet\r\n"));
|
|
console.printf(F(" 2 - mode Passthrough\r\n"));
|
|
console.printf(F(" 3 - mode Time Once\r\n"));
|
|
console.printf(F(" 4 - mode Position Once\r\n"));
|
|
console.printf(F(" 5 - mode Position Accurate\r\n"));
|
|
console.printf(F(" 6 - mode Position Repeat\r\n"));
|
|
console.printf(F(" D - Dump all data\r\n"));
|
|
console.printf(F(" S - Show status\r\n"));
|
|
};
|
|
}
|
|
}
|