Skip to content

Commit 82e7f81

Browse files
committed
v2024-06-27
1 parent 3a91e8c commit 82e7f81

10 files changed

+81
-22
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ pyzmq
66
avrdude_windows
77
setuptools
88
./packages/aos_com-1.0.10-py3-none-any.whl
9-
./packages/aos_lab-1.0.10-py3-none-any.whl
9+

tmf8x0x/examples/example_tmf8x0x_app.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@
5353
tof = Tmf8x0xApp(ic_com=com,log=LOG)
5454
print("Open FTDI communication channels")
5555
tof.open()
56-
print("Connect to TMF8x0x")
57-
if tof.enableAndStart() != tof.Status.OK:
58-
print("The application did not start up as expected")
56+
try:
57+
print("Connect to TMF8x0x")
58+
if tof.enableAndStart() != tof.Status.OK:
59+
print("The application did not start up as expected")
60+
except:
61+
print("Could not connect to TMF8x0x. Exiting.")
62+
print("Is the FTDI controller attached?")
63+
quit()
64+
5965
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
6066

6167
print("Configuration")

tmf8x0x/examples/example_tmf8x0x_gpio.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@
5151
tof = Tmf8x0xApp(ic_com=com,log=LOG)
5252
print("Open FTDI communication channels")
5353
tof.open()
54-
print("Connect to TMF8x0x")
55-
if tof.enableAndStart() != tof.Status.OK:
56-
print("The application did not start up as expected")
54+
try:
55+
print("Connect to TMF8x0x")
56+
if tof.enableAndStart() != tof.Status.OK:
57+
print("The application did not start up as expected")
58+
except:
59+
print("Could not connect to TMF8x0x. Exiting.")
60+
print("Is the FTDI controller attached?")
61+
quit()
62+
5763
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
5864

5965
tof.enableInt(tof.TMF8X0X_APP_INTERRUPT_RESULTS)

tmf8x0x/examples/example_tmf8x0x_hibernate.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@
6565

6666
print("Open FTDI communication channels")
6767
tof.open()
68+
try:
69+
print("Connect to TMF8x0x")
70+
if tof.enableAndStart() != tof.Status.OK:
71+
print("The application did not start up as expected")
72+
except:
73+
print("Could not connect to TMF8x0x. Exiting.")
74+
print("Is the FTDI controller attached?")
75+
quit()
76+
77+
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
6878

6979
## Factory Calibration ##
7080

tmf8x0x/examples/example_tmf8x0x_histogram_visualization.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,20 @@
4141

4242
if __name__ == "__main__":
4343
tof = Tmf8x0xApp(Ftdi(log=False))
44-
print("Start Device")
44+
45+
print("Open FTDI communication channels")
4546
tof.open()
46-
tof.enableAndStart()
47+
try:
48+
print("Connect to TMF8x0x")
49+
if tof.enableAndStart() != tof.Status.OK:
50+
print("The application did not start up as expected")
51+
except:
52+
print("Could not connect to TMF8x0x. Exiting.")
53+
print("Is the FTDI controller attached?")
54+
quit()
55+
56+
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
57+
4758
plot_name = ["prox"]
4859

4960
print( "Configure sensor" )

tmf8x0x/examples/example_tmf8x0x_histograms.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,18 @@
5050
if __name__ == "__main__":
5151
com = Ftdi(log=False)
5252
tof = Tmf8x0xApp(ic_com=com,log=LOG)
53+
5354
print("Open FTDI communication channels")
5455
tof.open()
55-
print("Connect to TMF8x0x")
56-
if tof.enableAndStart() != tof.Status.OK:
57-
print("The application did not start up as expected")
56+
try:
57+
print("Connect to TMF8x0x")
58+
if tof.enableAndStart() != tof.Status.OK:
59+
print("The application did not start up as expected")
60+
except:
61+
print("Could not connect to TMF8x0x. Exiting.")
62+
print("Is the FTDI controller attached?")
63+
quit()
64+
5865
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
5966

