Skip to content

v1.1.2-rp2040 — bot survives Stockfish timeout

Pre-release
Pre-release

Choose a tag to compare

@semichcsc-byte semichcsc-byte released this 11 May 17:34
· 7 commits to main since this release

Patch release

Fixes a bug where the bot would silently freeze if Stockfish ever timed out, returned malformed JSON, or had a transient TLS failure. Symptom: you step away from a game, come back, and the board appears dead -- no LEDs, no response. Only escape was the reset gesture (which then required full board re-setup).

What was broken

When makeStockfishRequest returned an empty response (network blip, stockfish.online slow, transient TLS failure) or parseStockfishResponse / parseMove failed, botThinking was correctly cleared but isWhiteTurn stayed false. The next loop iteration of chess_bot::update() saw isWhiteTurn == false && botThinking == false and just sat idle, frozen, without telling the user.

Fix

All three failure paths in makeBotMove now reset isWhiteTurn = true so the user can retry the move. Added a brief red flash on rank 8 in the API-no-response case so the user has visual feedback that the bot couldn't respond rather than wondering whether they missed something.

Verified

Tested by killing my home router mid-move; board flashed red on rank 8 and gave the turn back so the move could be retried after the network recovered.

Sketch uses 148398 bytes (0%) of program storage space.
Global variables use 44640 bytes (16%) of dynamic memory.
=== Self-tests complete: 10/10 passed ===

How to flash

Drag-and-drop OpenChess-v1.1.2-rp2040.uf2 onto the RPI-RP2 USB drive after double-tapping the white reset button.

Source

Branch fix/v1.1.2-bot-stuck-on-timeout