Skip to content

Commit 1efb7f4

Browse files
committed
[incline] updated measurement to use rich progress bar
1 parent e77f323 commit 1efb7f4

File tree

1 file changed

+21
-22
lines changed
  • src/instrumentman/inclination

1 file changed

+21
-22
lines changed

src/instrumentman/inclination/app.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from math import tan, atan, degrees
44
from re import compile
55

6-
from click_extra import echo, progressbar
6+
from rich.progress import track
7+
from click_extra import echo
78
from geocompy.data import Angle, Coordinate
89
from geocompy.geo import GeoCom
910
from geocompy.communication import open_serial
@@ -36,30 +37,28 @@ def run_measure(
3637
output
3738
)
3839

39-
with progressbar(
40+
for a in track(
4041
range(start, start + cycles * 360, turn),
41-
label="Measuring",
42-
hidden=output is None
43-
) as bar:
44-
for a in bar:
45-
hz = Angle(a, 'deg').normalized()
46-
tps.aut.turn_to(hz, v)
47-
48-
sleep(1)
49-
fullangles = tps.tmc.get_angle_inclination('MEASURE')
50-
if fullangles.params is None:
51-
continue
42+
description="Measuring"
43+
):
44+
hz = Angle(a, 'deg').normalized()
45+
tps.aut.turn_to(hz, v)
46+
47+
sleep(1)
48+
fullangles = tps.tmc.get_angle_inclination('MEASURE')
49+
if fullangles.params is None:
50+
continue
5251

53-
az = fullangles.params[0]
54-
cross = fullangles.params[4]
55-
length = fullangles.params[5]
52+
az = fullangles.params[0]
53+
cross = fullangles.params[4]
54+
length = fullangles.params[5]
5655

57-
echo(
58-
f"{az.asunit('deg'):.4f},"
59-
f"{cross.asunit('deg') * 3600:.2f},"
60-
f"{length.asunit('deg') * 3600:.2f}",
61-
output
62-
)
56+
echo(
57+
f"{az.asunit('deg'):.4f},"
58+
f"{cross.asunit('deg') * 3600:.2f},"
59+
f"{length.asunit('deg') * 3600:.2f}",
60+
output
61+
)
6362

6463

6564
def main_measure(

0 commit comments

Comments
 (0)