Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix: update from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 6, 2023
1 parent 126e4dd commit 213e299
Show file tree
Hide file tree
Showing 18 changed files with 314 additions and 334 deletions.
11 changes: 11 additions & 0 deletions boards/nrf9160dk_nrf9160_ns_0_14_0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable external flash
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_DEVICETREE=y
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
12 changes: 12 additions & 0 deletions boards/nrf9160dk_nrf9160_ns_0_14_0.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
/* Configure partition manager to use mx25r64 as the external flash */
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};
8 changes: 8 additions & 0 deletions child_image/mcuboot.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Increase the monotonic firmware version before building a firmware update
CONFIG_FW_INFO_FIRMWARE_VERSION=1
20 changes: 20 additions & 0 deletions child_image/mcuboot/boards/nrf9160dk_nrf9160_0_14_0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# MCUboot config to enable secondary slot on the external flash

CONFIG_FLASH=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_SPI_NOR_SFDP_DEVICETREE=y

CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x13E00
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

CONFIG_MULTITHREADING=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_BOOT_MAX_IMG_SECTORS=256
19 changes: 19 additions & 0 deletions child_image/mcuboot/boards/nrf9160dk_nrf9160_0_14_0.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Enable high drive mode for the SPI3 pins to get a square signal at 8 MHz */
&spi3_default {
group1 {
nordic,drive-mode = <NRF_DRIVE_H0H1>;
};
};