6067
f = open( MEASUREMENT_DATA_FILE, 'w', encoding='UTF8', newline='' )

tmf8x0x/examples/example_tmf8x0x_measure.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,18 @@
4949

5050
com = Ftdi(log=False)
5151
tof = Tmf8x0xApp(ic_com=com,log=LOG)
52-
# tof = Tmf8x0xApp(ic_com=com,log=LOG, hex_file=Tmf8x0xApp.DEFAULT_PATCH_FILE_UNENCRYPTED)
52+
5353
print("Open FTDI communication channels")
5454
tof.open()
55-
print("Connect to TMF8x0x")
56-
if tof.enableAndStart() != tof.Status.OK:
57-
print("The application did not start up as expected")
55+
try:
56+
print("Connect to TMF8x0x")
57+
if tof.enableAndStart() != tof.Status.OK:
58+
print("The application did not start up as expected")
59+
except:
60+
print("Could not connect to TMF8x0x. Exiting.")
61+
print("Is the FTDI controller attached?")
62+
quit()
63+
5864
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
5965

6066
print("Configuration")

tmf8x0x/examples/example_tmf8x0x_simple.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@
3434
from aos_com.evm_ftdi import EvmFtdi as Ftdi
3535

3636
com = Ftdi(log=False)
37-
com.i2cOpen()
38-
com.gpioSetDirection(com.enable_pin, 0)
37+
38+
try:
39+
com.i2cOpen()
40+
com.gpioSetDirection(com.enable_pin, 0)
41+
except:
42+
print("Could not FTDI connection. Exiting.")
43+
print("Is the FTDI controller attached?")
44+
quit()
3945

4046
# Wrapper functions for the FTDI FT232H I2C&GPIO.
4147
enableHigh = lambda: com.gpioSet(com.enable_pin, com.enable_pin)

tmf8x0x/examples/example_tmf8x0x_thresholds.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,18 @@ def setThresholdsAndMeasure( tof:Tmf8x0xApp, persistence:int, low_threshold:int,
7171
if __name__ == "__main__":
7272
com = Ftdi(log=False)
7373
tof = Tmf8x0xApp(ic_com=com,log=LOG)
74+
7475
print("Open FTDI communication channels")
7576
tof.open()
76-
print("Connect to TMF8x0x")
77-
if tof.enableAndStart() != tof.Status.OK:
78-
print("The application did not start up as expected")
77+
try:
78+
print("Connect to TMF8x0x")
79+
if tof.enableAndStart() != tof.Status.OK:
80+
print("The application did not start up as expected")
81+
except:
82+
print("Could not connect to TMF8x0x. Exiting.")
83+
print("Is the FTDI controller attached?")
84+
quit()
85+
7986
print("[app_id, major, minor, patch] are: " , [f'0x{i:02x}' for i in tof.getAppId()])
8087

8188
setThresholdsAndMeasure(tof=tof,persistence=1,low_threshold=200,high_threshold=500)

tmf8x0x/tests/test_tmf8x0x_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def _check_information(self,mode:int=0):
468468
regs = self.tof.com.i2cTxRx( self.tof.I2C_SLAVE_ADDR, [ 0x00 ], 0x20 )
469469
assert regs[0x00] == 0xC0 # OL_APPID_OFFSET
470470
assert regs[0x01] == TMF880X_APP_VERSION_MAJOR # OL_APPREV_MAJOR_OFFSET
471-
# assert regs[0x12] == TMF880X_APP_VERSION_MINOR # OL_APPREV_MINOR_OFFSET
471+
assert regs[0x12] == TMF880X_APP_VERSION_MINOR # OL_APPREV_MINOR_OFFSET
472472
# if self.tof.hex_file: # patched
473473
# assert regs[0x13] > 0 # OL_APPREV_PATCH_OFFSET
474474
# else: # ROM code

0 commit comments

Comments
 (0)