Skip to content

Commit

Permalink
Fix for strange LED move lighting in case of reverse side playing
Browse files Browse the repository at this point in the history
  • Loading branch information
tosca07 authored Sep 11, 2024
1 parent ad5f024 commit d4ca4b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions dgt/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,18 +562,17 @@ def _process_fen(self, fen, raw):
) # try a standard board and check for any starting pos
if bit_board.chess960_pos(ignore_castling=True):
logger.debug("flipping the board - W infront")
self.dgtmenu.set_position_reverse_flipboard(False)
self.dgtmenu.set_position_reverse_flipboard(False, self.play_mode)
bit_board = chess.Board(
fen[::-1] + " w - - 0 1"
) # try a revered board and check for any starting pos
if bit_board.chess960_pos(ignore_castling=True):
logger.debug("flipping the board - B infront")
self.dgtmenu.set_position_reverse_flipboard(True)
print("reverse_flipboard!")
self.dgtmenu.set_position_reverse_flipboard(True, self.play_mode)


if self.dgtmenu.get_flip_board() and raw: # Flip the board if needed
fen = fen[::-1]
print("inverted fen!")

logger.debug("DGT-Fen [%s]", fen)
if fen == self.dgtmenu.get_dgt_fen():
Expand Down
5 changes: 3 additions & 2 deletions dgt/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
Power,
PowerLoop,
GameResult,
PlayMode,
)

from dgt.api import Dgt, Event
Expand Down Expand Up @@ -938,12 +939,12 @@ def get_time_node(self):
"""Get the flag."""
return self.res_time_node

def set_position_reverse_flipboard(self, flip_board):
def set_position_reverse_flipboard(self, flip_board, play_mode):
"""Set the flag."""
if self.menu_system_eboard_type != dgt.util.EBoard.DGT:
ModeInfo.set_flipped_board(flip_board)
else:
if not flip_board:
if (not self.flip_board) and (play_mode == PlayMode.USER_BLACK):
ModeInfo.set_flipped_board(flip_board)
self.res_position_reverse = self.flip_board = flip_board

Expand Down

0 comments on commit d4ca4b0

Please sign in to comment.