reset.py 663 B

1234567891011121314151617181920212223
  1. localrep = "/home/backup"
  2. otaPath = "/root/preset/app/ota.py"
  3. from maix import camera, display, image
  4. image.load_freetype("/root/preset/fonts/simhei.ttf")
  5. hello_img = image.new(size=(320, 240), color=(0, 0, 0), mode="RGB")
  6. hello_img.draw_string(10, 115, 'Reset', scale=1.0, color=(255, 255, 255), thickness=1)
  7. display.show(hello_img)
  8. import git
  9. git.rw()
  10. git.reset(localrep)
  11. hello_img = image.new(size=(320, 240), color=(0, 0, 0), mode="RGB")
  12. hello_img.draw_string(10, 115, 'Reconstruct directory', scale=1.0, color=(255, 255, 255), thickness=1)
  13. display.show(hello_img)
  14. with open(otaPath) as f:
  15. code = f.read()
  16. exec(code)
  17. git.ro()