EdgePi-Cloud / edgepi-python-sdk

Python SDK to control EdgePi, an industrial PC/PLC/IoT device powered by Raspberry Pi CM4
MIT License
5 stars 3 forks source link

Dev thread safe pwm #400

Closed sjpark608 closed 10 months ago

sjpark608 commented 10 months ago

theading lock is implemented little differently in PWM module. This is due to how the difference in operation. Unlike other peripherals, PWM file has to be open for the duration of its usage. The init_pwm() method already has checking for whether it's already open or not by using __pwm_dev dictionary defined as class variable. However, close() and set_config method require a locking.

github-actions[bot] commented 10 months ago

Code Coverage

Package Line Rate Branch Rate Health
adc 92% 89%
calibration 100% 100%
dac 100% 97%
digital_input 100% 100%
digital_output 98% 95%
eeprom 83% 63%
eeprom.protobuf_assets.eeprom_data_classes 97% 52%
eeprom.protobuf_assets.generated_pb2 79% 50%
gpio 99% 96%
led 0% 0%
peripherals 90% 50%
pwm 99% 98%
reg_helper 97% 85%
relay 100% 100%
tc 98% 98%
utilities 100% 100%
Summary 93% (3111 / 3341) 82% (643 / 785)
sjpark608 commented 10 months ago

We've discussed what'd be the expected behaviour of reading/writing closed file. The program should bubble up the exception thrown when read/write the closed file to notify there's a thread closed the PWM file (intentionally and unintentionally).

issue is created to implement this #401