Skip to content

Commit 6bc7968

Browse files
committed
Adjustments, explicitly set vid, pid, handle decomission
1 parent 0a2e49a commit 6bc7968

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

examples/indicator_matter/main/matter_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ extern "C" {
1010
#endif
1111

1212
#define MATTER_UPDATE_INTERVAL_IN_SECONDS 10
13+
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1
14+
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8001
1315
#define CHIP_DEVICE_CONFIG_PRODUCT_NAME "SenseCAP Indicator"
1416
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME "Seeed Studio"
1517
#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING "v1.0"

examples/indicator_matter/main/model/indicator_matter.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,6 @@ static int __temperature_value_get(void)
7272
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
7373
{
7474
switch (event->Type) {
75-
case chip::DeviceLayer::DeviceEventType::kServerReady:
76-
ESP_LOGI(TAG, "Server Ready");
77-
__g_matter_connected_flag = true;
78-
if (__g_matter_connected_flag) {
79-
struct view_data_wifi_st st;
80-
st.rssi = -50;
81-
st.is_connected = true;
82-
esp_event_post_to(view_event_handle, VIEW_EVENT_BASE, VIEW_EVENT_WIFI_ST, &st, sizeof(struct view_data_wifi_st ), portMAX_DELAY);
83-
84-
uint8_t screen = SCREEN_DASHBOARD;
85-
ESP_ERROR_CHECK(esp_event_post_to(view_event_handle, VIEW_EVENT_BASE, VIEW_EVENT_SCREEN_START, &screen, sizeof(screen), portMAX_DELAY));
86-
}
87-
break;
8875
case chip::DeviceLayer::DeviceEventType::kInterfaceIpAddressChanged:
8976
ESP_LOGI(TAG, "IP Interface Address Changed");
9077
if (event->InterfaceIpAddressChanged.Type == chip::DeviceLayer::InterfaceIpChangeType::kIpV6_Assigned ||
@@ -121,19 +108,21 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
121108
case chip::DeviceLayer::DeviceEventType::kFabricRemoved:
122109
{
123110
ESP_LOGI(TAG, "Fabric removed successfully");
124-
if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0)
111+
__g_matter_connected_flag = false;
112+
chip::CommissioningWindowManager & commissionMgr = chip::Server::GetInstance().GetCommissioningWindowManager();
113+
constexpr auto kTimeoutSeconds = chip::System::Clock::Seconds16(k_timeout_seconds);
114+
if (!commissionMgr.IsCommissioningWindowOpen())
125115
{
126-
chip::CommissioningWindowManager & commissionMgr = chip::Server::GetInstance().GetCommissioningWindowManager();
127-
constexpr auto kTimeoutSeconds = chip::System::Clock::Seconds16(k_timeout_seconds);
128-
if (!commissionMgr.IsCommissioningWindowOpen())
116+
CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindow(kTimeoutSeconds,
117+
chip::CommissioningWindowAdvertisement::kDnssdOnly);
118+
if (err != CHIP_NO_ERROR)
129119
{
130-
CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindow(kTimeoutSeconds,
131-
chip::CommissioningWindowAdvertisement::kDnssdOnly);
132-
if (err != CHIP_NO_ERROR)
133-
{
134-
ESP_LOGE(TAG, "Failed to open commissioning window, err:%" CHIP_ERROR_FORMAT, err.Format());
135-
}
120+
ESP_LOGE(TAG, "Failed to open commissioning window, err:%" CHIP_ERROR_FORMAT, err.Format());
136121
}
122+
123+
ESP_LOGI(TAG, "Beginning Matter Provisioning");
124+
uint8_t screen = SCREEN_MATTER_CONFIG;
125+
ESP_ERROR_CHECK(esp_event_post_to(view_event_handle, VIEW_EVENT_BASE, VIEW_EVENT_SCREEN_START, &screen, sizeof(screen), portMAX_DELAY));
137126
}
138127
break;
139128
}
@@ -147,6 +136,17 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
147136

148137
case chip::DeviceLayer::DeviceEventType::kFabricCommitted:
149138
ESP_LOGI(TAG, "Fabric is committed");
139+
140+
__g_matter_connected_flag = true;
141+
if (__g_matter_connected_flag) {
142+
struct view_data_wifi_st st;
143+
st.rssi = -50;
144+
st.is_connected = true;
145+
esp_event_post_to(view_event_handle, VIEW_EVENT_BASE, VIEW_EVENT_WIFI_ST, &st, sizeof(struct view_data_wifi_st ), portMAX_DELAY);
146+
147+
uint8_t screen = SCREEN_DASHBOARD;
148+
ESP_ERROR_CHECK(esp_event_post_to(view_event_handle, VIEW_EVENT_BASE, VIEW_EVENT_SCREEN_START, &screen, sizeof(screen), portMAX_DELAY));
149+
}
150150
break;
151151
default:
152152
break;

examples/indicator_matter/sdkconfig.defaults

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ CONFIG_ESP_MATTER_MEM_ALLOC_MODE_EXTERNAL=y
142142
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
143143
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1
144144
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y
145-
CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16
146145
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y
147-
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=n
148146
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=256
149147
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
150148
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y

0 commit comments

Comments
 (0)