Skip to content

Commit

Permalink
[BL602] Update README.md, fix diagnosic impl (#22067)
Browse files Browse the repository at this point in the history
* [BL602] Update README.md, fix diagnosic impl

* Restyled by clang-format

* Restyled by prettier-markdown

* [BL602] delete not used code

* [BL602] Fix TC-CNET-4.4 TC-CNET-4.15

* Restyled by clang-format

* [BL602] remove not use code

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Sep 14, 2023
1 parent ac880e7 commit 3751137
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 133 deletions.
54 changes: 51 additions & 3 deletions examples/lighting-app/bouffalolab/bl602/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# BL602

This example functions as a wifi light bulb device type, with on/off
capabilities. The steps were verified on BL602 development board.
capabilities. The steps were verified on BL602-IoT-Matter-V1 board.

BL602 development board:
<img src="../../../platform/bouffalolab/bl602/doc/images/bl602_iot_3S_v2.jpg" style="zoom:25%;" />
BL602-IoT-Matter-V1 board:
<img src="../../../platform/bouffalolab/bl602/doc/images/BL602-IoT-Matter_V1.png" style="zoom:25%;" />

## Initial setup

Expand Down Expand Up @@ -85,6 +85,54 @@ picocom -b 115200 /dev/ttyACM0
2.To reset the board, press the RESET button, and you will see the log in the
`picocom terminal`.

```
Starting bl602 now....
Booting BL602 Chip...
```

3.To control the development board after successfully debugging the development
board, press the BOOT button and you should see the following output in the
terminal:

```
[ 404197][:588238200] Short press
[ 404198][:588238200] receiving event type: 0
[ 404203][:588238200] sending event type: 0
[ 404207][:588238200] receiving event type: 0
[ 404211][:588238200] Turning light ON
[ 406211][:588238200] sending event type: 1
[ 406212][:588238200] receiving event type: 1
[ 406217][:588238200] Light ON
[ 406220][:588238200] updating on/off = 1
```

4.To restore the board to factory Settings, press and hold the BOOT button for 5
seconds, and you should see the following output in the terminal:

```
[ 37268][:588238200] LongLong press
[ 37269][:588238200] receiving event type: 0
[ 37274][:588238200] FactoryReset! please release button!!!
[ 37279][:588238200] Toggling state to 1
[ 37283][:588238200] brightness: 255, mHue: 0, mSaturation: 0, red: 255, green: 255, blue: 255
[ 37292][:588238200] red level: 10000
[ 38296][:588238200] Toggling state to 0
[ 38297][:588238200] brightness: 0, mHue: 0, mSaturation: 0, red: 0, green: 0, blue: 0
[ 38305][:588238200] red level: 0
[ 39308][:588238200] Toggling state to 1
[ 39309][:588238200] brightness: 255, mHue: 0, mSaturation: 0, red: 255, green: 255, blue: 255
[ 39318][:588238200] red level: 10000
[ 42323][:588238200] [DL] Easyflash erase: f/1/n
[ 42327][:588238200] [DL] Easyflash erase: f/1/i
[ 42332][:588238200] [DL] Easyflash erase: f/1/r
[ 42335][:588238200] [DL] Easyflash erase: f/1/m
[ 42340][:588238200] [DL] Easyflash erase: f/1/o
[ 42349][:588238200] [DIS] Fabric (0x1) deleted. Calling OnFabricDeletedFromStorage
[ 42403][:588238200] [DL] Easyflash erase: f/1/k/0
[ 42462][:588238200] [DL] Easyflash erase: f/1/g
[ 42465][:588238200] [DMG] AccessControl: removing fabric 1
```

## Commission a device using chip-tool

To initiate a client commissioning request to a device, run the built executable
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
121 changes: 0 additions & 121 deletions examples/platform/bouffalolab/bl602/hal-config-app-common.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeap

CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeapUsed)
{
currentHeapUsed = _heap_size - xPortGetFreeHeapSize();
currentHeapUsed = (uint32_t) &_heap_size - xPortGetFreeHeapSize();

return CHIP_NO_ERROR;
}

CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark)
{
currentHeapHighWatermark = _heap_size - xPortGetMinimumEverFreeHeapSize();
currentHeapHighWatermark = (uint32_t) &_heap_size - xPortGetMinimumEverFreeHeapSize();

return CHIP_NO_ERROR;
}
Expand Down
14 changes: 8 additions & 6 deletions src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ constexpr char blWiFiSSIDKeyName[] = "bl-wifi-ssid";
constexpr char blWiFiCredentialsKeyName[] = "bl-wifi-pass";

static uint8_t WiFiSSIDStr[DeviceLayer::Internal::kMaxWiFiSSIDLength];
static uint8_t scan_type = 0;
} // namespace

CHIP_ERROR BLWiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback)
Expand Down Expand Up @@ -162,7 +163,6 @@ CHIP_ERROR BLWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen,
wifi_interface = wifi_mgmr_sta_enable();
wifi_mgmr_sta_connect(wifi_interface, ssid, passwd, NULL, NULL, 0, 0);

// Configure the WiFi interface.
ReturnErrorOnFailure(ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled));

return ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Enabled);
Expand Down Expand Up @@ -200,8 +200,8 @@ void BLWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback
Status networkingStatus = Status::kSuccess;
static int save = 0;

// VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound);
// VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError);
VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound);
VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError);
ChipLogProgress(NetworkProvisioning, "BL NetworkCommissioningDelegate: SSID: %.*s", static_cast<int>(networkId.size()),
networkId.data());

Expand Down Expand Up @@ -230,11 +230,13 @@ CHIP_ERROR BLWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid)
{
memset(WiFiSSIDStr, 0, sizeof(WiFiSSIDStr));
memcpy(WiFiSSIDStr, ssid.data(), ssid.size());
err = (CHIP_ERROR) wifi_mgmr_scan_adv(NULL, NULL, NULL, 0, WiFiSSIDStr);
err = (CHIP_ERROR) wifi_mgmr_scan_adv(NULL, NULL, NULL, 0, WiFiSSIDStr);
scan_type = 1;
}
else
{
err = (CHIP_ERROR) wifi_mgmr_scan(NULL, NULL);
err = (CHIP_ERROR) wifi_mgmr_scan(NULL, NULL);
scan_type = 0;
}
if (err != CHIP_NO_ERROR)
{
Expand All @@ -260,7 +262,7 @@ void BLWiFiDriver::OnScanWiFiNetworkDone()
}

wifi_mgmr_ap_item_t * ScanResult = (wifi_mgmr_ap_item_t *) pvPortMalloc(ap_num * sizeof(wifi_mgmr_ap_item_t));
wifi_mgmr_get_scan_result(ScanResult, ap_num);
wifi_mgmr_get_scan_result(ScanResult, &ap_num, scan_type, WiFiSSIDStr);

if (ScanResult)
{
Expand Down

0 comments on commit 3751137

Please sign in to comment.