Skip to content

Commit

Permalink
Restyle C(++) code after upgrade to clang-format 16 (#29496)
Browse files Browse the repository at this point in the history
This is a follow-up to #29447 and should really have been done as part of that PR.
  • Loading branch information
ksperling-apple authored and pull[bot] committed Dec 18, 2023
1 parent de722df commit 1434208
Show file tree
Hide file tree
Showing 331 changed files with 1,821 additions and 1,785 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class AirQualitySensorManager
{
public:
// Delete copy constructor and assignment operator.
AirQualitySensorManager(const AirQualitySensorManager &) = delete;
AirQualitySensorManager(const AirQualitySensorManager &&) = delete;
AirQualitySensorManager(const AirQualitySensorManager &) = delete;
AirQualitySensorManager(const AirQualitySensorManager &&) = delete;
AirQualitySensorManager & operator=(const AirQualitySensorManager &) = delete;

static void InitInstance(EndpointId aEndpointId = 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class DishwasherModeDelegate : public ModeBase::Delegate
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
ModeTagStructType modeTagsNormal[1] = { { .value = to_underlying(ModeTag::kNormal) } };
ModeTagStructType modeTagsHeavy[2] = { { .value = to_underlying(ModeBase::ModeTag::kMax) },
{ .value = to_underlying(ModeTag::kHeavy) } };
{ .value = to_underlying(ModeTag::kHeavy) } };
ModeTagStructType modeTagsLight[3] = { { .value = to_underlying(ModeTag::kLight) },
{ .value = to_underlying(ModeBase::ModeTag::kNight) },
{ .value = to_underlying(ModeBase::ModeTag::kQuiet) } };
{ .value = to_underlying(ModeBase::ModeTag::kNight) },
{ .value = to_underlying(ModeBase::ModeTag::kQuiet) } };

const detail::Structs::ModeOptionStruct::Type kModeOptions[3] = {
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Normal"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LaundryWasherModeDelegate : public ModeBase::Delegate
{ .value = to_underlying(ModeBase::ModeTag::kNight) },
{ .value = to_underlying(ModeBase::ModeTag::kQuiet) } };
ModeTagStructType modeTagsHeavy[2] = { { .value = to_underlying(ModeBase::ModeTag::kMax) },
{ .value = to_underlying(ModeTag::kHeavy) } };
{ .value = to_underlying(ModeTag::kHeavy) } };
ModeTagStructType modeTagsWhites[1] = { { .value = to_underlying(ModeTag::kWhites) } };

