Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeldmann committed Dec 20, 2021
2 parents 302b80a + 2af8f95 commit d0da0ec
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## In progress
## v2.3.0 (2021-12-20)

- `logarithmic` is now `true` by default
- Add `pattern` and `flash` method with `SpeedSetting` parameter
- Added example `FadeComparison`

## v2.2.0 (2021-12-17)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@ void blink();
// repeats, if `repeat` is set, OFF otherwise.
void pattern(int num, bool repeat = true);

// same as before, but accepts a speed setting
void pattern(int num, SpeedSetting speed, bool repeat = true);

// blink `num1` times, short pause, blink `num2` times, long pause
// repeats, if `repeat` is set, OFF otherwise.
void pattern(int num1, int num2, bool repeat = true);

// same as before, but accepts a speed setting
void pattern(int num1, int num2, SpeedSetting speed, bool repeat = true);

// turn ON for the given duration in ms. Continues in the previous mode afterwards.
void flash(uint16_t duration_ms);

Expand Down
2 changes: 1 addition & 1 deletion examples/Pattern2/Pattern2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void setup()
// 4. longer pause
//
// (repeat)
led.pattern(2, 3);
led.pattern(2, 3, SPEED_RAPID);
}

void loop()
Expand Down
6 changes: 2 additions & 4 deletions examples/SpeedAdjustment/SpeedAdjustment.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ void setup()
{
isFast = false;
lastSwitch = millis();

led.setSpeed(SPEED_SLOW);
led.blink();
led.blink(SPEED_SLOW);
}

void loop()
Expand All @@ -23,6 +21,6 @@ void loop()
{
lastSwitch = millis();
isFast = !isFast;
led.setSpeed(isFast ? SPEED_FAST : SPEED_SLOW);
led.blink(isFast ? SPEED_FAST : SPEED_SLOW);
}
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Blinkenlight",
"version": "2.2.0",
"version": "2.3.0",
"description": "This library gives you non-blocking blinking patterns and smooth fade effects for your LEDs, buzzers or any other status indicators",
"keywords": "led, signal, fading, blink",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Blinkenlight
version=2.2.0
version=2.3.0
author=Thomas Feldmann <[email protected]>
maintainer=Thomas Feldmann <[email protected]>
sentence=Supercharge your status LEDs / beepers
Expand Down
18 changes: 18 additions & 0 deletions src/BaseBlinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,23 @@ void BaseBlinker::blink()
update();
}

void BaseBlinker::blink(SpeedSetting speed)
{
setSpeed(speed);
blink();
}

void BaseBlinker::pattern(int num, bool repeat)
{
pattern(num, 0, repeat);
}

void BaseBlinker::pattern(int num, SpeedSetting speed, bool repeat)
{
setSpeed(speed);
pattern(num, 0, repeat);
}

void BaseBlinker::pattern(int num1, int num2, bool repeat)
{
repeat_ = repeat;
Expand All @@ -94,6 +106,12 @@ void BaseBlinker::pattern(int num1, int num2, bool repeat)
update();
}

void BaseBlinker::pattern(int num1, int num2, SpeedSetting speed, bool repeat)
{
setSpeed(speed);
pattern(num1, num2, repeat);
}

void BaseBlinker::flash(uint16_t duration_ms)
{
flashStart_ = millis();
Expand Down
9 changes: 9 additions & 0 deletions src/BaseBlinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,23 @@ class BaseBlinker
// blink infinitely
void blink();

// blink infinitely with new speed setting
void blink(SpeedSetting speed);

// blink `num` times, then long pause
// repeats if `repeat` is set, otherwise it is OFF afterwards
void pattern(int num, bool repeat = true);

// same as before, but accepts a speed setting
void pattern(int num, SpeedSetting speed, bool repeat = true);

// blink `num1` times, short pause, blink `num2` times, long pause
// repeats if `repeat` is set, otherwise it is OFF afterwards
void pattern(int num1, int num2, bool repeat = true);

// same as before, but accepts a speed setting
void pattern(int num1, int num2, SpeedSetting speed, bool repeat = true);

// turn ON for the given duration in ms. Continues in the previous mode afterwards.
void flash(uint16_t duration_ms);

Expand Down

0 comments on commit d0da0ec

Please sign in to comment.