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.
449 lines
7.4 KiB
Plaintext
449 lines
7.4 KiB
Plaintext
New reordered array
|
|
|
|
process1.part1float
|
|
0..3 hz_max
|
|
4..7 hcm_max
|
|
8..11 htm_max
|
|
12..15 tz_mean
|
|
16 tp
|
|
17 hmod
|
|
18..72 psd
|
|
|
|
process2.parse2float
|
|
0..7 moment
|
|
8..16 ...
|
|
|
|
// 4
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->hz_max[i]);
|
|
// 4
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->hcm_max[i]);
|
|
// 4
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->htm_max[i]);
|
|
// 4 16
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->tz_mean[i]);
|
|
// 1
|
|
fprintf(ido_o,"%LF\n",return_data->tp);
|
|
// 1 18
|
|
fprintf(ido_o,"%LF\n",return_data->hmod);
|
|
// n_psd = 55 73
|
|
for (i=0;i<n_psd;i++) fprintf(ido_o,"%LF\n",return_data->psd[i]);
|
|
|
|
|
|
// n_mom = 7
|
|
for (i=0;i<n_mom;i++) fprintf(ido_o,"%LF\n",return_data->moment[i]);
|
|
|
|
// 8
|
|
fprintf(ido_o,"%d\n",return_data->qflg_open_water);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_kist);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_imu);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_pkist);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_accel);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_gyro);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_magno);
|
|
fprintf(ido_o,"%d\n",return_data->qflg_head);
|
|
|
|
|
|
// 54 62
|
|
|
|
|
|
155 lines
|
|
On average these are all floats - 4 Bytes
|
|
620 bytes - which does not fit into one block
|
|
|
|
OR:
|
|
101 * 4
|
|
54 * 2
|
|
= 512 - exactly the block size!
|
|
|
|
psd 55 = 220
|
|
|
|
Normal output from WII3/4
|
|
|
|
* All 4 byte float unless specified here
|
|
* direction - 54 * Int (2 byte) - total 108
|
|
* psd - 55 * float (4 byte) - total 220
|
|
|
|
|
|
hz_max: [1, 4], // Maximum wave height (trough - crest) in a 10 min segment
|
|
Double
|
|
4 * 4
|
|
= 16
|
|
hcm_max: [5, 8], // Maximum height of a crest above mean water level in a 10 min segment
|
|
Double
|
|
4 * 4
|
|
= 16
|
|
htm_max: [9, 12], // Maximum depth of a trough below mean water level in a 10 min segment
|
|
Double
|
|
4 * 4
|
|
= 16
|
|
tz_max: [13, 16], // Mean wave period in a 10 min segment
|
|
Double
|
|
4 * 4
|
|
= 16
|
|
tp: 17, // Peak period from the full (non averaged) spectra
|
|
Double
|
|
4
|
|
= 4
|
|
hmo: 18, // 4*standard deviation of elevation
|
|
Double
|
|
4
|
|
= 4
|
|
psd: [19, 73], // Using 1/f_avg = frequency
|
|
Double
|
|
55 * 4
|
|
= 220
|
|
moments: [74, 80], // Spectral moments
|
|
Double
|
|
7 * 4
|
|
= 28
|
|
theta: 81, // Mean wave direction
|
|
Double
|
|
4
|
|
= 4
|
|
dp: 82, // Peak wave direction
|
|
Double
|
|
4
|
|
= 4
|
|
s: 83, // Wave spread
|
|
Double
|
|
4
|
|
= 4
|
|
r: 84, // Ratio term to evaluate quality of wave direction approximation
|
|
Double
|
|
4
|
|
= 4
|
|
hs_dir:85, // Hs calculated using direction analysis
|
|
Double
|
|
4
|
|
= 4
|
|
a: 86, // Noise slope
|
|
Double
|
|
4
|
|
= 4
|
|
b: 87, // Noise intercept
|
|
Double
|
|
4
|
|
= 4
|
|
nstd: 88, // Noise standard deviation
|
|
Double
|
|
4
|
|
= 4
|
|
f2: 89, // Frequency cut-off
|
|
Double
|
|
4
|
|
= 4
|
|
qf_mvar: 90, // Quality flag: Mean vertical acceleration removed
|
|
Double
|
|
4
|
|
= 4
|
|
qf_kist: 91, // Quality flat: Kistler passed (0), Kistler failed (1)
|
|
Int
|
|
2
|
|
= 2
|
|
qf_imu: 92, // Quality flat: IMU passed (0), IMU failed (1)
|
|
Int
|
|
2
|
|
= 2
|
|
qf_p_kist: 93, // Quality flag: Percentage of flagged Kistler samples
|
|
Int
|
|
2
|
|
= 2
|
|
qf_p_accel: 94, // Quality flag: Percentage of flagged acceleration samples (averaged across 3 axis)
|
|
Int
|
|
2
|
|
= 2
|
|
qf_p_gyro: 95, // Quality flag: Percentage of flagged gyro samples (averaged across 3 axis)
|
|
Int
|
|
2
|
|
= 2
|
|
qf_p_mag: 96, // Quality flag: Percentage of flagged magno samples (averaged across 3 axis)
|
|
Int
|
|
2
|
|
= 2
|
|
qf_head: 97, // Quality flag: GPS heading passed (0), GPS heading failed (1)
|
|
Int
|
|
2
|
|
= 2
|
|
power_diff: 98, // Difference between power in the time domain and frequency domain
|
|
Double
|
|
4
|
|
= 4
|
|
yaw_std: 99, // Yaw standard deviation
|
|
Double
|
|
4
|
|
= 4
|
|
open_water: 100, // Open Water flag
|
|
Int
|
|
2
|
|
= 2
|
|
direction: [101, 154], // direction data
|
|
Int
|
|
54 * 2
|
|
= 108
|
|
|
|
492 bytes
|
|
|
|
|
|
|
|
11.787015
|
|
9.582090
|
|
12.528253
|
|
14.153369
|
|
7.735189
|
|
5.657926
|
|
4.293090
|
|
5.485378
|
|
-7.106659
|
|
-5.864575
|
|
-8.348605
|
|
-8.667991
|
|
29.714286
|
|
28.750000
|
|
28.055556
|
|
30.400000
|
|
32.000000
|
|
10.224887
|
|
11.823206
|
|
46.393283
|
|
50.172329
|
|
45.776413
|
|
96.298192
|
|
69.859577
|
|
37.341004
|
|
29.351810
|
|
17.013856
|
|
24.406505
|
|
10.531730
|
|
6.074609
|
|
4.671587
|
|
3.752939
|
|
6.758200
|
|
5.808995
|
|
5.183176
|
|
4.280694
|
|
1.921353
|
|
2.080787
|
|
1.444816
|
|
1.249582
|
|
1.329185
|
|
0.709623
|
|
1.501197
|
|
1.624132
|
|
0.683771
|
|
1.638818
|
|
0.252953
|
|
0.567005
|
|
0.321616
|
|
0.659857
|
|
0.243726
|
|
0.682648
|
|
0.268455
|
|
0.297780
|
|
0.281510
|
|
0.218103
|
|
0.302124
|
|
0.219463
|
|
0.273396
|
|
0.091317
|
|
0.122532
|
|
0.145382
|
|
0.038717
|
|
0.057687
|
|
0.044266
|
|
0.035344
|
|
0.020552
|
|
0.013517
|
|
0.007770
|
|
0.006380
|
|
0.004311
|
|
0.002205
|
|
0.001864
|
|
5740.408809
|
|
186.498311
|
|
6.548624
|
|
0.253406
|
|
0.011854
|
|
0.000831
|
|
0.000111
|
|
55.514691
|
|
14.862172
|
|
75.469394
|
|
32.156745
|
|
3.584171
|
|
-4.368659
|
|
-10.127936
|
|
410.341584
|
|
0.031250
|
|
10.716096
|
|
1
|
|
0
|
|
99
|
|
1
|
|
99
|
|
0
|
|
2
|
|
4.583661
|
|
11165.160686
|
|
1
|
|
5.154564
|
|
214
|
|
149
|
|
245
|
|
815
|
|
687
|
|
659
|
|
204
|
|
455
|
|
253
|
|
786
|
|
371
|
|
692
|
|
550
|
|
430
|
|
490
|
|
358
|
|
201
|
|
440
|
|
431
|
|
388
|
|
644
|
|
676
|
|
389
|
|
521
|
|
855
|
|
550
|
|
728
|
|
583
|
|
863
|
|
635
|
|
818
|
|
863
|
|
795
|
|
567
|
|
674
|
|
482
|
|
884
|
|
429
|
|
787
|
|
299
|
|
619
|
|
787
|
|
328
|
|
742
|
|
572
|
|
712
|
|
798
|
|
130
|
|
650
|
|
780
|
|
336
|
|
680
|
|
547
|
|
434
|
|
|
|
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->hz_max[i]);
|
|
4 Float
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->hcm_max[i]);
|
|
4 Float
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->htm_max[i]);
|
|
4 Float
|
|
for (i=0;i<2*k;i++) fprintf(ido_o,"%LF\n",return_data->tz_mean[i]);
|
|
4 Float
|
|
fprintf(ido_o,"%LF\n",return_data->tp);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->hmod);
|
|
1 Float
|
|
for (i=0;i<n_psd;i++) fprintf(ido_o,"%LF\n",return_data->psd[i]);
|
|
55 Float
|
|
for (i=0;i<n_mom;i++) fprintf(ido_o,"%LF\n",return_data->moment[i]);
|
|
7 Float
|
|
fprintf(ido_o,"%LF\n",return_data->direction*180.0/pi);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->peak_direction*180.0/pi);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->spread*180.0/pi);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->ratio);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->hs_dir);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->a);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->b);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->nstd);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->f2);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->qflg_mean_removed_imu);
|
|
1 Float
|
|
fprintf(ido_o,"%d\n",return_data->qflg_kist);
|
|
1 Int
|
|
fprintf(ido_o,"%d\n",return_data->qflg_imu);
|
|
1 Int
|
|
fprintf(ido_o,"%d\n",return_data->qflg_pkist);
|
|
1 Int
|
|
fprintf(ido_o,"%d\n",return_data->qflg_accel);
|
|
1 Int
|
|
fprintf(ido_o,"%d\n",return_data->qflg_gyro);
|
|
1 Int
|
|
fprintf(ido_o,"%d\n",return_data->qflg_magno);
|
|
1 Int
|
|
fprintf(ido_o,"%d\n",return_data->qflg_head);
|
|
1 Int
|
|
fprintf(ido_o,"%LF\n",return_data->qflg_tot_pow_imu);
|
|
1 Float
|
|
fprintf(ido_o,"%LF\n",return_data->std_yaw*180.0/pi);
|
|
1 Float
|
|
fprintf(ido_o,"%d\n",return_data->qflg_open_water);
|
|
1 Int
|
|
fprintf(ido_o,"%LF\n",return_data->hz_mean[0]);
|
|
1 Float
|
|
direction
|
|
54 Int
|
|
|
|
4 Float
|
|
4 Float
|
|
4 Float
|
|
4 Float
|
|
1 Float
|
|
1 Float
|
|
55 Float
|
|
|
|
73
|
|
= 292 Bytes
|
|
|
|
7 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
1 Float
|
|
17
|
|
= 68 bytes
|
|
1 Int
|
|
1 Int
|
|
1 Int
|
|
1 Int
|
|
1 Int
|
|
1 Int
|
|
1 Int
|
|
7
|
|
= 14 bytes
|
|
1 Float
|
|
1 Float
|
|
= 8 bytes
|
|
1 Int
|
|
= 2 bytes
|
|
1 Float
|
|
= 4 bytres
|
|
54 Int
|
|
= 108
|
|
= 204 total
|