const detail::Structs::ModeOptionStruct::Type kModeOptions[4] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class CHIPDeviceManagerCallbacks
class DLL_EXPORT CHIPDeviceManager
{
public:
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager & operator=(const CHIPDeviceManager &) = delete;

static CHIPDeviceManager & GetInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE ((size_t)(60 * 1024))
#define configTOTAL_HEAP_SIZE ((size_t) (60 * 1024))
#define configAPPLICATION_ALLOCATED_HEAP 0

/* Hook function related definitions. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ extern uint32_t SystemCoreClock;
// <o>Minimal stack size [words] <0-65535>
// <i> Stack for idle task and default task stack in words.
// <i> Default: 4kB
#define configMINIMAL_STACK_SIZE ((uint16_t)(4 * 1024))
#define configMINIMAL_STACK_SIZE ((uint16_t) (4 * 1024))

// <o>Total heap size [bytes] <0-0xFFFFFFFF>
// <i> Heap memory size in bytes.
// <i> Default: 32kB
#define configTOTAL_HEAP_SIZE ((size_t)(32 * 1024))
#define configTOTAL_HEAP_SIZE ((size_t) (32 * 1024))

// <o>Kernel tick frequency [Hz] <0-0xFFFFFFFF>
// <i> Kernel tick rate in Hz.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class CHIPDeviceManagerCallbacks
class DLL_EXPORT CHIPDeviceManager
{
public:
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager & operator=(const CHIPDeviceManager &) = delete;

static CHIPDeviceManager & GetInstance()
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/ameba/main/include/CHIPDeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class CHIPDeviceManagerCallbacks
class DLL_EXPORT CHIPDeviceManager
{
public:
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager & operator=(const CHIPDeviceManager &) = delete;

static CHIPDeviceManager & GetInstance()
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool Command::InitArguments(int argc, char ** argv)
}
}

VerifyOrExit((size_t)(argc) >= mandatoryArgsCount && (argvExtraArgsCount == 0 || (argvExtraArgsCount && optionalArgsCount)),
VerifyOrExit((size_t) (argc) >= mandatoryArgsCount && (argvExtraArgsCount == 0 || (argvExtraArgsCount && optionalArgsCount)),
ChipLogError(chipTool, "InitArgs: Wrong arguments number: %d instead of %u", argc,
static_cast<unsigned int>(mandatoryArgsCount)));

Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/pairing/PairingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ CHIP_ERROR PairingCommand::PairWithMdnsOrBleByIndexWithCode(NodeId remoteId, uin
{
auto commissioningParams = GetCommissioningParameters();
err = CurrentCommissioner().PairDevice(remoteId, mOnboardingPayload, commissioningParams,
DiscoveryType::kDiscoveryNetworkOnly, MakeOptional(resolutionData));
DiscoveryType::kDiscoveryNetworkOnly, MakeOptional(resolutionData));
}
return err;
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/chip-tool/commands/pairing/PairingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class PairingCommand : public CHIPCommand,
CredentialIssuerCommands * credIssuerCmds,
chip::Dnssd::DiscoveryFilterType filterType = chip::Dnssd::DiscoveryFilterType::kNone) :
CHIPCommand(commandName, credIssuerCmds),
mPairingMode(mode), mNetworkType(networkType),
mFilterType(filterType), mRemoteAddr{ IPAddress::Any, chip::Inet::InterfaceId::Null() }, mComplex_TimeZones(&mTimeZoneList),
mPairingMode(mode), mNetworkType(networkType), mFilterType(filterType),
mRemoteAddr{ IPAddress::Any, chip::Inet::InterfaceId::Null() }, mComplex_TimeZones(&mTimeZoneList),
mComplex_DSTOffsets(&mDSTOffsetList), mCurrentFabricRemoveCallback(OnCurrentFabricRemove, this)
{
AddArgument("node-id", 0, UINT64_MAX, &mNodeId);
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2

// Uncomment this for a large Tunnel MTU.
//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000)
// #define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000)

// Enable support functions for parsing command-line arguments
#define CHIP_CONFIG_ENABLE_ARG_PARSER 1
Expand Down
2 changes: 1 addition & 1 deletion examples/common/imgui_ui/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void UiInit(SDL_GLContext * gl_context, SDL_Window ** window)
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_WindowFlags window_flags = (SDL_WindowFlags) (SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
*window = SDL_CreateWindow("Light UI", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
*gl_context = SDL_GL_CreateContext(*window);
SDL_GL_MakeCurrent(*window, *gl_context);
Expand Down
9 changes: 4 additions & 5 deletions examples/common/imgui_ui/windows/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ void Light::Render()
ImGui::Text("Color Control:");
ImGui::Indent();
const char * mode = // based on ColorMode attribute: spec 3.2.7.9
(mColorMode == EMBER_ZCL_COLOR_MODE_CURRENT_HUE_AND_CURRENT_SATURATION)
? "Hue/Saturation"
: (mColorMode == EMBER_ZCL_COLOR_MODE_CURRENT_X_AND_CURRENT_Y)
? "X/Y"
: (mColorMode == EMBER_ZCL_COLOR_MODE_COLOR_TEMPERATURE) ? "Temperature/Mireds" : "UNKNOWN";
(mColorMode == EMBER_ZCL_COLOR_MODE_CURRENT_HUE_AND_CURRENT_SATURATION) ? "Hue/Saturation"
: (mColorMode == EMBER_ZCL_COLOR_MODE_CURRENT_X_AND_CURRENT_Y) ? "X/Y"
: (mColorMode == EMBER_ZCL_COLOR_MODE_COLOR_TEMPERATURE) ? "Temperature/Mireds"
: "UNKNOWN";

ImGui::Text("Mode: %s", mode);

Expand Down
4 changes: 2 additions & 2 deletions examples/common/screen-framework/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ esp_err_t InitDisplay()
TFT_setRotation(LANDSCAPE);
TFT_resetclipwin();

DisplayWidth = (uint16_t)(1 + tft_dispWin.x2 - tft_dispWin.x1);
DisplayHeight = (uint16_t)(1 + tft_dispWin.y2 - tft_dispWin.y1);
DisplayWidth = (uint16_t) (1 + tft_dispWin.x2 - tft_dispWin.x1);
DisplayHeight = (uint16_t) (1 + tft_dispWin.y2 - tft_dispWin.y1);

ESP_LOGI(TAG, "Display initialized (height %u, width %u)", DisplayHeight, DisplayWidth);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE ((size_t)(gTotalHeapSize_c))
#define configTOTAL_HEAP_SIZE ((size_t) (gTotalHeapSize_c))
#define configAPPLICATION_ALLOCATED_HEAP 1

/* Hook function related definitions. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#if DEBUG
#define MTR_LOG_DEBUG(format, ...) os_log(OS_LOG_DEFAULT, format, ##__VA_ARGS__)
#define MTR_LOG_ERROR(format, ...) os_log(OS_LOG_DEFAULT, format, ##__VA_ARGS__)
#define MTR_LOG_METHOD_ENTRY() \
#define MTR_LOG_METHOD_ENTRY() \
({ os_log(OS_LOG_DEFAULT, "[<%@: %p> %@]", NSStringFromClass([self class]), self, NSStringFromSelector(_cmd)); })

#else
Expand Down
23 changes: 15 additions & 8 deletions examples/darwin-framework-tool/commands/tests/TestCommandBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class TestCommandBridge : public CHIPCommandBridge,
CHIP_ERROR WaitForMs(
const char * _Nullable identity, const chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type & value)
{
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(value.ms * NSEC_PER_MSEC));
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t) (value.ms * NSEC_PER_MSEC));
dispatch_after(delayTime, mCallbackQueue, ^(void) {
NextTest();
});
Expand Down Expand Up @@ -310,7 +310,8 @@ class TestCommandBridge : public CHIPCommandBridge,
return ConstraintsChecker::CheckConstraintIsHexString(itemName, value, expectHexString);
}

template <typename T> bool CheckConstraintContains(const char * _Nonnull itemName, const NSArray * _Nonnull current, T expected)
template <typename T>
bool CheckConstraintContains(const char * _Nonnull itemName, const NSArray * _Nonnull current, T expected)
{
for (id currentElement in current) {
if ([currentElement isEqualToNumber:@(expected)]) {
Expand All @@ -322,7 +323,8 @@ class TestCommandBridge : public CHIPCommandBridge,
return false;
}

template <typename T> bool CheckConstraintExcludes(const char * _Nonnull itemName, const NSArray * _Nonnull current, T expected)
template <typename T>
bool CheckConstraintExcludes(const char * _Nonnull itemName, const NSArray * _Nonnull current, T expected)
{
for (id currentElement in current) {
if ([currentElement isEqualToNumber:@(expected)]) {
Expand Down Expand Up @@ -388,7 +390,8 @@ class TestCommandBridge : public CHIPCommandBridge,
return CheckConstraintNotValue(itemName, current, @(expected));
}

template <typename T> bool CheckConstraintNotValue(const char * _Nonnull itemName, NSError * _Nullable current, T expected)
template <typename T>
bool CheckConstraintNotValue(const char * _Nonnull itemName, NSError * _Nullable current, T expected)
{
NSNumber * currentValue = @(MTRErrorToCHIPErrorCode(current).AsInteger());
return CheckConstraintNotValue(itemName, currentValue, @(expected));
Expand Down Expand Up @@ -540,25 +543,29 @@ class TestCommandBridge : public CHIPCommandBridge,
return CheckValue(itemName, currentValue, expected);
}

template <typename T> bool CheckValue(const char * _Nonnull itemName, NSNumber * _Nonnull current, T expected)
template <typename T>
bool CheckValue(const char * _Nonnull itemName, NSNumber * _Nonnull current, T expected)
{
return CheckValue(itemName, current, @(expected));
}

template <typename T> bool CheckValue(const char * _Nonnull itemName, id _Nonnull current, T expected)
template <typename T>
bool CheckValue(const char * _Nonnull itemName, id _Nonnull current, T expected)
{
NSNumber * currentValue = current;
return CheckValue(itemName, currentValue, @(expected));
}

template <typename T> bool CheckValue(const char * _Nonnull itemName, NSError * _Nullable current, T expected)
template <typename T>
bool CheckValue(const char * _Nonnull itemName, NSError * _Nullable current, T expected)
{

NSNumber * currentValue = @(current.code);
return CheckValue(itemName, currentValue, @(expected));
}

template <typename T, typename U> bool CheckValue(const char * _Nonnull itemName, T current, U expected)
template <typename T, typename U>
bool CheckValue(const char * _Nonnull itemName, T current, U expected)
{

return ValueChecker::CheckValue(itemName, current, expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class CHIPDeviceManagerCallbacks
class DLL_EXPORT CHIPDeviceManager
{
public:
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager & operator=(const CHIPDeviceManager &) = delete;

static CHIPDeviceManager & GetInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void LightSwitch::DimmerChangeBrightness(uint16_t kValue)
// add to brightness vluse to change brightness after call dimmer change.
sBrightness = kValue;
data->Value =
(uint8_t)(sBrightness > CHIP_DEVICE_CONFIG_BRIGHTNESS_MAXIMUM ? CHIP_DEVICE_CONFIG_BRIGHTNESS_MAXIMUM : sBrightness);
(uint8_t) (sBrightness > CHIP_DEVICE_CONFIG_BRIGHTNESS_MAXIMUM ? CHIP_DEVICE_CONFIG_BRIGHTNESS_MAXIMUM : sBrightness);
data->IsGroup = BindingHandler::GetInstance().IsGroupBound();
DeviceLayer::PlatformMgr().ScheduleWork(BindingHandler::SwitchWorkerHandler, reinterpret_cast<intptr_t>(data));
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/ameba/main/include/CHIPDeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class CHIPDeviceManagerCallbacks
class DLL_EXPORT CHIPDeviceManager
{
public:
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager(const CHIPDeviceManager &) = delete;
CHIPDeviceManager(const CHIPDeviceManager &&) = delete;
CHIPDeviceManager & operator=(const CHIPDeviceManager &) = delete;

static CHIPDeviceManager & GetInstance()
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/genio/src/ColorFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ RgbColor_t XYToRgb(uint8_t Level, uint16_t currentX, uint16_t currentY)
b = clamp(b, 0, 1);

// these rgb values are in the range of 0 to 1, convert to limit of HW specific LED
rgb.r = (uint8_t)(r * 255);
rgb.g = (uint8_t)(g * 255);
rgb.b = (uint8_t)(b * 255);
rgb.r = (uint8_t) (r * 255);
rgb.g = (uint8_t) (g * 255);
rgb.b = (uint8_t) (b * 255);

return rgb;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/genio/src/DimmableLEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ static hal_pwm_channel_t convert_gpio_to_pwm_channel(hal_gpio_pin_t gpio)
hal_pwm_channel_t ret = HAL_PWM_MAX;
if (gpio >= HAL_GPIO_29 && gpio <= HAL_GPIO_40)
{
ret = (hal_pwm_channel_t)(gpio - HAL_GPIO_29);
ret = (hal_pwm_channel_t) (gpio - HAL_GPIO_29);
}
else if (gpio >= HAL_GPIO_45 && gpio <= HAL_GPIO_52)
{
ret = (hal_pwm_channel_t)(gpio - HAL_GPIO_45);
ret = (hal_pwm_channel_t) (gpio - HAL_GPIO_45);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/genio/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
*/
if (attributeId == ColorControl::Attributes::EnhancedCurrentHue::Id)
{
hsv.h = (uint8_t)(((*reinterpret_cast<uint16_t *>(value)) & 0xFF00) >> 8);
hsv.s = (uint8_t)((*reinterpret_cast<uint16_t *>(value)) & 0xFF);
hsv.h = (uint8_t) (((*reinterpret_cast<uint16_t *>(value)) & 0xFF00) >> 8);
hsv.s = (uint8_t) ((*reinterpret_cast<uint16_t *>(value)) & 0xFF);
}
else if (attributeId == ColorControl::Attributes::CurrentHue::Id)
{
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/lighting-common/src/ColorFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ RgbColor_t XYToRgb(uint8_t Level, uint16_t currentX, uint16_t currentY)
b = clamp(b, 0, 1);

// these rgb values are in the range of 0 to 1, convert to limit of HW specific LED
rgb.r = (uint8_t)(r * 255);
rgb.g = (uint8_t)(g * 255);
rgb.b = (uint8_t)(b * 255);
rgb.r = (uint8_t) (r * 255);
rgb.g = (uint8_t) (g * 255);
rgb.b = (uint8_t) (b * 255);

return rgb;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE ((size_t)(gTotalHeapSize_c))
#define configTOTAL_HEAP_SIZE ((size_t) (gTotalHeapSize_c))
#define configAPPLICATION_ALLOCATED_HEAP 1

/* Hook function related definitions. */
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/qpg/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
if (attributeId == ColorControl::Attributes::EnhancedCurrentHue::Id)
{
// We only support 8-bit hue. Assuming hue is linear, normalize 16-bit to 8-bit.
hsv.h = (uint8_t)((*reinterpret_cast<uint16_t *>(value)) >> 8);
hsv.h = (uint8_t) ((*reinterpret_cast<uint16_t *>(value)) >> 8);
// get saturation from cluster value storage
EmberAfStatus status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s);
assert(status == EMBER_ZCL_STATUS_SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ standard names. */

/* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
//#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 /* required only for Keil but does not hurt otherwise */
// #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 /* required only for Keil but does not hurt otherwise */
#define configGENERATE_RUN_TIME_STATS 1

#if (configGENERATE_RUN_TIME_STATS == 1)
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void AppTask::UpdateClusterState(void)
bool isTurnedOn =
sAppTask.mPwmRgbRedLed.IsTurnedOn() || sAppTask.mPwmRgbGreenLed.IsTurnedOn() || sAppTask.mPwmRgbBlueLed.IsTurnedOn();
#else
bool isTurnedOn = sAppTask.mPwmRgbBlueLed.IsTurnedOn();
bool isTurnedOn = sAppTask.mPwmRgbBlueLed.IsTurnedOn();
#endif
// write the new on/off value
EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn);
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/telink/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
{
if (attributeId == ColorControl::Attributes::EnhancedCurrentHue::Id)
{
hsv.h = (uint8_t)(((*reinterpret_cast<uint16_t *>(value)) & 0xFF00) >> 8);
hsv.s = (uint8_t)((*reinterpret_cast<uint16_t *>(value)) & 0xFF);
hsv.h = (uint8_t) (((*reinterpret_cast<uint16_t *>(value)) & 0xFF00) >> 8);
hsv.s = (uint8_t) ((*reinterpret_cast<uint16_t *>(value)) & 0xFF);
}
else if (attributeId == ColorControl::Attributes::CurrentHue::Id)
{
Expand Down
Loading

0 comments on commit 1434208

Please sign in to comment.