RocketLogger 2.1.2
calibration.c File Reference
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "log.h"
#include "rl.h"
#include "calibration.h"
+ Include dependency graph for calibration.c:

Go to the source code of this file.

Functions

void calibration_reset_offsets (void)
 
void calibration_reset_scales (void)
 
int calibration_load (void)
 

Variables

rl_calibration_t rl_calibration
 Global calibration data structure. More...
 

Function Documentation

◆ calibration_load()

int calibration_load ( void  )

Load the calibration values from calibration file.

Note
Updates the RocketLogger status. Manually update shared status after loading the calibration as needed.
Returns
Returns 0 on success, negative on failure with errno set accordingly

Definition at line 57 of file calibration.c.

References rl_status::calibration_file, calibration_reset_offsets(), calibration_reset_scales(), rl_calibration_file::calibration_time, rl_status::calibration_time, rl_calibration_file::data, ERROR, rl_calibration_file::file_magic, rl_calibration_file::file_version, rl_calibration_file::header_length, rl_calibration::offsets, RL_CALIBRATION_FILE_HEADER_LENGTH, RL_CALIBRATION_FILE_MAGIC, RL_CALIBRATION_FILE_VERSION, RL_CALIBRATION_SYSTEM_FILE, RL_CALIBRATION_USER_FILE, RL_CONFIG_CHANNEL_DT, rl_log(), RL_LOG_ERROR, rl_calibration::scales, and SUCCESS.

Referenced by hw_sample().

+ Here is the call graph for this function:

◆ calibration_reset_offsets()

void calibration_reset_offsets ( void  )

Reset all calibration offsets to default state (0).

Definition at line 45 of file calibration.c.

References rl_calibration::offsets, and RL_CHANNEL_COUNT.

Referenced by calibration_load(), and hw_sample().

◆ calibration_reset_scales()

void calibration_reset_scales ( void  )

Reset all calibration scales to default state (1).

Definition at line 51 of file calibration.c.

References RL_CHANNEL_COUNT, and rl_calibration::scales.

Referenced by calibration_load(), and hw_sample().

Variable Documentation

◆ rl_calibration

Global calibration data structure.

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 43 of file calibration.c.