Skip to content

Commit fec4c8c

Browse files
Apply suggestions from online code review
Co-authored-by: David Hebbeker <david@hebbeker.info>
1 parent ae70741 commit fec4c8c

4 files changed

Lines changed: 12 additions & 14 deletions

File tree

lib/3rd_party_adapters/LVGL/GuiEngine.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* \file .
3+
* Connects LVGL callbacks to display driver and input device.
4+
*/
15
#include "GuiEngine.hpp"
26
#include "Screen.hpp"
37
#include <Adafruit_SSD1306.h>
@@ -28,12 +32,11 @@ static void flushSSD1306Adafruit(lv_disp_drv_t *disp_drv, const lv_area_t *area,
2832
color_p++;
2933
}
3034
}
31-
//this->display.display(); //this has been removed from here due to performance, as multiple flushes are triggert, when mor areas on screen are refreshed
35+
//this->display.display(); // this has been removed from here due to performance, as multiple flushes are triggered, when more areas on screen are refreshed
3236
lv_disp_flush_ready(disp_drv);
3337
}
3438

3539
static IKeypad *myKeypad = nullptr;
36-
static lv_group_t *group = nullptr;
3740

3841
/**
3942
* @brief Construct a new Gui Engine:: GuiEngine object
@@ -158,10 +161,10 @@ void GuiEngine::registerKeyPad(IKeypad *keypad)
158161
myKeypad = keypad;
159162

160163
// create default group for button navigation and assign input device to it
161-
group = lv_group_create();
164+
static lv_group_t *const group = lv_group_create();
162165
lv_group_set_default(group);
163166

164-
// Register all buttons as individual indev, so they all have their seperate "old" state (lvgl has only one "old" state per indev)
167+
// Register all buttons as individual indev, so they all have their separate "old" state (lvgl has only one "old" state per indev)
165168
static lv_indev_drv_t indev_drv_left;
166169
lv_indev_drv_init(&indev_drv_left);
167170
indev_drv_left.type = LV_INDEV_TYPE_KEYPAD;

lib/3rd_party_adapters/LVGL/Screen.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* \file .
3+
* Converts menu items to LVGL.
4+
*/
15
#pragma once
26

37
#include <lvgl.h>

lib/application_business_rules/user_interaction/Menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @brief Construct a new Menu:: Menu object
66
*
77
* @param guiEngineToUse - GuiEngine to be used for display
8-
* @param keypad - Keypad to get Menu controlls from
8+
* @param keypad - Keypad to get Menu controls from
99
*/
1010
Menu::Menu(IGuiEngine &guiEngineToUse, IKeypad &keypad)
1111
: guiEngine(guiEngineToUse)

lib/application_business_rules/user_interaction/MenuItem.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ MenuItemSubmenu::MenuItemSubmenu(std::string text, const MenuItemList *subMenuLi
1414
/**
1515
* @brief returns the text of this item
1616
*
17-
* @return std::string
1817
*/
1918
std::string MenuItemSubmenu::getText() const
2019
{
@@ -24,7 +23,6 @@ std::string MenuItemSubmenu::getText() const
2423
/**
2524
* @brief returns a constant pointer to the constant SubMenuList
2625
*
27-
* @return const MenuItemList*
2826
*/
2927
const MenuItemList *MenuItemSubmenu::getSubMenuList() const
3028
{
@@ -45,7 +43,6 @@ MenuItemSwitch::MenuItemSwitch(std::string text, bool *ptrBool)
4543
/**
4644
* @brief returns the text of this item
4745
*
48-
* @return std::string
4946
*/
5047
std::string MenuItemSwitch::getText() const
5148
{
@@ -55,7 +52,6 @@ std::string MenuItemSwitch::getText() const
5552
/**
5653
* @brief returns a pointer to the modification variable
5754
*
58-
* @return bool*
5955
*/
6056
bool *MenuItemSwitch::getPtrBool() const
6157
{
@@ -79,7 +75,6 @@ MenuItemValue::MenuItemValue(std::string text, double *ptrDouble, uint8_t decima
7975
/**
8076
* @brief returns the text of this item
8177
*
82-
* @return std::string
8378
*/
8479
std::string MenuItemValue::getText() const
8580
{
@@ -89,7 +84,6 @@ std::string MenuItemValue::getText() const
8984
/**
9085
* @brief returns a pointer to the modification variable
9186
*
92-
* @return double*
9387
*/
9488
double *MenuItemValue::getPtrDouble() const
9589
{
@@ -99,7 +93,6 @@ double *MenuItemValue::getPtrDouble() const
9993
/**
10094
* @brief returns the amount of decimal digits
10195
*
102-
* @return uint8_t
10396
*/
10497
uint8_t MenuItemValue::getDecimals() const
10598
{
@@ -109,7 +102,6 @@ uint8_t MenuItemValue::getDecimals() const
109102
/**
110103
* @brief returns the minimum value
111104
*
112-
* @return * returns
113105
*/
114106
double MenuItemValue::getMin() const
115107
{
@@ -119,7 +111,6 @@ double MenuItemValue::getMin() const
119111
/**
120112
* @brief returns the maximum value
121113
*
122-
* @return * returns
123114
*/
124115
double MenuItemValue::getMax() const
125116
{

0 commit comments

Comments
 (0)