Skip to content

Commit 053a8e6

Browse files
authored
Merge branch 'master' into add_chef_rootnode_fan
2 parents 52fefc3 + 5ca254a commit 053a8e6

File tree

77 files changed

+1065
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1065
-252
lines changed

.github/workflows/lint.yml

+63
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,78 @@ jobs:
2727
runs-on: ubuntu-latest
2828
if: github.actor != 'restyled-io[bot]'
2929

30+
container:
31+
image: connectedhomeip/chip-build:0.5.99
32+
3033
steps:
3134
- uses: Wandalen/wretry.action@v1.0.15
35+
if: ${{ !env.ACT }}
3236
name: Checkout
3337
with:
3438
action: actions/checkout@v3
3539
with: |
3640
token: ${{ github.token }}
3741
attempt_limit: 3
3842
attempt_delay: 2000
43+
# To use act like:
44+
# act -j code-lints
45+
#
46+
# Note you likely still need to have non submodules setup for the
47+
# local machine, like:
48+
# git submodule deinit --all
49+
- uses: actions/checkout@v3
50+
if: ${{ env.ACT }}
51+
name: Checkout (ACT for local build)
52+
53+
# Bootstrap and checkout for internal scripts (like idl_lint)
54+
# to run
55+
- name: Checkout submodules
56+
run: scripts/checkout_submodules.py --shallow --platform linux
57+
- name: Bootstrap
58+
timeout-minutes: 10
59+
run: scripts/build/gn_bootstrap.sh
60+
61+
- name: Check for matter lint errors
62+
if: always()
63+
run: |
64+
for idl_file in $(find . -name '*.matter'); do
65+
# TODO: all these conformance failures should be fixed
66+
# Issues exist for most of them:
67+
# https://github.com/project-chip/connectedhomeip/issues/19180
68+
# https://github.com/project-chip/connectedhomeip/issues/19176
69+
# https://github.com/project-chip/connectedhomeip/issues/19175
70+
# https://github.com/project-chip/connectedhomeip/issues/19173
71+
# https://github.com/project-chip/connectedhomeip/issues/19169
72+
# https://github.com/project-chip/connectedhomeip/issues/22640
73+
if [ "$idl_file" = './examples/all-clusters-app/all-clusters-common/all-clusters-app.matter' ]; then continue; fi
74+
if [ "$idl_file" = './examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi
75+
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO' ]; then continue; fi
76+
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter' ]; then continue; fi
77+
if [ "$idl_file" = './examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi
78+
if [ "$idl_file" = './examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter' ]; then continue; fi
79+
if [ "$idl_file" = './examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter' ]; then continue; fi
80+
if [ "$idl_file" = './examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter' ]; then continue; fi
81+
if [ "$idl_file" = './examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter' ]; then continue; fi
82+
if [ "$idl_file" = './examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter' ]; then continue; fi
83+
if [ "$idl_file" = './examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter' ]; then continue; fi
84+
if [ "$idl_file" = './examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter' ]; then continue; fi
85+
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter' ]; then continue; fi
86+
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter' ]; then continue; fi
87+
if [ "$idl_file" = './examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter' ]; then continue; fi
88+
if [ "$idl_file" = './examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter' ]; then continue; fi
89+
if [ "$idl_file" = './examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter' ]; then continue; fi
90+
if [ "$idl_file" = './examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter' ]; then continue; fi
91+
if [ "$idl_file" = './examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter' ]; then continue; fi
92+
if [ "$idl_file" = './examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter' ]; then continue; fi
93+
if [ "$idl_file" = './examples/lighting-app/lighting-common/lighting-app.matter' ]; then continue; fi
94+
if [ "$idl_file" = './examples/log-source-app/log-source-common/log-source-app.matter' ]; then continue; fi
95+
if [ "$idl_file" = './examples/placeholder/linux/apps/app1/config.matter' ]; then continue; fi
96+
if [ "$idl_file" = './examples/placeholder/linux/apps/app2/config.matter' ]; then continue; fi
97+
if [ "$idl_file" = './examples/thermostat/thermostat-common/thermostat.matter' ]; then continue; fi
98+
if [ "$idl_file" = './examples/window-app/common/window-app.matter' ]; then continue; fi
99+
100+
./scripts/run_in_build_env.sh "./scripts/idl_lint.py --log-level warn $idl_file" >/dev/null || exit 1
101+
done
39102
40103
- name: Check broken links
41104
# On-push disabled until the job can run fully green

.vscode/tasks.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,9 @@
396396
"esp32-m5stack-all-clusters-ipv6only",
397397
"esp32-m5stack-all-clusters-rpc",
398398
"esp32-m5stack-all-clusters-rpc-ipv6only",
399-
"infineon-p6-all-clusters",
400-
"infineon-p6-lock",
401-
"infineon-p6-light",
399+
"infineon-psoc6-all-clusters",
400+
"infineon-psoc6-lock",
401+
"infineon-psoc6-light",
402402
"linux-arm64-all-clusters",
403403
"linux-arm64-all-clusters-ipv6only",
404404
"linux-arm64-chip-tool",

docs/guides/infineon_psoc6_software_update.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ Infineon PSoC6 example applications by passing the
2525

2626
```
2727
$ scripts/build/build_examples.py --enable-flashbundle --target infineon-psoc6-lock-ota build
28-
$ third_party/psoc6/psoc6_sdk/ota/ota_base_build.sh out/infineon-psoc6-lock-ota chip-psoc6-lock-example
28+
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh out/infineon-psoc6-lock-ota chip-psoc6-lock-example
2929
```
3030

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

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

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

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

4545
* In a terminal start the Provider app passing to it the path to the Matter
4646
OTA file created in the previous step:(output of ota_update_build step)

examples/all-clusters-app/infineon/psoc6/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ config("psoc6_ota_config") {
8080

8181
psoc6_sdk_sources("all_clusters_app_sdk_sources") {
8282
include_dirs = [
83-
"${chip_root}/src/platform/PSOC6",
83+
"${chip_root}/src/platform/Infineon/PSOC6",
8484
"${psoc6_project_dir}/include",
8585
"${examples_plat_dir}",
8686
]

examples/all-clusters-app/infineon/psoc6/include/CHIPProjectConfig.h

+2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012
5252

5353
/* The SoftwareVersion attribute of the Basic cluster. */
54+
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
5455
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1
56+
#endif
5557

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

examples/all-clusters-app/linux/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ source_set("chip-all-clusters-common") {
2626
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
2727
"AllClustersCommandDelegate.cpp",
2828
"AppOptions.cpp",
29+
"WindowCoveringManager.cpp",
2930
"include/tv-callbacks.cpp",
3031
"include/tv-callbacks.h",
3132
"main-common.cpp",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/**
2+
*
3+
* Copyright (c) 2022 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "WindowCoveringManager.h"
19+
#include <app-common/zap-generated/attributes/Accessors.h>
20+
#include <platform/internal/CHIPDeviceLayerInternal.h>
21+
#include <system/SystemClock.h>
22+
23+
using namespace chip;
24+
using namespace chip::app;
25+
using namespace chip::app::Clusters::WindowCovering;
26+
using namespace chip::System::Clock::Literals;
27+
28+
namespace {
29+
30+
constexpr const System::Clock::Milliseconds32 kIncrementMovementTimeout = 700_ms32;
31+
constexpr const uint16_t kDefaultMovementStep = 2000;
32+
33+
} // namespace
34+
35+
void WindowCoveringManager::Init(EndpointId endpoint)
36+
{
37+
mState = OperationalState::Stall;
38+
mCurrentPosition.SetNonNull(static_cast<uint16_t>(0));
39+
mTargetPosition.SetNonNull(static_cast<uint16_t>(0));
40+
SetEndpoint(endpoint);
41+
}
42+
43+
void WindowCoveringManager::HandleMovementTimer(System::Layer * layer, void * aAppState)
44+
{
45+
WindowCoveringManager * manager = reinterpret_cast<WindowCoveringManager *>(aAppState);
46+
47+
VerifyOrReturn(manager->mState != OperationalState::Stall);
48+
49+
uint16_t currentPosition = manager->mCurrentPosition.Value();
50+
uint16_t targetPosition = manager->mTargetPosition.Value();
51+
52+
ChipLogProgress(NotSpecified, "HandleMovementTimer:currentPosition:%u, targetPosition:%u", currentPosition, targetPosition);
53+
54+
if (OperationalState::MovingUpOrOpen == manager->mState)
55+
{
56+
if (currentPosition > targetPosition)
57+
{
58+
uint16_t tempPosition =
59+
currentPosition > kDefaultMovementStep ? static_cast<uint16_t>(currentPosition - kDefaultMovementStep) : 0;
60+
currentPosition = tempPosition > targetPosition ? tempPosition : targetPosition;
61+
62+
manager->mCurrentPosition.SetNonNull(currentPosition);
63+
}
64+
else
65+
{
66+
ChipLogProgress(NotSpecified, "Reached the target position");
67+
return;
68+
}
69+
}
70+
else
71+
{
72+
if (currentPosition < targetPosition)
73+
{
74+
uint16_t tempPosition = static_cast<uint16_t>(currentPosition + kDefaultMovementStep);
75+
currentPosition = tempPosition < targetPosition ? tempPosition : targetPosition;
76+
manager->mCurrentPosition.SetNonNull(currentPosition);
77+
}
78+
else
79+
{
80+
ChipLogProgress(NotSpecified, "Reached the target position");
81+
return;
82+
}
83+
}
84+
85+
if (HasFeature(manager->mEndpoint, Feature::kPositionAwareLift))
86+
{
87+
LiftPositionSet(manager->mEndpoint, manager->mCurrentPosition);
88+
}
89+
90+
if (HasFeature(manager->mEndpoint, Feature::kPositionAwareTilt))
91+
{
92+
TiltPositionSet(manager->mEndpoint, manager->mCurrentPosition);
93+
}
94+
95+
if (manager->mCurrentPosition != manager->mTargetPosition)
96+
{
97+
LogErrorOnFailure(DeviceLayer::SystemLayer().StartTimer(kIncrementMovementTimeout, HandleMovementTimer, aAppState));
98+
}
99+
}
100+
101+
CHIP_ERROR WindowCoveringManager::HandleMovement(WindowCoveringType type)
102+
{
103+
mState = OperationalStateGet(mEndpoint, OperationalStatus::kGlobal);
104+
105+
if (OperationalState::Stall == mState)
106+
{
107+
ChipLogProgress(NotSpecified, "Covering is currently not moving");
108+
return CHIP_NO_ERROR;
109+
}
110+
111+
// Cancel ongoing window covering movement timer if any.
112+
DeviceLayer::SystemLayer().CancelTimer(HandleMovementTimer, this);
113+
114+
// At least one of the Lift and Tilt features SHALL be supported.
115+
if (type == WindowCoveringType::Lift)
116+
{
117+
Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, mCurrentPosition);
118+
Attributes::TargetPositionLiftPercent100ths::Get(mEndpoint, mTargetPosition);
119+
}
120+
else
121+
{
122+
Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, mCurrentPosition);
123+
Attributes::TargetPositionTiltPercent100ths::Get(mEndpoint, mTargetPosition);
124+
}
125+
126+
VerifyOrReturnError(!mCurrentPosition.IsNull(), CHIP_ERROR_INCORRECT_STATE);
127+
VerifyOrReturnError(!mTargetPosition.IsNull(), CHIP_ERROR_INCORRECT_STATE);
128+
VerifyOrReturnError(mCurrentPosition != mTargetPosition, CHIP_ERROR_INCORRECT_STATE);
129+
130+
return DeviceLayer::SystemLayer().StartTimer(kIncrementMovementTimeout, HandleMovementTimer, this);
131+
}
132+
133+
CHIP_ERROR WindowCoveringManager::HandleStopMotion()
134+
{
135+
136+
DeviceLayer::SystemLayer().CancelTimer(HandleMovementTimer, this);
137+
return CHIP_NO_ERROR;
138+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
*
3+
* Copyright (c) 2022 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#pragma once
19+
20+
#include <app/clusters/window-covering-server/window-covering-server.h>
21+
22+
namespace chip {
23+
namespace app {
24+
namespace Clusters {
25+
namespace WindowCovering {
26+
27+
class WindowCoveringManager : public Delegate
28+
{
29+
public:
30+
void Init(chip::EndpointId endpoint);
31+
CHIP_ERROR HandleMovement(WindowCoveringType type) override;
32+
CHIP_ERROR HandleStopMotion() override;
33+
34+
private:
35+
OperationalState mState;
36+
NPercent100ths mCurrentPosition;
37+
NPercent100ths mTargetPosition;
38+
39+
/**
40+
* @brief
41+
* The callback function to be called when "movement timer" expires.
42+
*/
43+
static void HandleMovementTimer(chip::System::Layer * layer, void * aAppState);
44+
};
45+
46+
} // namespace WindowCovering
47+
} // namespace Clusters
48+
} // namespace app
49+
} // namespace chip

