2022-01-05 07:52:29 +03:00
|
|
|
//go:build !nocv
|
2022-01-05 05:46:08 +03:00
|
|
|
// +build !nocv
|
|
|
|
|
2022-01-05 07:52:29 +03:00
|
|
|
/*
|
|
|
|
DESCRIPTION
|
|
|
|
Results struct used to store results from the turbidity sensor
|
|
|
|
|
|
|
|
AUTHORS
|
|
|
|
Russell Stanley <russell@ausocean.org>
|
|
|
|
|
|
|
|
LICENSE
|
|
|
|
Copyright (C) 2020 the Australian Ocean Lab (AusOcean)
|
|
|
|
|
|
|
|
It is free software: you can redistribute it and/or modify them
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
|
|
|
*/
|
|
|
|
|
2021-12-17 09:03:31 +03:00
|
|
|
package main
|
|
|
|
|
2021-12-21 08:03:21 +03:00
|
|
|
// struct to hold the results of the turbidity sensor.
|
2021-12-17 09:03:31 +03:00
|
|
|
type Results struct {
|
|
|
|
turbidity []float64
|
|
|
|
saturation []float64
|
|
|
|
contrast []float64
|
|
|
|
}
|
|
|
|
|
2021-12-23 09:10:35 +03:00
|
|
|
func (r *Results) new(n int) {
|
2021-12-17 09:03:31 +03:00
|
|
|
r.turbidity = make([]float64, n)
|
|
|
|
r.saturation = make([]float64, n)
|
|
|
|
r.contrast = make([]float64, n)
|
|
|
|
}
|
|
|
|
|
2021-12-21 08:03:21 +03:00
|
|
|
// Update results to add new values at specified index.
|
2021-12-23 09:10:35 +03:00
|
|
|
func (r *Results) update(saturation, contrast, turbidity float64, index int) {
|
2021-12-21 04:43:05 +03:00
|
|
|
r.saturation[index] = saturation
|
|
|
|
r.contrast[index] = contrast
|
|
|
|
r.turbidity[index] = turbidity
|
|
|
|
}
|