Skip to content

Firmware testing #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions firmware/raspi/testfiles/test-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Needs to be tested:

Normal moves
Movement status code handler
Scaling, slope, moveDiagonal when slope not automatic

Promotion
Test one to each type of promotion for both colors
Tests 3 -

Captures

Moving to/from graveyard
how to simulate this? need to know where pieces are in graveyard

Castling
similar to move to/from graveyard where one piece is put into temp position

Endstop collision
aligning/homing

Set up Debug game test to run through and verify ai, mc, and cv code

Error handling
MOTOR DRIVER
moveStraight
currposition not divisible by stepsPerUnitSpace
if endRow/Col == startRow/Col
moveDiagonal
""
if numStepsX != y, numStepsX/Y / numStepsY/X != 2


MOVEMENT FUNCTIONS
moveDirect
statusCodeHandler(statusCodeResult when :
statusCoderesult = moveStraight(endCol/Row), moveDiagonal(endCol/Row), moveDiagonal(startRow/Col + diagSpacesX/Y)
moveAlongEdges
if current position x/y isn't divisible by stepsPerUnitSpace(not aligned properly)
moveDirect(currCol/Row to startCol/Row)
if absdx/y <= 2 call moveDirect instead
if absdx/y == 0 call single motor moveDirect instead
statusCodeHandler( when statusCodeResult = :
statusCodeResult = moveStraight(x/ymotor, cols/rows[each point moved to throughout function call 0, 1, 2, 3, 4], moveDiagonal(rows/cols[""])
statusCodeHandler(status when:
status = hit+-xyEndstop, align to appropriate axis

UART
checkForInput
byteNum != -1
validateMessageFromPi
isInvalidCoord(message[xi, xf, yi, or yf] > W or < A)
if message[instructionType] != A, S, or R, and appropriaate extra field is determined (a; 0-4, s; 0||1, r; nothing)
invalid OpCode
makeMove
if you input message the positions for xi, xf, yi, or yf into moveDirect, moveAlong Edges, or alignPiece they must be valid


Previous test cases (testN file names represent these cases):
1. Scholar's mate
2. this file corresponds to test1.pgn with some added instructions for turning electromagnet on and off and requesting message retransmission
3.
8 changes: 8 additions & 0 deletions firmware/raspi/testfiles/test3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
% In correspondence with test3.pgn
% Promotion testing for White queen

% FenString
8/P7/8/8/8/8/8/8

% TestfilePlayer made move: a7a8
~0QESE0