Browse Source

HSA_LCD_Shield.cpp: Bug-Fix with return Button number

Tobias Müller 6 years ago
parent
commit
7865a17438
1 changed files with 6 additions and 6 deletions
  1. 6 6
      HSA_LCD_Shield.cpp

+ 6 - 6
HSA_LCD_Shield.cpp

@@ -270,7 +270,7 @@ char HSA_LCD_Shield::getButton() {
      !digitalRead(BUTTON_DOWN) &&
      !digitalRead(BUTTON_LEFT) &&
      this->__buttons)
-     return 0x01;
+     return BUTTON_UP;
   
   // return 2, if only button "Right" is pressed and configured
   if(!digitalRead(BUTTON_UP) &&
@@ -278,7 +278,7 @@ char HSA_LCD_Shield::getButton() {
      !digitalRead(BUTTON_DOWN) &&
      !digitalRead(BUTTON_LEFT) &&
      this->__buttons)
-     return 0x02;
+     return BUTTON_RIGHT;
 
   // return 3, if only button "Down" is pressed and configured
   if(!digitalRead(BUTTON_UP) &&
@@ -286,7 +286,7 @@ char HSA_LCD_Shield::getButton() {
      digitalRead(BUTTON_DOWN) &&
      !digitalRead(BUTTON_LEFT) &&
      this->__buttons)
-     return 0x03;
+     return BUTTON_DOWN;
 
   // return 4, if only button "Left" is pressed and configured
   if(!digitalRead(BUTTON_UP) &&
@@ -294,10 +294,10 @@ char HSA_LCD_Shield::getButton() {
      !digitalRead(BUTTON_DOWN) &&
      digitalRead(BUTTON_LEFT) &&
      this->__buttons)
-     return 0x04;
+     return BUTTON_LEFT;
 
-  // return 0, if no button or more than one button is pressed
-  return 0x00;
+  // return false, if no button or more than one button is pressed
+  return false;
 
 }