examples/all-clusters-app/linux/main-common.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "main-common.h"
2020
#include "AllClustersCommandDelegate.h"
21+
#include "WindowCoveringManager.h"
2122
#include "include/tv-callbacks.h"
2223
#include <app-common/zap-generated/att-storage.h>
2324
#include <app-common/zap-generated/attribute-type.h>
@@ -59,6 +60,7 @@ constexpr const char kChipEventFifoPathPrefix[] = "/tmp/chip_all_clusters_fifo_"
5960
LowPowerManager sLowPowerManager;
6061
NamedPipeCommands sChipNamedPipeCommands;
6162
AllClustersCommandDelegate sAllClustersCommandDelegate;
63+
chip::app::Clusters::WindowCovering::WindowCoveringManager sWindowCoveringManager;
6264

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

@@ -264,3 +266,10 @@ void emberAfLowPowerClusterInitCallback(EndpointId endpoint)
264266
ChipLogProgress(NotSpecified, "TV Linux App: LowPower::SetDefaultDelegate");
265267
chip::app::Clusters::LowPower::SetDefaultDelegate(endpoint, &sLowPowerManager);
266268
}
269+
270+
void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint)
271+
{
272+
sWindowCoveringManager.Init(endpoint);
273+
chip::app::Clusters::WindowCovering::SetDefaultDelegate(endpoint, &sWindowCoveringManager);
274+
chip::app::Clusters::WindowCovering::ConfigStatusUpdateFeatures(endpoint);
275+
}

examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ config("psoc6_ota_config") {
8181

8282
psoc6_sdk_sources("all_clusters_app_sdk_sources") {
8383
include_dirs = [
84-
"${chip_root}/src/platform/PSOC6",
84+
"${chip_root}/src/platform/Infineon/PSOC6",
8585
"${psoc6_project_dir}/include",
8686
"${examples_plat_dir}",
8787
]

examples/all-clusters-minimal-app/infineon/psoc6/include/CHIPProjectConfig.h

+2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012
5252

5353
/* The SoftwareVersion attribute of the Basic cluster. */
54+
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
5455
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1
56+
#endif
5557

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

examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ endpoint 0 {
14621462
}
14631463

14641464
server cluster LocalizationConfiguration {
1465-
callback attribute supportedLocales default = en-US;
1465+
callback attribute supportedLocales;
14661466
ram attribute featureMap;
14671467
ram attribute clusterRevision default = 1;
14681468
}

0 commit comments

Comments
 (0)