Skip to content

Commit

Permalink
Merge branch 'master' into Modified_Script_Sep_15
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Sep 15, 2022
2 parents 8f536a4 + bae0bc7 commit eda651b
Show file tree
Hide file tree
Showing 124 changed files with 19,678 additions and 16,964 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cirque.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ concurrency:
jobs:
cirque:
name: Cirque
timeout-minutes: 75
timeout-minutes: 90

env:
DOCKER_RUN_VERSION: 0.5.99
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
&& scripts/build/gn_gen_cirque.sh
'
- name: Run Tests
timeout-minutes: 25
timeout-minutes: 45
run: |
integrations/docker/images/chip-build-cirque/run.sh \
--env LOG_DIR=/tmp/cirque_test_output \
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,78 @@ jobs:
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build:0.5.99

steps:
- uses: Wandalen/[email protected]
if: ${{ !env.ACT }}
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
# To use act like:
# act -j code-lints
#
# Note you likely still need to have non submodules setup for the
# local machine, like:
# git submodule deinit --all
- uses: actions/checkout@v3
if: ${{ env.ACT }}
name: Checkout (ACT for local build)

# Bootstrap and checkout for internal scripts (like idl_lint)
# to run
- name: Checkout submodules
run: scripts/checkout_submodules.py --shallow --platform linux
- name: Bootstrap
timeout-minutes: 10
run: scripts/build/gn_bootstrap.sh

- name: Check for matter lint errors
if: always()
run: |
for idl_file in $(find . -name '*.matter'); do
# TODO: all these conformance failures should be fixed
# Issues exist for most of them:
# https://github.com/project-chip/connectedhomeip/issues/19180
# https://github.com/project-chip/connectedhomeip/issues/19176
# https://github.com/project-chip/connectedhomeip/issues/19175
# https://github.com/project-chip/connectedhomeip/issues/19173
# https://github.com/project-chip/connectedhomeip/issues/19169
# https://github.com/project-chip/connectedhomeip/issues/22640
if [ "$idl_file" = './examples/all-clusters-app/all-clusters-common/all-clusters-app.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter' ]; then continue; fi
if [ "$idl_file" = './examples/lighting-app/lighting-common/lighting-app.matter' ]; then continue; fi
if [ "$idl_file" = './examples/log-source-app/log-source-common/log-source-app.matter' ]; then continue; fi
if [ "$idl_file" = './examples/placeholder/linux/apps/app1/config.matter' ]; then continue; fi
if [ "$idl_file" = './examples/placeholder/linux/apps/app2/config.matter' ]; then continue; fi
if [ "$idl_file" = './examples/thermostat/thermostat-common/thermostat.matter' ]; then continue; fi
if [ "$idl_file" = './examples/window-app/common/window-app.matter' ]; then continue; fi
./scripts/run_in_build_env.sh "./scripts/idl_lint.py --log-level warn $idl_file" >/dev/null || exit 1
done
- name: Check broken links
# On-push disabled until the job can run fully green
Expand Down
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@
"esp32-m5stack-all-clusters-ipv6only",
"esp32-m5stack-all-clusters-rpc",
"esp32-m5stack-all-clusters-rpc-ipv6only",
"infineon-p6-all-clusters",
"infineon-p6-lock",
"infineon-p6-light",
"infineon-psoc6-all-clusters",
"infineon-psoc6-lock",
"infineon-psoc6-light",
"linux-arm64-all-clusters",
"linux-arm64-all-clusters-ipv6only",
"linux-arm64-chip-tool",
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/infineon_psoc6_software_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ Infineon PSoC6 example applications by passing the

```
$ scripts/build/build_examples.py --enable-flashbundle --target infineon-psoc6-lock-ota build
$ third_party/psoc6/psoc6_sdk/ota/ota_base_build.sh out/infineon-psoc6-lock-ota chip-psoc6-lock-example
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh out/infineon-psoc6-lock-ota chip-psoc6-lock-example
```

- Build the PSoC6 OTA Update application from the chip root dir and create OTA
file

```
$ scripts/build/build_examples.py --enable-flashbundle --no-log-timestamps --target infineon-psoc6-lock-ota-updateimage build
$ third_party/psoc6/psoc6_sdk/ota/ota_update_build.sh out/infineon-psoc6-lock-ota-updateimage chip-psoc6-lock-example
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh out/infineon-psoc6-lock-ota-updateimage chip-psoc6-lock-example
```

