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.
85 lines
2.0 KiB
Arduino
85 lines
2.0 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_bindata.ino
|
|
* @brief Test sketch: BinData layout/split exercise.
|
|
*/
|
|
|
|
/*
|
|
* BinData Test
|
|
*/
|
|
|
|
#include <WII5Sh3dConsole.h>
|
|
#include <WII5_board.h>
|
|
#include <WII5Setup.h>
|
|
#include <WII5.h>
|
|
#include <WII5Data.h>
|
|
|
|
void setup() {
|
|
wii5Setup.setupConsole();
|
|
wii5Setup.setupIO();
|
|
console.printf(F("waiting 1 seconds\r\n"));
|
|
delay(1000);
|
|
console.printf(F("WII5: Test BinData\r\n"));
|
|
}
|
|
|
|
elapsedMillis wdtWait = 0;
|
|
void loop() {
|
|
if (wdtWait > 5100) {
|
|
digitalWrite(WDT_RESET, LOW);
|
|
wdtWait = 0;
|
|
}
|
|
else if (wdtWait > 5000) {
|
|
digitalWrite(WDT_RESET, HIGH);
|
|
}
|
|
|
|
sh3dNodeIO.loop();
|
|
console.loop();
|
|
if (console.available()) {
|
|
switch(console.getCommand()) {
|
|
case '0':
|
|
break;
|
|
}
|
|
}
|
|
|
|
console.printf(F("BinData: showSizes\n"));
|
|
wii5BinData.showSizes();
|
|
|
|
console.printf(F("BinData: Map Bits test\n"));
|
|
for (uint8_t x = 0; x < 16; x++) {
|
|
uint32_t t = 0;
|
|
SetBit(t, x);
|
|
|
|
console.printf(F("X = %d, T = %lu\r\n"), x, t);
|
|
|
|
for (uint8_t y = 0; y < 16; y++) {
|
|
if (BitVal(t, y)) {
|
|
console.printf(F("BitVal matched on %d\r\n"), y);
|
|
}
|
|
}
|
|
}
|
|
|
|
console.printf(F("BinData: Trying first 32 types\r\n"));
|
|
uint32_t binDataType = 0;
|
|
while(1) {
|
|
binDataType = (binDataType << 1) + 1;
|
|
console.printf(F("BinData: type=%lu, size=%d\r\n"), binDataType, wii5BinData.getSize(binDataType));
|
|
console.flush();
|
|
delay(500);
|
|
console.printf(F("BinData: Creating\r\n"));
|
|
wii5BinData.setData(binDataType, wii5BinaryIridium, 340); // TODO Hard coded
|
|
console.flush();
|
|
delay(500);
|
|
console.printf(F("BinData: type=%lu, size=%d\r\n"), binDataType, wii5BinData.getSize(binDataType));
|
|
wii5BinData.dumpData(binDataType, wii5BinaryIridium, 340); // TODO Hard coded
|
|
console.flush();
|
|
delay(500);
|
|
}
|
|
|
|
delay(5000);
|
|
}
|