-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Silabs] Closure State LCD implementation #41521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mergify
merged 19 commits into
project-chip:master
from
sabollim-silabs:feature/closure-lcd-interface
Nov 7, 2025
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7525ab5
closure LCD UI
sabollim-silabs 0faa9b9
Add attribute reporting updates
sabollim-silabs a36b0fb
PR comments
sabollim-silabs 1d86a19
PR comments
sabollim-silabs fa9b860
Restyled by whitespace
restyled-commits 9d933e2
Restyled by clang-format
restyled-commits 70e20a9
PR Comments
sabollim-silabs c0116d0
Addressing PR comments and reducing code bloats
sabollim-silabs 36b56a7
remove non platfrom changes
sabollim-silabs 7526e0d
Merge branch 'master' into feature/closure-lcd-interface
sabollim-silabs e0a43a0
Restyled by whitespace
restyled-commits e695f23
Restyled by clang-format
restyled-commits 1c39529
PR comments
sabollim-silabs 6ed893d
Merge branch 'master' into feature/closure-lcd-interface
sabollim-silabs d83f0e5
Merge branch 'master' into feature/closure-lcd-interface
sabollim-silabs 6527a9b
PR comments
sabollim-silabs 280789d
PR comments
sabollim-silabs 4680598
Restyled by clang-format
restyled-commits 701c807
PR comments
sabollim-silabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * | ||
| * Copyright (c) 2025 Project CHIP Authors | ||
| * All rights reserved. | ||
| * | ||
| * 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 "ClosureUIStrings.h" | ||
| #include "glib.h" | ||
| #include "lcd.h" | ||
| #include <app-common/zap-generated/cluster-objects.h> | ||
| #include <app/clusters/closure-control-server/closure-control-cluster-objects.h> | ||
| #include <app/data-model/Nullable.h> | ||
|
|
||
| /** | ||
| * @brief Structure to hold closure data needed for UI display | ||
| */ | ||
| struct ClosureUIData | ||
| { | ||
| chip::app::Clusters::ClosureControl::MainStateEnum mainState; | ||
| chip::app::DataModel::Nullable<chip::app::Clusters::ClosureControl::GenericOverallCurrentState> overallCurrentState; | ||
| }; | ||
|
|
||
| struct ClosureUITextInitializer; | ||
|
|
||
| class ClosureUI | ||
| { | ||
| public: | ||
| static void DrawUI(GLIB_Context_t * glibContext); | ||
| static void SetMainState(chip::app::Clusters::ClosureControl::MainStateEnum state); | ||
|
|
||
| static void FormatAndSetPosition(const char * suffix); | ||
| static void FormatAndSetLatch(const char * suffix); | ||
| static void FormatAndSetSecure(const char * suffix); | ||
| static void FormatAndSetSpeed(const char * suffix); | ||
|
|
||
| private: | ||
| friend struct ClosureUITextInitializer; | ||
| static void DrawHeader(GLIB_Context_t * glibContext); | ||
| static void DrawFooter(GLIB_Context_t * glibContext); | ||
| static void DrawMainState(GLIB_Context_t * glibContext); | ||
| static void DrawOverallCurrentState(GLIB_Context_t * glibContext); | ||
|
|
||
| // Static variables to store the current closure state | ||
| static chip::app::Clusters::ClosureControl::MainStateEnum sMainState; | ||
| static char sPositionText[ClosureUIStrings::LCD_STRING_BUFFER_SIZE]; | ||
| static char sLatchText[ClosureUIStrings::LCD_STRING_BUFFER_SIZE]; | ||
| static char sSecureText[ClosureUIStrings::LCD_STRING_BUFFER_SIZE]; | ||
| static char sSpeedText[ClosureUIStrings::LCD_STRING_BUFFER_SIZE]; | ||
| static char sStateText[ClosureUIStrings::LCD_STRING_BUFFER_SIZE]; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| * | ||
| * Copyright (c) 2025 Project CHIP Authors | ||
| * All rights reserved. | ||
| * | ||
| * 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 <cstddef> | ||
|
|
||
| /** | ||
| * @file ClosureUIStrings.h | ||
| * @brief UI string constants | ||
|
|
||
| * @note IMPORTANT FOR DEVELOPERS: | ||
| * If you modify existing strings or add new strings in this file, you MUST ensure | ||
| * that all prefix + suffix combinations fit within LCD_CH_LINE_LEN (16 characters), | ||
| * as the LCD display can only show 16 characters per line. All text buffers are | ||
| * sized to LCD_STRING_BUFFER_SIZE (17 bytes: 16 characters + null terminator). | ||
| */ | ||
|
|
||
| namespace ClosureUIStrings { | ||
|
|
||
| // Shared suffix for unknown state | ||
| inline constexpr const char SUFFIX_UNKNOWN[] = "Unknown"; | ||
|
|
||
| inline constexpr const char POSITION_PREFIX[] = "Pos: "; | ||
| inline constexpr const char POSITION_SUFFIX_CLOSED[] = "Closed"; | ||
| inline constexpr const char POSITION_SUFFIX_OPEN[] = "Open"; | ||
| inline constexpr const char POSITION_SUFFIX_PARTIAL[] = "Partial"; | ||
| inline constexpr const char POSITION_SUFFIX_PEDESTRIAN[] = "Pedest"; | ||
| inline constexpr const char POSITION_SUFFIX_VENTILATION[] = "Ventil"; | ||
| inline constexpr const char POSITION_SUFFIX_SIGNATURE[] = "Sign"; | ||
|
|
||
| inline constexpr const char LATCH_PREFIX[] = "Latch: "; | ||
| inline constexpr const char LATCH_SUFFIX_ENGAGED[] = "Yes"; | ||
| inline constexpr const char LATCH_SUFFIX_RELEASED[] = "No"; | ||
|
|
||
| inline constexpr const char SECURE_PREFIX[] = "Secure: "; | ||
| inline constexpr const char SECURE_SUFFIX_YES[] = "Yes"; | ||
| inline constexpr const char SECURE_SUFFIX_NO[] = "No"; | ||
|
|
||
| inline constexpr const char SPEED_PREFIX[] = "Speed: "; | ||
| inline constexpr const char SPEED_SUFFIX_LOW[] = "Low"; | ||
| inline constexpr const char SPEED_SUFFIX_MEDIUM[] = "Med"; | ||
| inline constexpr const char SPEED_SUFFIX_HIGH[] = "High"; | ||
| inline constexpr const char SPEED_SUFFIX_AUTO[] = "Auto"; | ||
|
|
||
| inline constexpr const char STATE_PREFIX[] = "State: "; | ||
| inline constexpr const char STATE_SUFFIX_STOPPED[] = "Stopped"; | ||
| inline constexpr const char STATE_SUFFIX_MOVING[] = "Moving"; | ||
| inline constexpr const char STATE_SUFFIX_WAITING[] = "Waiting"; | ||
| inline constexpr const char STATE_SUFFIX_ERROR[] = "Error"; | ||
| inline constexpr const char STATE_SUFFIX_CALIBRATING[] = "Calib"; | ||
| inline constexpr const char STATE_SUFFIX_PROTECTED[] = "Protect"; | ||
| inline constexpr const char STATE_SUFFIX_DISENGAGED[] = "Diseng"; | ||
| inline constexpr const char STATE_SUFFIX_SETUP_REQUIRED[] = "SetupReq"; | ||
|
|
||
| inline constexpr const char FOOTER_TEXT[] = "Closure App"; | ||
|
|
||
| // LCD display line maximum length | ||
| inline constexpr size_t LCD_CH_LINE_LEN = 16; | ||
|
|
||
| // LCD string buffer size (lcd line length + null terminator) | ||
| inline constexpr size_t LCD_STRING_BUFFER_SIZE = LCD_CH_LINE_LEN + 1; | ||
| } // namespace ClosureUIStrings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.