/ {
/* Configure partition manager to use mx25r64 as the external flash */
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};
2 changes: 1 addition & 1 deletion doc/asset_tracker_v2_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ After programming the application and all the prerequisites to your development
<inf> app_event_manager: APP_EVT_DATA_GET - Requested data types (MOD_DYN, BAT, ENV, LOCATION)
<inf> app_event_manager: LOCATION_MODULE_EVT_ACTIVE
<inf> app_event_manager: SENSOR_EVT_ENVIRONMENTAL_NOT_SUPPORTED
<inf> app_event_manager: SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED
<inf> app_event_manager: MODEM_EVT_MODEM_DYNAMIC_DATA_NOT_READY
<inf> app_event_manager: SENSOR_EVT_FUEL_GAUGE_READY
<inf> app_event_manager: LOCATION_MODULE_EVT_INACTIVE
<inf> app_event_manager: LOCATION_MODULE_EVT_GNSS_DATA_READY
<inf> app_event_manager: DATA_EVT_DATA_READY
Expand Down
3 changes: 2 additions & 1 deletion doc/sensor_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ When the module receives an :c:enum:`APP_EVT_DATA_GET` event and the :c:enum:`AP
When data sampling has been carried out, the :c:enum:`SENSOR_EVT_ENVIRONMENTAL_DATA_READY` event is sent from the module with the sampled environmental sensor values.

.. note::
The nRF9160 DK does not have any external sensors.
The nRF9160 DK does not have any external sensors and battery fuel gauge.
If the sensor module is queried for sensor data when building for the DK, the event :c:enum:`SENSOR_EVT_ENVIRONMENTAL_NOT_SUPPORTED` is sent out by the module
upon data sampling.
For battery fuel gauge data, :c:enum:`SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED` is sent.

Motion activity detection
=========================
Expand Down
4 changes: 4 additions & 0 deletions pm_static_nrf9160dk_nrf9160_ns_0_14_0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mcuboot_secondary:
region: external_flash
address: 0x0
size: 0xD0000
9 changes: 6 additions & 3 deletions src/cloud/lwm2m_integration/lwm2m_integration.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,26 +507,29 @@ int cloud_wrap_cloud_location_send(char *buf, size_t len, bool ack, uint32_t id)
ARG_UNUSED(buf);
ARG_UNUSED(len);
ARG_UNUSED(id);
ARG_UNUSED(ack);

return location_assistance_ground_fix_request_send(&client, ack);
return location_assistance_ground_fix_request_send(&client);
}

int cloud_wrap_agps_request_send(char *buf, size_t len, bool ack, uint32_t id)
{
ARG_UNUSED(buf);
ARG_UNUSED(len);
ARG_UNUSED(id);
ARG_UNUSED(ack);

return location_assistance_agps_request_send(&client, ack);
return location_assistance_agps_request_send(&client);
}

int cloud_wrap_pgps_request_send(char *buf, size_t len, bool ack, uint32_t id)
{
ARG_UNUSED(buf);
ARG_UNUSED(len);
ARG_UNUSED(id);
ARG_UNUSED(ack);

return location_assistance_pgps_request_send(&client, ack);
return location_assistance_pgps_request_send(&client);
}

int cloud_wrap_memfault_data_send(char *buf, size_t len, bool ack, uint32_t id)
Expand Down
6 changes: 4 additions & 2 deletions src/events/sensor_module_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ static char *get_evt_type_str(enum sensor_module_event_type type)
return "SENSOR_EVT_MOVEMENT_IMPACT_DETECTED";
case SENSOR_EVT_ENVIRONMENTAL_DATA_READY:
return "SENSOR_EVT_ENVIRONMENTAL_DATA_READY";
case SENSOR_EVT_FUEL_GAUGE_READY:
return "SENSOR_EVT_FUEL_GAUGE_READY";
case SENSOR_EVT_ENVIRONMENTAL_NOT_SUPPORTED:
return "SENSOR_EVT_ENVIRONMENTAL_NOT_SUPPORTED";
case SENSOR_EVT_FUEL_GAUGE_READY:
return "SENSOR_EVT_FUEL_GAUGE_READY";
case SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED:
return "SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED";
case SENSOR_EVT_SHUTDOWN_READY:
return "SENSOR_EVT_SHUTDOWN_READY";
case SENSOR_EVT_ERROR:
Expand Down
7 changes: 5 additions & 2 deletions src/events/sensor_module_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ enum sensor_module_event_type {
*/
SENSOR_EVT_ENVIRONMENTAL_DATA_READY,

/** Environmental sensors are not supported on the current board. */
SENSOR_EVT_ENVIRONMENTAL_NOT_SUPPORTED,

/** Battery fuel gauge data has been sampled.
* Payload is of type @ref sensor_module_data (bat).
*/
SENSOR_EVT_FUEL_GAUGE_READY,

/** Environmental sensors are not supported on the current board. */
SENSOR_EVT_ENVIRONMENTAL_NOT_SUPPORTED,
/** Battery data is not supported on the current board. */
SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED,

/** The sensor module has performed all procedures to prepare for
* a shutdown of the system. The event carries the ID (id) of the module.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Kconfig.data_module
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ config DATA_DYNAMIC_MODEM_BUFFER_STORE
default y

config DATA_BATTERY_BUFFER_STORE
bool "Store battery data received from the modem module"
bool "Store battery data received from the sensor module"
default y

config DATA_UI_BUFFER_STORE
Expand Down
4 changes: 4 additions & 0 deletions src/modules/data_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,10 @@ static void on_all_states(struct data_msg_data *msg)
requested_data_status_set(APP_DATA_BATTERY);
}

if (IS_EVENT(msg, sensor, SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED)) {
requested_data_status_set(APP_DATA_BATTERY);
}

if (IS_EVENT(msg, sensor, SENSOR_EVT_ENVIRONMENTAL_DATA_READY)) {
struct cloud_data_sensors new_sensor_data = {
.temperature = msg->module.sensor.data.sensors.temperature,
Expand Down
14 changes: 12 additions & 2 deletions src/modules/sensor_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ static void apply_config(struct sensor_msg_data *msg)

static void battery_data_get(void)
{
struct sensor_module_event *sensor_module_event;

#if defined(CONFIG_ADP536X)
int err;
struct sensor_module_event *sensor_module_event;
uint8_t percentage;

err = adp536x_fg_soc(&percentage);
Expand All @@ -260,11 +261,20 @@ static void battery_data_get(void)
}

sensor_module_event = new_sensor_module_event();

__ASSERT(sensor_module_event, "Not enough heap left to allocate event");

sensor_module_event->data.bat.timestamp = k_uptime_get();
sensor_module_event->data.bat.battery_level = percentage;
sensor_module_event->type = SENSOR_EVT_FUEL_GAUGE_READY;
APP_EVENT_SUBMIT(sensor_module_event);
#else
sensor_module_event = new_sensor_module_event();

__ASSERT(sensor_module_event, "Not enough heap left to allocate event");

sensor_module_event->type = SENSOR_EVT_FUEL_GAUGE_NOT_SUPPORTED;
#endif
APP_EVENT_SUBMIT(sensor_module_event);
}

static void environmental_data_get(void)
Expand Down
17 changes: 12 additions & 5 deletions tests/json_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(json_common_test)

test_runner_generate(src/main.c)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

target_include_directories(app PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ../../src/cloud/cloud_codec/
${CMAKE_CURRENT_SOURCE_DIR} ../../../../../nrfxlib/nrf_modem/include/)
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/../../src/cloud/cloud_codec/
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../nrfxlib/nrf_modem/include/)

target_sources(app PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} mock/date_time_mock.c
${CMAKE_CURRENT_SOURCE_DIR} ../../src/cloud/cloud_codec/json_common.c
${CMAKE_CURRENT_SOURCE_DIR} ../../src/cloud/cloud_codec/json_helpers.c)
${CMAKE_CURRENT_SOURCE_DIR}/mock/date_time_mock.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/cloud/cloud_codec/json_common.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/cloud/cloud_codec/json_helpers.c)

target_compile_options(app PRIVATE
-DCONFIG_ASSET_TRACKER_V2_APP_VERSION_MAX_LEN=20
Expand All @@ -30,3 +33,7 @@ target_compile_options(app PRIVATE
-DCONFIG_LOCATION_METHOD_WIFI=y
-DCONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT=10
)

# The test uses double precision floating point numbers. This is not enabled by default in unity
# unless we set the following define.
zephyr_compile_definitions(UNITY_INCLUDE_DOUBLE)
4 changes: 1 addition & 3 deletions tests/json_common/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# ZTEST
CONFIG_ZTEST=y
CONFIG_ZTEST_STACK_SIZE=4096
CONFIG_UNITY=y

# cJSON
CONFIG_CJSON_LIB=y
Expand Down
Loading

0 comments on commit 213e299

Please sign in to comment.