using enter_raw_repl to set the clock

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
robertjensen
Posts: 5
Joined: Tue Feb 24, 2015 12:21 am
Location: Maryland, USA

using enter_raw_repl to set the clock

Post by robertjensen » Wed Feb 25, 2015 12:56 am

These lines added at the end of the function enter_raw_repl in pyboard.py will set the board clock when pyboard.py is used to load a Python script in raw mode. Is there a downside to doing this? The loaded script could even be a dummy if all that is desired is to set the board clock.

....else:
........lt = time.localtime()
........dt = '\rpyb.RTC().datetime((%d,%d,%d,%d,%d,%d,%d,0))\r' % (lt[0],lt[1],lt[2],(lt[6]+1)%7,lt[3],lt[4],lt[5])
........self.serial.write(bytes(dt, encoding='ascii'))

Post Reply