Skip to content

Commit ea01553

Browse files
committed
v1.3.4 - ConfigTools fixes
-Fixed new ip being set too early -Fixed timeout handling and printing of wait animation
1 parent 87516e6 commit ea01553

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "BS1200_driver"
3-
version = "1.3.3"
3+
version = "1.3.4"
44
authors = [{ name = "Mikhail Kharitonov", email = "[email protected]"}]
55
description= "Python interface to the Bloomy BS1200"
66
readme = "README.md"

src/bs1200/configuration.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,11 @@ def set_ip_address(self, new_ip_address: str):
258258
self.ini_parser.write(file)
259259
#Send the file back to the target BS1200, replacing the entire file
260260
self.send_file('ni-rt.ini', 'ni-rt.ini')
261-
#remove local copy of cfg file and update the FTP helper's stored target address
261+
#remove local copy of cfg file
262262
os.remove('ni-rt.ini')
263-
self.FTP.tgt_address = self.ip_address = new_ip_address
263+
264+
#dont update this until we restart the unit with nisyscfg
265+
#self.FTP.tgt_address = self.ip_address = new_ip_address
264266

265267
def set_tcp_settings(self, ip_address : str,
266268
cmd_port: int, cmd_interval_ms: int):
@@ -429,11 +431,16 @@ def __restart_unit(self):
429431
#open a nisyscfg session to the BS1200 to restart it
430432
with nisyscfg.Session(self.ip_address, self.user, self.pwd) as s:
431433
#updates IP address for the ConfigTools instance to the new IP address once restart complete
432-
ev = self.__start_anim(f"Restarting BS1200 ({self.ip_address})... ")
433-
self.ip_address = s.restart()
434-
ev.set()
434+
try:
435+
ev = self.__start_anim(f"Restarting BS1200 ({self.ip_address})... ")
436+
self.ip_address = s.restart(timeout=60*5)
437+
except:
438+
print("Issue while restarting unit")
439+
finally:
440+
ev.set()
435441
#do this again just in case
436442
self.FTP.tgt_address = self.ip_address
443+
sys.stdout.flush()
437444
print("\r\n"+f"BS1200 at {self.ip_address} is back online")
438445

439446
def __animate(self, loadingtext: str):

0 commit comments

Comments
 (0)