|
|
#include <complex.h>#include <inttypes.h>#include <math.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <stdio.h>#include <string.h>#include "acc_algorithm.h"#include "acc_config.h"#include "acc_config_subsweep.h"#include "acc_definitions_common.h"#include "acc_integration.h"#include "acc_integration_log.h"#include "acc_processing.h"#include "example_waste_level.h"Go to the source code of this file.
Data Structures | |
| struct | waste_level_handle |
Macros | |
| #define | MODULE "example_waste_level" |
Functions | |
| static bool | validate_app_config (const waste_level_app_config_t *app_config) |
| Validate an app_config (processing & sensor config). More... | |
| static bool | subsweep_start_points_strictly_increases (const acc_config_t *sensor_config) |
| Helper function for validation. More... | |
| static bool | has_overlapping_subsweeps (const acc_config_t *sensor_config, uint8_t *offending_subsweep) |
| Helper function for validation. More... | |
| static bool | is_invalid_start_point (const acc_config_t *sensor_config) |
| Helper function for validation. More... | |
| static bool | is_outside_measuring_interval (const acc_config_t *sensor_config, float distance_m) |
| Helper function for validation. More... | |
| static float | subsweep_approx_start_m (const acc_config_t *sensor_config, uint8_t subsweep_idx) |
| Helper function for validation. More... | |
| static float | subsweep_approx_end_m (const acc_config_t *sensor_config, uint8_t subsweep_idx) |
| Helper function for validation. More... | |
| static float | point_in_sweep_to_distance_m (const acc_config_t *sensor_config, const acc_processing_metadata_t *metadata, uint16_t point_idx) |
| Calculate a point's corresponding distance in meters. More... | |
| static void | write_to_ring_buffer (float *buffer, uint16_t capacity, uint16_t *length, uint16_t *write_idx, float elem) |
| Write next value into a ring buffer. More... | |
| static uint16_t | copy_non_nan_floats (const float *in, float *out, uint16_t length) |
| Copy non-NaN floats between buffers. More... | |
| static void | set_level_numbers (float filtered_distance, const waste_level_processing_config_t *processing_config, waste_level_result_t *result) |
| Populate a waste level result with its human-readable entries. More... | |
| waste_level_app_config_t * | waste_level_app_config_create (void) |
| Create a waste level app config (includes an acc_config_t) More... | |
| void | waste_level_app_config_destroy (waste_level_app_config_t *app_config) |
| Destroy a waste level app config. More... | |
| void | waste_level_app_config_set_preset (waste_level_preset_t preset, waste_level_app_config_t *app_config) |
| Apply a preset to an app config. More... | |
| waste_level_handle_t * | waste_level_handle_create (const waste_level_app_config_t *app_config) |
| Create a waste level handle. More... | |
| void | waste_level_handle_destroy (waste_level_handle_t *handle) |
| Destroy a waste level handle. More... | |
| void | waste_level_process (waste_level_handle_t *handle, const waste_level_app_config_t *app_config, const acc_processing_metadata_t *metadata, const acc_int16_complex_t *frame, waste_level_result_t *waste_level_result) |
| Process Sparse IQ data. More... | |
| void | waste_level_processing_config_log (const waste_level_processing_config_t *config) |
| Log a waste level config. More... | |
| #define MODULE "example_waste_level" |
Definition at line 25 of file example_waste_level.c.
|
static |
Copy non-NaN floats between buffers.
| [in] | in | Source buffer of floats which can contain NaNs |
| [out] | out | The destination buffer. Will not contain NaNs |
| [in] | length | The allocated size of in & out |
Definition at line 580 of file example_waste_level.c.
|
static |
Helper function for validation.
| [in] | sensor_config | The sensor config |
| [out] | offending_subsweep | The subsweep index of a subsweep that overlaps into the subsweep after it |
Definition at line 473 of file example_waste_level.c.
|
static |
Helper function for validation.
| [in] | sensor_config | The sensor config |
Definition at line 494 of file example_waste_level.c.
|
static |
Helper function for validation.
| [in] | sensor_config | The sensor config |
| [in] | distance_m | The distance to check |
Definition at line 503 of file example_waste_level.c.
|
static |
Calculate a point's corresponding distance in meters.
| [in] | sensor_config | The sensor config |
| [in] | metadata | The processing metadata |
| [in] | point_idx | The index in a sweep of the point to get distance for |
Definition at line 545 of file example_waste_level.c.
|
static |
Populate a waste level result with its human-readable entries.
| [in] | filtered_distance | The median filtered distance |
| [in] | processing_config | The waste processing config |
| [out] | result | The waste result |
Definition at line 596 of file example_waste_level.c.
|
static |
Helper function for validation.
| [in] | sensor_config | The sensor config |
| [in] | subsweep_idx | The distance to check |
Definition at line 537 of file example_waste_level.c.
|
static |
Helper function for validation.
| [in] | sensor_config | The sensor config |
| [in] | subsweep_idx | The distance to check |
Definition at line 529 of file example_waste_level.c.
|
static |
Helper function for validation.
| [in] | sensor_config | The sensor config |
Definition at line 452 of file example_waste_level.c.
|
static |
Validate an app_config (processing & sensor config).
| [in] | app_config | The app config |
Definition at line 364 of file example_waste_level.c.
| waste_level_app_config_t* waste_level_app_config_create | ( | void | ) |
Create a waste level app config (includes an acc_config_t)
Definition at line 147 of file example_waste_level.c.
| void waste_level_app_config_destroy | ( | waste_level_app_config_t * | app_config | ) |
Destroy a waste level app config.
| [in] | app_config | The config to destroy |
Definition at line 166 of file example_waste_level.c.
| void waste_level_app_config_set_preset | ( | waste_level_preset_t | preset, |
| waste_level_app_config_t * | app_config | ||
| ) |
Apply a preset to an app config.
| [in] | preset | The preset |
| [in] | app_config | The waste level app config |
Definition at line 179 of file example_waste_level.c.
| waste_level_handle_t* waste_level_handle_create | ( | const waste_level_app_config_t * | app_config | ) |
Create a waste level handle.
The handle is used only for processing
| [in] | app_config | Waste level app configuration |
Definition at line 217 of file example_waste_level.c.
| void waste_level_handle_destroy | ( | waste_level_handle_t * | handle | ) |
Destroy a waste level handle.
| [in] | handle | The waste_level handle to destroy |
Definition at line 257 of file example_waste_level.c.
| void waste_level_process | ( | waste_level_handle_t * | handle, |
| const waste_level_app_config_t * | app_config, | ||
| const acc_processing_metadata_t * | metadata, | ||
| const acc_int16_complex_t * | frame, | ||
| waste_level_result_t * | waste_level_result | ||
| ) |
Process Sparse IQ data.
| [in] | handle | The waste level handle |
| [in] | app_config | The waste level app configuration handle was created with |
| [in] | metadata | The processing metadata |
| [in] | frame | The Sparse IQ frame |
| [out] | waste_level_result | Result processed by waste_level |
Definition at line 275 of file example_waste_level.c.
| void waste_level_processing_config_log | ( | const waste_level_processing_config_t * | config | ) |
Log a waste level config.
| [in] | config | The waste level config |
Definition at line 354 of file example_waste_level.c.
|
static |
Write next value into a ring buffer.
| [in,out] | buffer | The circular buffer |
| [in] | capacity | The allocated number of elements of buffer |
| [in,out] | length | The buffer length (number of valid elements) |
| [in,out] | write_idx | The next index in buffer to write to |
| [in] | elem | The new element to write |
Definition at line 568 of file example_waste_level.c.