Skip to content

Commit 5b21be5

Browse files
committed
fixes #7 - add addpiece commandline argument
1 parent e432ee7 commit 5b21be5

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

certabo-lichess.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
parser = argparse.ArgumentParser()
2525
parser.add_argument("--port")
2626
parser.add_argument("--calibrate", action="store_true")
27+
parser.add_argument("--addpiece", action="store_true")
2728
parser.add_argument("--devmode", action="store_true")
2829
parser.add_argument("--quiet", action="store_true")
2930
parser.add_argument("--debug", action="store_true")
@@ -33,9 +34,12 @@
3334
if args.port is not None:
3435
portname = args.port
3536

36-
calibrate = False
37+
calibrate = 0 # don't do calibration by default
3738
if args.calibrate:
38-
calibrate = True
39+
calibrate = 2 # do fresh calibration
40+
41+
if args.addpiece:
42+
calibrate = 1 # add further pieces to existing calibration
3943

4044
DEBUG=False
4145
if args.debug:

certabo/certabo.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@
2929
os.makedirs(CERTABO_DATA_PATH, exist_ok=True)
3030

3131
class Certabo():
32-
def __init__(self, port='auto', calibrate=False, **kwargs):
32+
def __init__(self, port='auto', calibrate=0, **kwargs):
3333
super().__init__(**kwargs)
3434
self.portname = port
35-
self.calibration = calibrate
36-
self.new_setup = False
35+
if calibrate:
36+
self.calibration = True
37+
else:
38+
self.calibration = False
39+
if calibrate > 1:
40+
self.new_setup = True
41+
else:
42+
self.new_setup = False
3743
self.rotate180 = False
3844
self.color = chess.WHITE
3945
self.starting_position = chess.STARTING_FEN

0 commit comments

Comments
 (0)