example_detector_distance_calibration_caching.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "acc_definitions_a121.h"
#include "acc_detector_distance.h"
#include "acc_hal_definitions_a121.h"
#include "acc_hal_integration_a121.h"
#include "acc_integration.h"
#include "acc_integration_log.h"
#include "acc_rss_a121.h"
#include "acc_sensor.h"
#include "acc_version.h"

Go to the source code of this file.

Data Structures

struct  distance_detector_resources_t
 

Macros

#define SENSOR_ID   (1U)
 
#define SENSOR_TIMEOUT_MS   (2000U)
 
#define MAX_CAL_TEMP_DIFF   (16)
 
#define MAX_TEMP_VARIATION   (125)
 
#define MAX_CACHE_COUNT   ((MAX_TEMP_VARIATION / MAX_CAL_TEMP_DIFF) + 1)
 

Functions

static void set_config (acc_detector_distance_config_t *detector_config)
 
static bool initialize_detector_resources (distance_detector_resources_t *resources)
 
static bool detector_get_next (distance_detector_resources_t *resources, acc_detector_distance_result_t *result)
 
static void cleanup (distance_detector_resources_t *resources)
 
static bool sensor_and_detector_calibration (distance_detector_resources_t *resources, uint16_t cache_index)
 
static bool sensor_calibration (distance_detector_resources_t *resources, uint16_t cache_index)
 
static bool detector_calibration_full (distance_detector_resources_t *resources, uint16_t cache_index)
 
static bool detector_calibration_update (distance_detector_resources_t *resources, uint16_t cache_index)
 
static bool calibration_caching (distance_detector_resources_t *resources, int16_t temp)
 
static bool find_cache_index (int16_t temp, uint16_t *cache_index)
 
static bool get_next_empty_cache_index (uint16_t *cache_index)
 
static bool add_cache (uint16_t cache_index, int16_t temp)
 
int app_main (int argc, char *argv[])
 Assembly test example. More...
 

Variables

static uint8_t * detector_cal_result_static
 
static uint32_t detector_cal_result_static_size = 0
 
static acc_cal_result_t sensor_cal_results [(((125)/(16))+1)]
 
static acc_detector_cal_result_dynamic_t detector_cal_results_dynamic [(((125)/(16))+1)]
 
static int16_t cal_temps [(((125)/(16))+1)]
 
static uint16_t curr_cache_count = 0
 
static uint16_t cache_index_in_use = 0
 

Macro Definition Documentation

◆ MAX_CACHE_COUNT

◆ MAX_CAL_TEMP_DIFF

#define MAX_CAL_TEMP_DIFF   (16)

A sensor calibration and the dynamic part of a detector calibration are valid at the temperature they were done +- 15 degrees.

If the temperature isn't controlled during caching, which is the case in this example, the maximum amount of caches needs to be calculated from a temperature difference of 16.

For example

  • A calibration is done at 25 degrees, which means it is valid between 10 and 40 degrees
  • The temperature changes to 41 degrees
  • A new calibration needs to be done at 41 degrees since it is above the valid range for the previous calibration
  • The new calibration is then valid between 26 and 56 degrees

However, if the temperature is controlled, for example in a factory, the maximum amount of caches can be calculated from a temperature difference of 30.

For example

  • A calibration is done at 25 degrees, which means it is valid between 10 and 40 degrees
  • The temperature is manually changed to 55 degrees
  • A new calibration can be done which is valid between 40 and 70 degrees

The maximum temperature variation that the application will operate in is assumed to be -40 to 85 degrees in this example.

Examples
example_detector_distance_calibration_caching.c.

Definition at line 68 of file example_detector_distance_calibration_caching.c.

◆ MAX_TEMP_VARIATION

#define MAX_TEMP_VARIATION   (125)

◆ SENSOR_ID

#define SENSOR_ID   (1U)

◆ SENSOR_TIMEOUT_MS

#define SENSOR_TIMEOUT_MS   (2000U)

Function Documentation

◆ add_cache()

static bool add_cache ( uint16_t  cache_index,
int16_t  temp 
)
static

◆ app_main()

int app_main ( int  argc,
char *  argv[] 
)

Assembly test example.

Service subsweeps example.

Low power service example.

Service multple configurations example.

Service sensor calibration caching example.

Service example.

Processing subtract adaptive background example.

Processing static presence example.

Processing peak interpolation example.

Processing noncoherent mean example.

Processing coherent mean example.

Processing amplitude example.

Detector presence example with multiple configurations.

Detector presence example.

Detector distance example with iq data print.

Detector distance with calibration caching example.

Detector distance example.

Control helper example.

Returns
Returns EXIT_SUCCESS if successful, otherwise EXIT_FAILURE

Detector filters and states are reset on prepare (reconfiguration) to avoid risk of false detections when switching back to a zone.

Detector filters and states are reset on prepare (reconfiguration) to avoid risk of false detections when switching back to a zone.

Examples
example_detector_distance_calibration_caching.c.

Definition at line 138 of file example_detector_distance_calibration_caching.c.

◆ calibration_caching()

static bool calibration_caching ( distance_detector_resources_t resources,
int16_t  temp 
)
static

◆ cleanup()

static void cleanup ( distance_detector_resources_t resources)
static

◆ detector_calibration_full()

static bool detector_calibration_full ( distance_detector_resources_t resources,
uint16_t  cache_index 
)
static

◆ detector_calibration_update()

static bool detector_calibration_update ( distance_detector_resources_t resources,
uint16_t  cache_index 
)
static

◆ detector_get_next()

static bool detector_get_next ( distance_detector_resources_t resources,
acc_detector_distance_result_t result 
)
static

◆ find_cache_index()

static bool find_cache_index ( int16_t  temp,
uint16_t *  cache_index 
)
static

◆ get_next_empty_cache_index()

static bool get_next_empty_cache_index ( uint16_t *  cache_index)
static

◆ initialize_detector_resources()

static bool initialize_detector_resources ( distance_detector_resources_t resources)
static

◆ sensor_and_detector_calibration()

static bool sensor_and_detector_calibration ( distance_detector_resources_t resources,
uint16_t  cache_index 
)
static

◆ sensor_calibration()

static bool sensor_calibration ( distance_detector_resources_t resources,
uint16_t  cache_index 
)
static

◆ set_config()

static void set_config ( acc_detector_distance_config_t detector_config)
static

Variable Documentation

◆ cache_index_in_use

uint16_t cache_index_in_use = 0
static

◆ cal_temps

int16_t cal_temps[(((125)/(16))+1)]
static

◆ curr_cache_count

uint16_t curr_cache_count = 0
static

◆ detector_cal_result_static

◆ detector_cal_result_static_size

◆ detector_cal_results_dynamic

acc_detector_cal_result_dynamic_t detector_cal_results_dynamic[(((125)/(16))+1)]
static

◆ sensor_cal_results

acc_cal_result_t sensor_cal_results[(((125)/(16))+1)]
static