diff --git a/README.md b/README.md
index 71bce86..74d676a 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,16 @@ Our breakout board for the A111 includes a 1.8V regulator, voltage-level transla
The breakout board is primarily **designed to interface directly with a Raspberry Pi** – Acconeer’s SDK currently only supports ARMv7’s (e.g. a Pi) and ARM Cortex-M4’s. Check out our Using the A111 Pulsed Radar Breakout tutorial, which explains how to use the sensor with a Raspberry Pi.
+**Update!**
+The tutorial describes the process for an older version of the
+Acconeer SDK that is nolonger available.
+
+New installation instructions:
+1. Download and unpack Acconeer SDK 1.7.0 for XC111
+2. Copy the `user_source` and `user_rule` folders from this repository to the root of the unpacked
+ SDK (folders `lib`, `source` and `rule` should be siblings to the
+ `user_rule`and `user_source`)
+
SparkFun labored with love to create this code. Feel like supporting open source hardware?
Buy a [breakout board](https://www.sparkfun.com/products/14811) from SparkFun!
@@ -34,4 +44,4 @@ Please use, reuse, and modify these files as you see fit. Please maintain attrib
Distributed as-is; no warranty is given.
-- Your friends at SparkFun.
\ No newline at end of file
+- Your friends at SparkFun.
diff --git a/Software/sparkx-sdk-addon/rule/makefile_build_acc_service_data_logger_rpi_sparkx.inc b/Software/sparkx-sdk-addon/user_rule/makefile_build_acc_service_data_logger_rpi_sparkx.inc
similarity index 100%
rename from Software/sparkx-sdk-addon/rule/makefile_build_acc_service_data_logger_rpi_sparkx.inc
rename to Software/sparkx-sdk-addon/user_rule/makefile_build_acc_service_data_logger_rpi_sparkx.inc
diff --git a/Software/sparkx-sdk-addon/rule/makefile_build_acc_streaming_server_rpi_sparkx.inc b/Software/sparkx-sdk-addon/user_rule/makefile_build_acc_streaming_server_rpi_sparkx.inc
similarity index 100%
rename from Software/sparkx-sdk-addon/rule/makefile_build_acc_streaming_server_rpi_sparkx.inc
rename to Software/sparkx-sdk-addon/user_rule/makefile_build_acc_streaming_server_rpi_sparkx.inc
diff --git a/Software/sparkx-sdk-addon/rule/makefile_build_example_service_envelope_rpi_sparkx.inc b/Software/sparkx-sdk-addon/user_rule/makefile_build_example_service_envelope_rpi_sparkx.inc
similarity index 100%
rename from Software/sparkx-sdk-addon/rule/makefile_build_example_service_envelope_rpi_sparkx.inc
rename to Software/sparkx-sdk-addon/user_rule/makefile_build_example_service_envelope_rpi_sparkx.inc
diff --git a/Software/sparkx-sdk-addon/rule/makefile_build_example_service_iq_rpi_sparkx.inc b/Software/sparkx-sdk-addon/user_rule/makefile_build_example_service_iq_rpi_sparkx.inc
similarity index 100%
rename from Software/sparkx-sdk-addon/rule/makefile_build_example_service_iq_rpi_sparkx.inc
rename to Software/sparkx-sdk-addon/user_rule/makefile_build_example_service_iq_rpi_sparkx.inc
diff --git a/Software/sparkx-sdk-addon/rule/makefile_build_example_service_power_bins_rpi_sparkx.inc b/Software/sparkx-sdk-addon/user_rule/makefile_build_example_service_power_bins_rpi_sparkx.inc
similarity index 100%
rename from Software/sparkx-sdk-addon/rule/makefile_build_example_service_power_bins_rpi_sparkx.inc
rename to Software/sparkx-sdk-addon/user_rule/makefile_build_example_service_power_bins_rpi_sparkx.inc
diff --git a/Software/sparkx-sdk-addon/rule/makefile_build_sparkx_detector_distance.inc b/Software/sparkx-sdk-addon/user_rule/makefile_build_sparkx_detector_distance.inc
similarity index 100%
rename from Software/sparkx-sdk-addon/rule/makefile_build_sparkx_detector_distance.inc
rename to Software/sparkx-sdk-addon/user_rule/makefile_build_sparkx_detector_distance.inc
diff --git a/Software/sparkx-sdk-addon/source/acc_board_rpi_sparkx.c b/Software/sparkx-sdk-addon/user_source/acc_board_rpi_sparkx.c
similarity index 77%
rename from Software/sparkx-sdk-addon/source/acc_board_rpi_sparkx.c
rename to Software/sparkx-sdk-addon/user_source/acc_board_rpi_sparkx.c
index 8816bb3..fac8d35 100644
--- a/Software/sparkx-sdk-addon/source/acc_board_rpi_sparkx.c
+++ b/Software/sparkx-sdk-addon/user_source/acc_board_rpi_sparkx.c
@@ -1,4 +1,4 @@
-// Copyright (c) Acconeer AB, 2017-2018
+// Copyright (c) Acconeer AB, 2017-2019
// All rights reserved
#include
@@ -6,6 +6,7 @@
#include
#include "acc_board.h"
+#include "acc_definitions.h"
#include "acc_device_gpio.h"
#include "acc_device_os.h"
#include "acc_device_spi.h"
@@ -14,7 +15,6 @@
#include "acc_driver_spi_linux_spidev.h"
#include "acc_log.h"
-
/**
* @brief The module name
*
@@ -71,7 +71,6 @@
*/
#define GPIO_PIN_COUNT 28
-
/**
* @brief Sensor states
*/
@@ -81,18 +80,15 @@ typedef enum {
SENSOR_STATE_BUSY
} acc_board_sensor_state_t;
-
/**
* @brief Sensor state collection that keeps track of each sensor's current state
*/
static acc_board_sensor_state_t sensor_state[SENSOR_COUNT] = {SENSOR_STATE_UNKNOWN};
-
static const uint_fast8_t sensor_interrupt_pins[SENSOR_COUNT] = {
GPIO0_PIN
};
-
static acc_board_isr_t master_isr;
static acc_device_handle_t spi_handle;
static gpio_t gpios[GPIO_PIN_COUNT];
@@ -125,14 +121,14 @@ static bool acc_board_all_sensors_inactive(void)
}
-acc_status_t acc_board_gpio_init(void)
+bool acc_board_gpio_init(void)
{
static bool init_done = false;
static acc_os_mutex_t init_mutex = NULL;
if (init_done)
{
- return ACC_STATUS_SUCCESS;
+ return true;
}
acc_os_init();
@@ -143,7 +139,7 @@ acc_status_t acc_board_gpio_init(void)
if (init_done)
{
acc_os_mutex_unlock(init_mutex);
- return ACC_STATUS_SUCCESS;
+ return true;
}
if (
@@ -160,24 +156,24 @@ acc_status_t acc_board_gpio_init(void)
!acc_device_gpio_write(ENABLE_PIN, 0))
{
acc_os_mutex_unlock(init_mutex);
- return ACC_STATUS_FAILURE;
+ return false;
}
init_done = true;
acc_os_mutex_unlock(init_mutex);
- return ACC_STATUS_SUCCESS;
+ return true;
}
-acc_status_t acc_board_init(void)
+bool acc_board_init(void)
{
static bool init_done = false;
static acc_os_mutex_t init_mutex = NULL;
if (init_done)
{
- return ACC_STATUS_SUCCESS;
+ return true;
}
acc_driver_os_linux_register();
@@ -215,7 +211,7 @@ acc_status_t acc_board_init(void)
init_done = true;
acc_os_mutex_unlock(init_mutex);
- return ACC_STATUS_SUCCESS;
+ return true;
}
@@ -224,32 +220,32 @@ acc_status_t acc_board_init(void)
*
* Default setup when sensor is not active
*
- * @return Status
+ * @return True if successful, false otherwise
*/
-static acc_status_t acc_board_reset_sensor(void)
+static bool acc_board_reset_sensor(void)
{
if (!acc_device_gpio_write(RSTn_PIN, 0))
{
ACC_LOG_ERROR("Unable to activate RSTn");
- return ACC_STATUS_FAILURE;
+ return false;
}
if (!acc_device_gpio_write(ENABLE_PIN, 0))
{
ACC_LOG_ERROR("Unable to deactivate ENABLE");
- return ACC_STATUS_FAILURE;
+ return false;
}
- return ACC_STATUS_SUCCESS;
+ return true;
}
-acc_status_t acc_board_start_sensor(acc_sensor_t sensor)
+void acc_board_start_sensor(acc_sensor_id_t sensor)
{
if (sensor_state[sensor - 1] == SENSOR_STATE_BUSY)
{
ACC_LOG_ERROR("Sensor %u already active.", sensor);
- return ACC_STATUS_FAILURE;
+ return;
}
if (acc_board_all_sensors_inactive())
@@ -258,7 +254,7 @@ acc_status_t acc_board_start_sensor(acc_sensor_t sensor)
{
ACC_LOG_ERROR("Unable to activate RSTn");
acc_board_reset_sensor();
- return ACC_STATUS_FAILURE;
+ return;
}
// Wait for PMU to stabilize
@@ -268,7 +264,7 @@ acc_status_t acc_board_start_sensor(acc_sensor_t sensor)
{
ACC_LOG_ERROR("Unable to activate ENABLE");
acc_board_reset_sensor();
- return ACC_STATUS_FAILURE;
+ return;
}
// Wait for Power On Reset
@@ -278,7 +274,7 @@ acc_status_t acc_board_start_sensor(acc_sensor_t sensor)
{
ACC_LOG_ERROR("Unable to deactivate RSTn");
acc_board_reset_sensor();
- return ACC_STATUS_FAILURE;
+ return;
}
for (uint_fast8_t sensor_index = 0; sensor_index < SENSOR_COUNT; sensor_index++)
@@ -289,50 +285,46 @@ acc_status_t acc_board_start_sensor(acc_sensor_t sensor)
if (sensor_state[sensor - 1] != SENSOR_STATE_READY) {
ACC_LOG_ERROR("Sensor has not been reset");
- return ACC_STATUS_FAILURE;
+ return;
}
sensor_state[sensor - 1] = SENSOR_STATE_BUSY;
-
- return ACC_STATUS_SUCCESS;
}
-acc_status_t acc_board_stop_sensor(acc_sensor_t sensor)
+void acc_board_stop_sensor(acc_sensor_id_t sensor)
{
if (sensor_state[sensor - 1] != SENSOR_STATE_BUSY)
{
ACC_LOG_ERROR("Sensor %u already inactive.", sensor);
- return ACC_STATUS_FAILURE;
+ return;
}
sensor_state[sensor - 1] = SENSOR_STATE_UNKNOWN;
if (acc_board_all_sensors_inactive())
{
- return acc_board_reset_sensor();
+ acc_board_reset_sensor();
}
-
- return ACC_STATUS_SUCCESS;
}
-acc_status_t acc_board_chip_select(acc_sensor_t sensor, uint_fast8_t cs_assert)
+bool acc_board_chip_select(acc_sensor_id_t sensor, uint_fast8_t cs_assert)
{
ACC_UNUSED(sensor);
ACC_UNUSED(cs_assert);
- return ACC_STATUS_SUCCESS;
+ return true;
}
-acc_sensor_t acc_board_get_sensor_count(void)
+uint32_t acc_board_get_sensor_count(void)
{
return SENSOR_COUNT;
}
-bool acc_board_is_sensor_interrupt_connected(acc_sensor_t sensor)
+bool acc_board_is_sensor_interrupt_connected(acc_sensor_id_t sensor)
{
ACC_UNUSED(sensor);
@@ -340,7 +332,7 @@ bool acc_board_is_sensor_interrupt_connected(acc_sensor_t sensor)
}
-bool acc_board_is_sensor_interrupt_active(acc_sensor_t sensor)
+bool acc_board_is_sensor_interrupt_active(acc_sensor_id_t sensor)
{
uint_fast8_t value;
@@ -354,14 +346,14 @@ bool acc_board_is_sensor_interrupt_active(acc_sensor_t sensor)
}
-acc_status_t acc_board_register_isr(acc_board_isr_t isr)
+acc_integration_register_isr_status_t acc_board_register_isr(acc_board_isr_t isr)
{
if (isr != NULL)
{
if (
!acc_device_gpio_register_isr(GPIO0_PIN, ACC_DEVICE_GPIO_EDGE_RISING, &isr_sensor1))
{
- return ACC_STATUS_FAILURE;
+ return ACC_INTEGRATION_REGISTER_ISR_STATUS_FAILURE;
}
}
else
@@ -369,13 +361,13 @@ acc_status_t acc_board_register_isr(acc_board_isr_t isr)
if (
!acc_device_gpio_register_isr(GPIO0_PIN, ACC_DEVICE_GPIO_EDGE_NONE, NULL))
{
- return ACC_STATUS_FAILURE;
+ return ACC_INTEGRATION_REGISTER_ISR_STATUS_FAILURE;
}
}
master_isr = isr;
- return ACC_STATUS_SUCCESS;
+ return ACC_INTEGRATION_REGISTER_ISR_STATUS_OK;
}
@@ -385,41 +377,36 @@ float acc_board_get_ref_freq(void)
}
-acc_status_t acc_board_set_ref_freq(float ref_freq)
+bool acc_board_set_ref_freq(float ref_freq)
{
+ // Not supported!
+
ACC_UNUSED(ref_freq);
- return ACC_STATUS_UNSUPPORTED;
+ return false;
}
-acc_status_t acc_board_sensor_transfer(acc_sensor_t sensor_id, uint8_t *buffer, size_t buffer_length)
+void acc_board_sensor_transfer(acc_sensor_id_t sensor_id, uint8_t *buffer, size_t buffer_length)
{
- acc_status_t status;
uint_fast8_t bus = acc_device_spi_get_bus(spi_handle);
acc_device_spi_lock(bus);
- if ((status = acc_board_chip_select(sensor_id, 1)))
+ if (!acc_board_chip_select(sensor_id, 1))
{
- ACC_LOG_ERROR("%s failed with %s", __func__, acc_log_status_name(status));
+ ACC_LOG_ERROR("%s failed", __func__);
acc_device_spi_unlock(bus);
- return status;
+ return;
}
- if ((status = acc_device_spi_transfer(spi_handle, buffer, buffer_length)))
+ if (!acc_device_spi_transfer(spi_handle, buffer, buffer_length))
{
acc_device_spi_unlock(bus);
- return status;
+ return;
}
- if ((status = acc_board_chip_select(sensor_id, 0)))
- {
- acc_device_spi_unlock(bus);
- return status;
- }
+ acc_board_chip_select(sensor_id, 0);
acc_device_spi_unlock(bus);
-
- return status;
}
diff --git a/Software/sparkx-sdk-addon/source/sparkx_detector_distance.c b/Software/sparkx-sdk-addon/user_source/sparkx_detector_distance.c
similarity index 79%
rename from Software/sparkx-sdk-addon/source/sparkx_detector_distance.c
rename to Software/sparkx-sdk-addon/user_source/sparkx_detector_distance.c
index e926178..72b003d 100644
--- a/Software/sparkx-sdk-addon/source/sparkx_detector_distance.c
+++ b/Software/sparkx-sdk-addon/user_source/sparkx_detector_distance.c
@@ -1,4 +1,4 @@
-// Copyright (c) Acconeer AB, 2018
+// Copyright (c) Acconeer AB, 2018-2019
// All rights reserved
#include
@@ -8,10 +8,10 @@
#include
#include "acc_detector_distance_peak.h"
-//#include "acc_os.h"
+#include "acc_driver_hal.h"
#include "acc_rss.h"
#include "acc_sweep_configuration.h"
-#include "acc_types.h"
+//#include "acc_types.h"
#include "acc_version.h"
@@ -31,51 +31,60 @@
*/
-#define FIXED_THRESHOLD_VALUE (1500)
-#define SENSOR_ID (1)
-#define RANGE_START_M (0.2)
-#define RANGE_LENGTH_M (0.5)
+#define FIXED_THRESHOLD_VALUE (1500)
+#define SENSOR_ID (1)
+#define RANGE_START_M (0.2f)
+#define RANGE_LENGTH_M (0.5f)
#define NUM_DISTANCE_DETECT 100
#define NUM_DISTANCE_THRESHOLD_DETECT 100
+static acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(
+ acc_detector_distance_peak_configuration_t distance_configuration);
+
+
+static acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_with_estimated_threshold(
+ acc_detector_distance_peak_configuration_t distance_configuration);
+
+
+static char *format_distances(uint16_t reflection_count,
+ const acc_detector_distance_peak_reflection_t *reflections,
+ float sensor_offset);
+
-static acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(acc_detector_distance_peak_configuration_t distance_configuration);
-static acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_with_estimated_threshold(acc_detector_distance_peak_configuration_t distance_configuration);
-static char *format_distances(uint16_t reflection_count,
- const acc_detector_distance_peak_reflection_t *reflections,
- float sensor_offset);
static void configure_detector(acc_detector_distance_peak_configuration_t distance_configuration);
-void waitForEnter(void);
+
static uint8_t not_interrupted = 1;
-void exit_handler(int sig_num)
-{
- ACC_UNUSED(sig_num);
- printf("\nCtrl+C pressed. Beginning shutdown\n");
- not_interrupted = 0;
-}
+void waitForEnter(void);
-int main(int argc, char *argv[])
-{
- ACC_UNUSED(argc);
- ACC_UNUSED(argv);
+void exit_handler(int sig_num);
+int main(void)
+{
acc_detector_distance_peak_status_t detector_status;
printf("Acconeer software version %s\n", ACC_VERSION);
printf("Acconeer RSS version %s\n", acc_rss_version());
- //Initialize Radar Service System
- if (!acc_rss_activate()) {
+ if (!acc_driver_hal_init())
+ {
+ return EXIT_FAILURE;
+ }
+
+ acc_hal_t hal = acc_driver_hal_get_implementation();
+
+ if (!acc_rss_activate_with_hal(&hal))
+ {
return EXIT_FAILURE;
}
//Create the detector configuration
acc_detector_distance_peak_configuration_t distance_configuration = acc_detector_distance_peak_configuration_create();
- if (distance_configuration == NULL) {
+ if (distance_configuration == NULL)
+ {
printf("\nacc_service_distance_configuration_create() failed");
return EXIT_FAILURE;
}
@@ -105,6 +114,7 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
+
acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(acc_detector_distance_peak_configuration_t distance_configuration)
{
acc_detector_distance_peak_status_t detector_status = ACC_DETECTOR_DISTANCE_PEAK_STATUS_SUCCESS;
@@ -118,6 +128,9 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(acc
detector_status = acc_detector_distance_peak_set_threshold_mode_fixed(distance_configuration, FIXED_THRESHOLD_VALUE);
+ // Not sure if this should be done
+ // acc_detector_distance_peak_set_sort_by_amplitude(distance_configuration, true);
+
acc_detector_distance_peak_handle_t handle = acc_detector_distance_peak_create(distance_configuration);
if (handle == NULL) {
@@ -126,10 +139,10 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(acc
}
acc_detector_distance_peak_get_metadata(handle, &metadata);
- printf("Free space absolute offset: %u mm\n", (unsigned int)(metadata.free_space_absolute_offset * 1000.0 + 0.5));
- printf("Actual start: %u mm\n", (unsigned int)(metadata.actual_start_m * 1000.0 + 0.5));
- printf("Actual length: %u mm\n", (unsigned int)(metadata.actual_length_m * 1000.0 + 0.5));
- printf("Actual end: %u mm\n", (unsigned int)((metadata.actual_start_m + metadata.actual_length_m) * 1000.0 + 0.5));
+ printf("Free space absolute offset: %u mm\n", (unsigned int)(metadata.free_space_absolute_offset * 1000.0f + 0.5f));
+ printf("Actual start: %u mm\n", (unsigned int)(metadata.actual_start_m * 1000.0f + 0.5f));
+ printf("Actual length: %u mm\n", (unsigned int)(metadata.actual_length_m * 1000.0f + 0.5f));
+ printf("Actual end: %u mm\n", (unsigned int)((metadata.actual_start_m + metadata.actual_length_m) * 1000.0f + 0.5f));
printf("\n");
acc_detector_distance_peak_result_info_t result_info;
@@ -155,8 +168,8 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(acc
printf("Distance detector: Reflections: %u. Seq. nr: %u. (%u-%u mm): %s\n",
(unsigned int)reflection_count,
(unsigned int)result_info.sequence_number,
- (unsigned int)(start_m * 1000.0 + 0.5),
- (unsigned int)(end_m * 1000.0 + 0.5),
+ (unsigned int)(start_m * 1000.0f + 0.5f),
+ (unsigned int)(end_m * 1000.0f + 0.5f),
format_distances(reflection_count, reflections, metadata.free_space_absolute_offset));
}
else {
@@ -175,10 +188,10 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls(acc
acc_detector_distance_peak_destroy(&handle);
return detector_status;
-
}
-acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_with_estimated_threshold(acc_detector_distance_peak_configuration_t distance_configuration)
+acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_with_estimated_threshold(
+ acc_detector_distance_peak_configuration_t distance_configuration)
{
acc_detector_distance_peak_status_t detector_status = ACC_DETECTOR_DISTANCE_PEAK_STATUS_SUCCESS;
acc_detector_distance_peak_metadata_t metadata;
@@ -197,10 +210,10 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_wit
}
acc_detector_distance_peak_get_metadata(handle, &metadata);
- printf("Free space absolute offset: %u mm\n", (unsigned int)(metadata.free_space_absolute_offset * 1000.0 + 0.5));
- printf("Actual start: %u mm\n", (unsigned int)(metadata.actual_start_m * 1000.0 + 0.5));
- printf("Actual length: %u mm\n", (unsigned int)(metadata.actual_length_m * 1000.0 + 0.5));
- printf("Actual end: %u mm\n", (unsigned int)((metadata.actual_start_m + metadata.actual_length_m) * 1000.0 + 0.5));
+ printf("Free space absolute offset: %u mm\n", (unsigned int)(metadata.free_space_absolute_offset * 1000.0f + 0.5f));
+ printf("Actual start: %u mm\n", (unsigned int)(metadata.actual_start_m * 1000.0f + 0.5f));
+ printf("Actual length: %u mm\n", (unsigned int)(metadata.actual_length_m * 1000.0f + 0.5f));
+ printf("Actual end: %u mm\n", (unsigned int)((metadata.actual_start_m + metadata.actual_length_m) * 1000.0f + 0.5f));
printf("\n");
acc_detector_distance_peak_result_info_t result_info;
@@ -209,13 +222,24 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_wit
float end_m = metadata.actual_start_m + metadata.actual_length_m;
detector_status = acc_detector_distance_peak_set_threshold_mode_estimation(distance_configuration);
+ if (detector_status != ACC_DETECTOR_DISTANCE_PEAK_STATUS_SUCCESS)
+ {
+ printf("Setting threshold estimation mode failed.\n"); // unsure
+ return detector_status;
+ }
printf("Estimating threshold...\n");
detector_status = acc_detector_distance_peak_threshold_estimation_update(distance_configuration,
- 100,
- metadata.actual_start_m,
- metadata.actual_start_m + metadata.actual_length_m);
+ 100,
+ metadata.actual_start_m,
+ metadata.actual_start_m + metadata.actual_length_m);
+ if (detector_status != ACC_DETECTOR_DISTANCE_PEAK_STATUS_SUCCESS)
+ {
+ printf("Threshold estimation failed.\n"); // unsure
+ return detector_status;
+ }
+
printf("Estimating threshold done...\n");
printf("\nPress ENTER to measure threshold-ed distance\nThen press CTRL+C to STOP\n");
waitForEnter();
@@ -243,8 +267,8 @@ acc_detector_distance_peak_status_t distance_peak_detect_with_blocking_calls_wit
printf("Distance detector: Reflections: %u. Seq. nr: %u. (%u-%u mm): %s\n",
(unsigned int)reflection_count,
(unsigned int)result_info.sequence_number,
- (unsigned int)(start_m * 1000.0 + 0.5),
- (unsigned int)(end_m * 1000.0 + 0.5),
+ (unsigned int)(start_m * 1000.0f + 0.5f),
+ (unsigned int)(end_m * 1000.0f + 0.5f),
format_distances(reflection_count, reflections, metadata.free_space_absolute_offset));
}
else {
@@ -287,8 +311,8 @@ char *format_distances(uint16_t reflection_count,
}
count = snprintf(&buffer[total_count], sizeof(buffer) - total_count, "%u mm (%u)",
- (unsigned int)((reflections[reflection_index].distance - sensor_offset) * 1000.0 + 0.5),
- (unsigned int)(reflections[reflection_index].amplitude + 0.5));
+ (unsigned int)((reflections[reflection_index].distance - sensor_offset) * 1000.0f + 0.5f),
+ (unsigned int)(reflections[reflection_index].amplitude + 0.5f));
if (count < 0) {
break;
}
@@ -323,4 +347,10 @@ void waitForEnter(void)
{
fflush(stdout);
getchar();
-}
\ No newline at end of file
+}
+
+void exit_handler(int sig_num)
+{
+ printf("\nCtrl+C pressed. %i Beginning shutdown\n", sig_num);
+ not_interrupted = 0;
+}