Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Add blink test to LED test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
nirenjan committed May 6, 2020
1 parent e17736e commit e46f065
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cmd/x52test/led.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ func init() {
}

func testLED(ctx *x52.Context) error {
// Run the blink function first
if err := testBlink(ctx); err != nil {
return err
}

// No point testing the LEDs if the device doesn't support it
if !ctx.HasFeature(x52.FeatureLED) && !mockTests {
return nil
Expand Down Expand Up @@ -64,3 +69,18 @@ func testLED(ctx *x52.Context) error {

return nil
}

func testBlink(ctx *x52.Context) error {
bar := progressBar("LED Blink On/Off", 2)

for i := 0; i < 2; i++ {
ctx.SetShift(i == 0)
if err := updateDev(ctx, bar); err != nil {
return err
}
delayMs(2000)
bar.Add(1)
}

return nil
}

0 comments on commit e46f065

Please sign in to comment.