* Additionally a pre-compiled bootloader must be flashed to the board using
[Cypress Programmer](https://softwaretools.infineon.com/tools/com.ifx.tb.tool.cypressprogrammer).
This image can be found at:

$ ./third_party/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex
$ ./third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex

* In a terminal start the Provider app passing to it the path to the Matter
OTA file created in the previous step:(output of ota_update_build step)
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ config("psoc6_ota_config") {

psoc6_sdk_sources("all_clusters_app_sdk_sources") {
include_dirs = [
"${chip_root}/src/platform/PSOC6",
"${chip_root}/src/platform/Infineon/PSOC6",
"${psoc6_project_dir}/include",
"${examples_plat_dir}",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012

/* The SoftwareVersion attribute of the Basic cluster. */
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1
#endif

// For convenience, Chip Security Test Mode can be enabled and the
// requirement for authentication in various protocols can be disabled.
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
"AllClustersCommandDelegate.cpp",
"AppOptions.cpp",
"WindowCoveringManager.cpp",
"include/tv-callbacks.cpp",
"include/tv-callbacks.h",
"main-common.cpp",
Expand Down
138 changes: 138 additions & 0 deletions examples/all-clusters-app/linux/WindowCoveringManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/**
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "WindowCoveringManager.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <platform/internal/CHIPDeviceLayerInternal.h>
#include <system/SystemClock.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters::WindowCovering;
using namespace chip::System::Clock::Literals;

namespace {

constexpr const System::Clock::Milliseconds32 kIncrementMovementTimeout = 700_ms32;
constexpr const uint16_t kDefaultMovementStep = 2000;

} // namespace

void WindowCoveringManager::Init(EndpointId endpoint)
{
mState = OperationalState::Stall;
mCurrentPosition.SetNonNull(static_cast<uint16_t>(0));
mTargetPosition.SetNonNull(static_cast<uint16_t>(0));
SetEndpoint(endpoint);
}

void WindowCoveringManager::HandleMovementTimer(System::Layer * layer, void * aAppState)
{
WindowCoveringManager * manager = reinterpret_cast<WindowCoveringManager *>(aAppState);

VerifyOrReturn(manager->mState != OperationalState::Stall);

uint16_t currentPosition = manager->mCurrentPosition.Value();
uint16_t targetPosition = manager->mTargetPosition.Value();

ChipLogProgress(NotSpecified, "HandleMovementTimer:currentPosition:%u, targetPosition:%u", currentPosition, targetPosition);

if (OperationalState::MovingUpOrOpen == manager->mState)
{
if (currentPosition > targetPosition)
{
uint16_t tempPosition =
currentPosition > kDefaultMovementStep ? static_cast<uint16_t>(currentPosition - kDefaultMovementStep) : 0;
currentPosition = tempPosition > targetPosition ? tempPosition : targetPosition;

manager->mCurrentPosition.SetNonNull(currentPosition);
}
else
{
ChipLogProgress(NotSpecified, "Reached the target position");
return;
}
}
else
{
if (currentPosition < targetPosition)
{
uint16_t tempPosition = static_cast<uint16_t>(currentPosition + kDefaultMovementStep);
currentPosition = tempPosition < targetPosition ? tempPosition : targetPosition;
manager->mCurrentPosition.SetNonNull(currentPosition);
}
else
{
ChipLogProgress(NotSpecified, "Reached the target position");
return;
}
}

if (HasFeature(manager->mEndpoint, Feature::kPositionAwareLift))
{
LiftPositionSet(manager->mEndpoint, manager->mCurrentPosition);
}

if (HasFeature(manager->mEndpoint, Feature::kPositionAwareTilt))
{
TiltPositionSet(manager->mEndpoint, manager->mCurrentPosition);
}

if (manager->mCurrentPosition != manager->mTargetPosition)
{
LogErrorOnFailure(DeviceLayer::SystemLayer().StartTimer(kIncrementMovementTimeout, HandleMovementTimer, aAppState));
}
}

CHIP_ERROR WindowCoveringManager::HandleMovement(WindowCoveringType type)
{
mState = OperationalStateGet(mEndpoint, OperationalStatus::kGlobal);

if (OperationalState::Stall == mState)
{
ChipLogProgress(NotSpecified, "Covering is currently not moving");
return CHIP_NO_ERROR;
}

// Cancel ongoing window covering movement timer if any.
DeviceLayer::SystemLayer().CancelTimer(HandleMovementTimer, this);

// At least one of the Lift and Tilt features SHALL be supported.
if (type == WindowCoveringType::Lift)
{
Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, mCurrentPosition);
Attributes::TargetPositionLiftPercent100ths::Get(mEndpoint, mTargetPosition);
}
else
{
Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, mCurrentPosition);
Attributes::TargetPositionTiltPercent100ths::Get(mEndpoint, mTargetPosition);
}

VerifyOrReturnError(!mCurrentPosition.IsNull(), CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(!mTargetPosition.IsNull(), CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(mCurrentPosition != mTargetPosition, CHIP_ERROR_INCORRECT_STATE);

return DeviceLayer::SystemLayer().StartTimer(kIncrementMovementTimeout, HandleMovementTimer, this);
}

CHIP_ERROR WindowCoveringManager::HandleStopMotion()
{

DeviceLayer::SystemLayer().CancelTimer(HandleMovementTimer, this);
return CHIP_NO_ERROR;
}
49 changes: 49 additions & 0 deletions examples/all-clusters-app/linux/WindowCoveringManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <app/clusters/window-covering-server/window-covering-server.h>

namespace chip {
namespace app {
namespace Clusters {
namespace WindowCovering {

class WindowCoveringManager : public Delegate
{
public:
void Init(chip::EndpointId endpoint);
CHIP_ERROR HandleMovement(WindowCoveringType type) override;
CHIP_ERROR HandleStopMotion() override;

private:
OperationalState mState;
NPercent100ths mCurrentPosition;
NPercent100ths mTargetPosition;

/**
* @brief
* The callback function to be called when "movement timer" expires.
*/
static void HandleMovementTimer(chip::System::Layer * layer, void * aAppState);
};

} // namespace WindowCovering
} // namespace Clusters
} // namespace app
} // namespace chip
9 changes: 9 additions & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "main-common.h"
#include "AllClustersCommandDelegate.h"
#include "WindowCoveringManager.h"
#include "include/tv-callbacks.h"
#include <app-common/zap-generated/att-storage.h>
#include <app-common/zap-generated/attribute-type.h>
Expand Down Expand Up @@ -59,6 +60,7 @@ constexpr const char kChipEventFifoPathPrefix[] = "/tmp/chip_all_clusters_fifo_"
LowPowerManager sLowPowerManager;
NamedPipeCommands sChipNamedPipeCommands;
AllClustersCommandDelegate sAllClustersCommandDelegate;
chip::app::Clusters::WindowCovering::WindowCoveringManager sWindowCoveringManager;

