Skip to content

Commit

Permalink
delete: 冗長コードの削除
Browse files Browse the repository at this point in the history
  • Loading branch information
keiya121 committed Jun 4, 2024
1 parent 543b285 commit d6680b7
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions test/dummy/ev3api_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,18 @@

#include "ev3api_button.h"
#include "../DummyRobot.h"
#include <iostream>

bool ev3_button_is_pressed(button_t button)
{
DummyRobot::ButtonState currentButtonState = DummyRobot::getButtonState();

// std::cout << "Current ButtonState: ";
// switch (currentButtonState) {
// case DummyRobot::ButtonState::left:
// std::cout << "Left" << std::endl;
// break;
// case DummyRobot::ButtonState::enter:
// std::cout << "Enter" << std::endl;
// break;
// case DummyRobot::ButtonState::right:
// std::cout << "Right" << std::endl;
// break;
// case DummyRobot::ButtonState::none:
// std::cout << "None" << std::endl;
// break;
// }

// 左ボタンが押された時(num=0)
// 左ボタンが押された時
if(button == LEFT_BUTTON && currentButtonState == DummyRobot::ButtonState::left) return true;

// 右ボタンが押された時(num=1)
// 右ボタンが押された時
if(button == RIGHT_BUTTON && currentButtonState == DummyRobot::ButtonState::right) return true;

// 中央ボタンが押された時(num=2)
// 中央ボタンが押された時
if(button == ENTER_BUTTON && currentButtonState == DummyRobot::ButtonState::enter) return true;

if(button != LEFT_BUTTON && button != RIGHT_BUTTON && button != ENTER_BUTTON) {
Expand Down

0 comments on commit d6680b7

Please sign in to comment.