Files
WII5Firmware/tools/integer_version.pl
T
scottp 295abb37ee 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.
2026-05-07 16:27:18 +10:00

38 lines
839 B
Perl

#!/usr/bin/perl
# 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.
my $ver = $ARGV[0];
@BITS = split(/\./, $ver);
$BITS[0] = substr($BITS[0],1);
#print join("\n", @BITS) . "\n";
my $newval = (65536 * $BITS[0]);
$newval = $newval + (256 * $BITS[1]);
$newval = $newval + $BITS[2];
print $newval . "\n";
__END__
if ($ver =~ /(\d+)\.(\d+)\.(\d+)/) {
my $p1 = $1+0; my $p2 = $2+0; my $p3 = $3+0;
print "$p1 $p2 $p3\n";
my $F1 = $p1*(2^16);
print $F1 . "\n";
my $F2 = $p2*(2^8);
print "$F1 $F2 $F3\n";
my $F3 = $p3;
print "$F1 $F2 $F3\n";
print "$F1 $F2 $F3\n";
my $ver = $F1 + $F2 + $F3;
$ver = ($p1*(2^16))+($p2*(2^8))+$p3;
print $ver . "\n";
}
else {
$ver = 0;
}