// TODO(#20664) REPL test will fail if signal SIGINT is not caught, temporarily keep following logic.

Expand Down Expand Up @@ -264,3 +266,10 @@ void emberAfLowPowerClusterInitCallback(EndpointId endpoint)
ChipLogProgress(NotSpecified, "TV Linux App: LowPower::SetDefaultDelegate");
chip::app::Clusters::LowPower::SetDefaultDelegate(endpoint, &sLowPowerManager);
}

void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint)
{
sWindowCoveringManager.Init(endpoint);
chip::app::Clusters::WindowCovering::SetDefaultDelegate(endpoint, &sWindowCoveringManager);
chip::app::Clusters::WindowCovering::ConfigStatusUpdateFeatures(endpoint);
}
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ config("psoc6_ota_config") {

psoc6_sdk_sources("all_clusters_app_sdk_sources") {
include_dirs = [
"${chip_root}/src/platform/PSOC6",
"${chip_root}/src/platform/Infineon/PSOC6",
"${psoc6_project_dir}/include",
"${examples_plat_dir}",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012

/* The SoftwareVersion attribute of the Basic cluster. */
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1
#endif

// For convenience, Chip Security Test Mode can be enabled and the
// requirement for authentication in various protocols can be disabled.
Expand Down
Loading

0 comments on commit eda651b

Please sign in to comment.