Skip to content

Commit

Permalink
Merge pull request #4 from echarlie/echarlie-ux-tweaks
Browse files Browse the repository at this point in the history
implement shot timer
  • Loading branch information
furbrain authored Jan 8, 2024
2 parents e55f04e + 4ae6388 commit e58c779
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
6 changes: 4 additions & 2 deletions firmware/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def __init__(self,
laser_cal: int = 0.157,
save_readings: bool = False,
low_precision: bool = False,
calib: dict = None):
calib: dict = None,
timer: int = 0):
self.timeout = timeout
self.angles = angles
self.units = units
Expand All @@ -51,6 +52,7 @@ def __init__(self,
self.calib: Optional[Calibration] = Calibration.from_dict(calib)
else:
self.calib: Optional[Calibration] = None
self.timer = timer

def as_dict(self):
dct = {}
Expand Down Expand Up @@ -166,4 +168,4 @@ def convert_distance(self, distance):
if self.units == self.IMPERIAL:
return distance * _FEET_PER_METRE
else:
return distance
return distance
11 changes: 8 additions & 3 deletions firmware/docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Measure Mode (to take readings)

Press **A** to take a reading. You will get an error if the device is not already :ref:`calibrated <Sensors>`.
You can choose either a short press of **A** (the reading is taken just after the button is released) or a long press
of **A** (the reading is taken once the button has been pressed for a second or so). Play with each mode and see what
suits you.
of **A** (the reading is taken after about a second, or can trigger a countdown timer which can be configured).
Play with each mode and see what suits you.

If the reading is successful you will see three numbers on the screen:
.. compass at the top (degrees or grad)
Expand Down Expand Up @@ -73,6 +73,11 @@ be stored in a separate trip file.
There is a battery level indicator on the bottom right of the screen. If you want to save power, turn off the device
between stations.

When you hold **A** to take a reading, the SAP6 will trigger a timer. The timer mode can be configured to a 0, 3, 5,
or 10 second countdown. For settings greater than 0, the unit will beep every second until it takes the reading.
If set to 0, it will take the reading after about a second while the button is still held (this is the normal
behavior in firmware versions 1.0.2 and prior).

Battery Life
------------

Expand Down Expand Up @@ -362,4 +367,4 @@ Gaskets
*******

You can use 1mm silicone sheet or EVA foam for these pieces. Note that EVA foam works well but permanently deforms when
used so will need replacing if you ever disassemble the device.
used so will need replacing if you ever disassemble the device.
5 changes: 5 additions & 0 deletions firmware/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ async def measure(devices: hardware.Hardware, cfg: config.Config, disp: display.
if btn == "a":
if click == Button.SINGLE:
await asyncio.sleep(0.3)
# long click should start timer.
if click == Button.LONG:
for i in range(cfg.timer):
devices.beep_bip()
await asyncio.sleep(1)
success = await take_reading(devices, cfg, disp)
elif btn == "b":
logger.debug("B pressed")
Expand Down
9 changes: 9 additions & 0 deletions firmware/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ async def menu(devices: hardware.Hardware, cfg: config.Config, disp: display.Dis
("5 minutes", 300),
]
)),
("Timer", ConfigOptions(
name="timer", obj=cfg,
options=[
("0 seconds", 0),
("3 seconds", 3),
("5 seconds", 5),
("10 seconds", 10),
]
)),
("Distance Units", ConfigOptions(
name="units", obj=cfg,
options=[
Expand Down

0 comments on commit e58c779

Please sign in to comment.