Skip to content

Commit 8f07711

Browse files
committed
Fix Error screen and optimize GetTouchInfo
1 parent f221f5d commit 8f07711

4 files changed

Lines changed: 8 additions & 15 deletions

File tree

src/displayapp/screens/Error.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,3 @@ void Error::ButtonEventHandler() {
4848
Error::~Error() {
4949
lv_obj_clean(lv_scr_act());
5050
}
51-
52-
bool Error::Refresh() {
53-
return running;
54-
}

src/displayapp/screens/Error.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ namespace Pinetime {
1212
Error(DisplayApp* app, System::BootErrors error);
1313
~Error() override;
1414

15-
bool Refresh() override;
1615
void ButtonEventHandler();
1716
private:
1817
lv_obj_t* btnOk;

src/drivers/Cst816s.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ bool Cst816S::Init() {
7171

7272
Cst816S::TouchInfos Cst816S::GetTouchInfo() {
7373
Cst816S::TouchInfos info;
74+
uint8_t touchData[7];
7475

7576
auto ret = twiMaster.Read(twiAddress, 0, touchData, sizeof(touchData));
7677
if (ret != TwiMaster::ErrorCodes::NoError) {
@@ -79,18 +80,16 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
7980
}
8081

8182
// This can only be 0 or 1
82-
auto nbTouchPoints = touchData[touchPointNumIndex] & 0x0f;
83+
uint8_t nbTouchPoints = touchData[touchPointNumIndex] & 0x0f;
8384

84-
auto xHigh = touchData[touchXHighIndex] & 0x0f;
85-
auto xLow = touchData[touchXLowIndex];
86-
uint16_t x = (xHigh << 8) | xLow;
85+
uint8_t xHigh = touchData[touchXHighIndex] & 0x0f;
86+
uint8_t xLow = touchData[touchXLowIndex];
87+
info.x = (xHigh << 8) | xLow;
8788

88-
auto yHigh = touchData[touchYHighIndex] & 0x0f;
89-
auto yLow = touchData[touchYLowIndex];
90-
uint16_t y = (yHigh << 8) | yLow;
89+
uint8_t yHigh = touchData[touchYHighIndex] & 0x0f;
90+
uint8_t yLow = touchData[touchYLowIndex];
91+
info.y = (yHigh << 8) | yLow;
9192

92-
info.x = x;
93-
info.y = y;
9493
info.touching = (nbTouchPoints > 0);
9594
info.gesture = static_cast<Gestures>(touchData[gestureIndex]);
9695

src/drivers/Cst816s.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ namespace Pinetime {
5858
//static constexpr uint8_t touchXYIndex = 7;
5959
//static constexpr uint8_t touchMiscIndex = 8;
6060

61-
uint8_t touchData[7];
6261
TwiMaster& twiMaster;
6362
uint8_t twiAddress;
6463

0 commit comments

Comments
 (0)