smartpi 0.1.25__py3-none-any.whl → 0.1.26__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
smartpi/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  __all__ = ["base_driver"]
2
2
 
3
- __version__ = "0.1.25"
3
+ __version__ = "0.1.26"
4
4
 
smartpi/base_driver.py CHANGED
@@ -595,6 +595,26 @@ def shut_down_state() -> bool:
595
595
  serial_lock.release() #释放线程锁
596
596
  fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
597
597
  return False
598
+
599
+ def exit_program() -> bool:
600
+ serial_lock.acquire() #获取线程锁
601
+ fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
602
+ response =process_received_data()
603
+ if response:
604
+ receive_data = response[4:-3]
605
+ if receive_data[0]==0XFF and receive_data[1]==0XFD:
606
+ serial_lock.release() #释放线程锁
607
+ fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
608
+ return True
609
+ else:
610
+ buffer.clear()
611
+ serial_lock.release() #释放线程锁
612
+ fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
613
+ return False
614
+ else:
615
+ serial_lock.release() #释放线程锁
616
+ fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
617
+ return False
598
618
 
599
619
  def buf_clear():
600
620
  buffer.clear()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpi
3
- Version: 0.1.25
3
+ Version: 0.1.26
4
4
  Summary: A library use for H2-RCU
5
5
  Author: ZMROBO
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,5 +1,5 @@
1
- smartpi/__init__.py,sha256=Ym1EDHFMEQ6UHRHJvC060fvy-ByNd89489gwDffa1Yg,55
2
- smartpi/base_driver.py,sha256=jP8cuQ0LRfjMuVQ2I6tY7fxp3JsjcUH8fdWKooIogME,24188
1
+ smartpi/__init__.py,sha256=QSExDrXsT6YYS4iMlWm6tRK2sV5uLqOeGXQOVD70emo,55
2
+ smartpi/base_driver.py,sha256=kVpIRNObvhQUQDF7nXnoSvEDMhgfwYxAYQ8Ymv0cMek,24998
3
3
  smartpi/color_sensor.py,sha256=YXJjknYjp7teTZsHYZRAWgi73CH0MhBp1go9y0Inxyo,498
4
4
  smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
5
5
  smartpi/flash.py,sha256=-pUqg6FSVoBiLFKqrG9B4dFqn8lICnQsSPJr_MtZLIU,4132
@@ -14,7 +14,7 @@ smartpi/temperature.py,sha256=VT79CYA41q1d_4AM-Y0eIMeIw7AtCkSXjWVws6Yx5yE,462
14
14
  smartpi/touch_sensor.py,sha256=P57RRQlqY0KexpMi-ydqwF5albOKCBOGb0Rb6zeVTqk,440
15
15
  smartpi/trace.py,sha256=tut7BMbq87ShaR5eNuv7PZtAEz9DS5_BDf0_muIZ-tQ,4577
16
16
  smartpi/ultrasonic.py,sha256=kmVpUfvE1oHoqgv92ZU6Fi-sO6DSwm10ssKsImNeOkY,624
17
- smartpi-0.1.25.dist-info/METADATA,sha256=ouofp2CDp_w2C6ohXACM7UyBEuWWXRvwv94T_H57kjo,311
18
- smartpi-0.1.25.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
19
- smartpi-0.1.25.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
20
- smartpi-0.1.25.dist-info/RECORD,,
17
+ smartpi-0.1.26.dist-info/METADATA,sha256=nQZgGpvSJ9IT-ozXTDLaVj62i8pUoeE1Ug-lznHudJM,311
18
+ smartpi-0.1.26.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
19
+ smartpi-0.1.26.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
20
+ smartpi-0.1.26.dist-info/RECORD,,