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,63 @@
|
||||
// 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 WII5Battery.h
|
||||
* @brief Battery monitor: voltage sampling, running average, and threshold logic.
|
||||
*/
|
||||
|
||||
#ifndef WII5Battery_h
|
||||
#define WII5Battery_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TimeLib.h>
|
||||
#include <elapsedMillis.h>
|
||||
#include <WII5.h>
|
||||
#include <AvgStd.h>
|
||||
|
||||
enum WII5BATTERY_STEPS {
|
||||
WII5BATTERY_OFF,
|
||||
WII5BATTERY_ON,
|
||||
WII5BATTERY_MEASURE,
|
||||
WII5BATTERY_STORE,
|
||||
WII5BATTERY_ANALYSE,
|
||||
WII5BATTERY_FINISH
|
||||
};
|
||||
|
||||
class WII5Battery : public WII5Power {
|
||||
public:
|
||||
WII5Battery() {}
|
||||
virtual WII5_CONTROLLERS controllerId() {return WII5CONTROLLER_DRIVER;}
|
||||
virtual WII5_DRIVERS driverId() {return WII5DRIVER_BATTERY;}
|
||||
|
||||
void begin();
|
||||
void loop();
|
||||
|
||||
void start(bool force = false);
|
||||
void stop(bool force = false);
|
||||
|
||||
bool isRunning();
|
||||
|
||||
elapsedMillis age;
|
||||
int32_t value;
|
||||
protected:
|
||||
|
||||
WII5BATTERY_STEPS step;
|
||||
elapsedMillis stepWait;
|
||||
uint32_t stepCount;
|
||||
|
||||
AvgStd avgBattery1;
|
||||
AvgStd avgBattery2;
|
||||
|
||||
uint16_t scale(uint16_t data, uint16_t d);
|
||||
uint32_t scale(uint32_t data, uint32_t d);
|
||||
|
||||
|
||||
};
|
||||
|
||||
extern WII5Battery wii5Battery;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user