Skip to content

Commit

Permalink
tools/pyboard.py: Make get_time use machine.RTC instead of pyb.RTC.
Browse files Browse the repository at this point in the history
The current code evaluates `pyb.RTC().datetime()` resulting in a remote
side exception, as `pyb` is not defined on most ports (only stm32).

The code should evaluate `machine.RTC().datetime()` and hence return the
current time.

Signed-off-by: rufusclark <[email protected]>
Signed-off-by: Damien George <[email protected]>
  • Loading branch information
rufusclark authored and dpgeorge committed Feb 12, 2025
1 parent 30acb16 commit 1a67d72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/pyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def execfile(self, filename):
return self.exec_(pyfile)

def get_time(self):
t = str(self.eval("pyb.RTC().datetime()"), encoding="utf8")[1:-1].split(", ")
t = str(self.eval("machine.RTC().datetime()"), encoding="utf8")[1:-1].split(", ")
return int(t[4]) * 3600 + int(t[5]) * 60 + int(t[6])

def fs_exists(self, src):
Expand Down

0 comments on commit 1a67d72

Please sign in to comment.