test: Add pwm tests

Signed-off-by: Guy Shapira <gayuha@gmail.com>
This commit is contained in:
Guy Shapira
2020-09-14 10:36:41 +03:00
committed by Kevin O'Connor
parent 04f9f1b44e
commit a79c57ab29
2 changed files with 53 additions and 0 deletions

30
test/klippy/pwm.test Normal file
View File

@@ -0,0 +1,30 @@
# Test case for pwm
CONFIG pwm.cfg
DICTIONARY atmega2560.dict
# Hard PWM
# Basic test
SET_PIN PIN=hard_pwm_pin VALUE=0
SET_PIN PIN=hard_pwm_pin VALUE=0.5
SET_PIN PIN=hard_pwm_pin VALUE=0.5
SET_PIN PIN=hard_pwm_pin VALUE=0.25
SET_PIN PIN=hard_pwm_pin VALUE=1
# Soft PWM
# Test basic on off
SET_PIN PIN=soft_pwm_pin VALUE=0
SET_PIN PIN=soft_pwm_pin VALUE=0.5
SET_PIN PIN=soft_pwm_pin VALUE=1
# Test cycle time
SET_PIN PIN=soft_pwm_pin VALUE=0 CYCLE_TIME=0.1
SET_PIN PIN=soft_pwm_pin VALUE=1 CYCLE_TIME=0.5
SET_PIN PIN=soft_pwm_pin VALUE=0.5 CYCLE_TIME=0.001
SET_PIN PIN=soft_pwm_pin VALUE=0.75 CYCLE_TIME=0.01
SET_PIN PIN=soft_pwm_pin VALUE=0.5 CYCLE_TIME=1
# Test duplicate values
SET_PIN PIN=soft_pwm_pin VALUE=0.5 CYCLE_TIME=0.5
SET_PIN PIN=soft_pwm_pin VALUE=0.5 CYCLE_TIME=0.5
SET_PIN PIN=soft_pwm_pin VALUE=0.75 CYCLE_TIME=0.5
SET_PIN PIN=soft_pwm_pin VALUE=0.75 CYCLE_TIME=0.75