fine-tune hysteresis parameter

This commit is contained in:
Thomas Lindner 2022-12-30 15:33:12 +01:00
parent 65816bfd74
commit 95bec44719

View file

@ -3,7 +3,7 @@ import RPi.GPIO as gpio
class BoardReader: class BoardReader:
hysteresis = 16 hysteresis = 8
default_gpio_mode = gpio.BCM default_gpio_mode = gpio.BCM
default_row_gpios = [4, 5, 6, 12, 13, 16, 17, 19] default_row_gpios = [4, 5, 6, 12, 13, 16, 17, 19]
default_column_gpios = [20, 21, 22, 23, 24, 25, 26, 27] default_column_gpios = [20, 21, 22, 23, 24, 25, 26, 27]
@ -72,8 +72,8 @@ class BoardReader:
if not self._is_initial_board(board): if not self._is_initial_board(board):
break break
else: else:
self.move_generator.reset()
self.print() self.print()
self.move_generator.reset()
return return
for i in range(8): for i in range(8):
@ -88,8 +88,8 @@ class BoardReader:
if board[i][j] == "x": if board[i][j] == "x":
break break
else: else:
self.move_generator.take(i, j)
self.print() self.print()
self.move_generator.take(i, j)
for i in range(8): for i in range(8):
for j in range(8): for j in range(8):
# if the oldest half of the board history doesn't have a piece but all # if the oldest half of the board history doesn't have a piece but all
@ -102,8 +102,8 @@ class BoardReader:
if board[i][j] == " ": if board[i][j] == " ":
break break
else: else:
self.move_generator.put(i, j)
self.print() self.print()
self.move_generator.put(i, j)
def _print(self, board) -> None: def _print(self, board) -> None:
print(" a b c d e f g h") print(" a b c d e f g h")