Skip to content

Develop #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 83 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
22b8e6c
Improved documentation for shiftBy() (closes #108).
sofian Apr 3, 2024
b25cdd3
Updated documentation for Metro.
sofian Apr 3, 2024
57759f7
Cosmetic change.
sofian Jun 9, 2024
6b0d4ed
Cosmetic change.
sofian Jun 9, 2024
fce3d1b
Code simplification.
sofian Jun 9, 2024
d886301
Review comments.
sofian Jun 9, 2024
ca94f27
Added extra functions related to computation of updates.
sofian Jun 9, 2024
68d566c
Fixed issue with Smoother allowing resistance to zero or more-than-on…
sofian Jun 9, 2024
ff70db4
Fixed issue with zero or more-than-once per step calls to put() for N…
sofian Jun 10, 2024
f0cf1b6
Improved performance of PqServo angle code.
sofian Jun 16, 2024
1757067
Fixed important issues with PeakDetector which was not working proper…
sofian Aug 14, 2024
c8ad64a
Fixed nan values in TriOsc due to possible divisions by zero.
sofian Aug 14, 2024
1a841da
New tests of piping of analog node operations.
sofian Aug 14, 2024
1af2ec4
Added check to convert -0.0f to 0.0f in map functions.
sofian Aug 14, 2024
7dbd630
Fixed PeakDetector bug
possibly-human Aug 16, 2024
0410841
Rewrote peak detector fallback code in more efficient and readable way.
sofian Aug 16, 2024
f25b590
Make sure changes in thresholds don't create problems with peak detec…
sofian Aug 16, 2024
35a75ae
Added more tests for peaks to verify latest corrections in code.
sofian Aug 16, 2024
dec3ead
Deprecated start() in favor of go() in ramps and added a speed mode (…
sofian Dec 30, 2024
6d93838
Merge branch 'master' into develop
sofian Dec 30, 2024
5658880
Integrated latest changes to Ramp to the keywords and examples.
sofian Dec 30, 2024
f8349ca
Renamed *Osc types to *Wave (closes #120) and renamed TriOsc to TriWa…
sofian Dec 30, 2024
7dadf16
Deprecate dutyCycle() in favor of width() for SquareOsc (closes #111).
sofian Dec 30, 2024
118557d
Adjusted documentation for recent changes to *Wave classes.
sofian Dec 31, 2024
99a50ad
Add width() to SineOsc (closes #119).
sofian Dec 31, 2024
145331c
Update documentation for waves.
sofian Dec 31, 2024
1a3178d
Bring width() into parent class AbstractWave.
sofian Dec 31, 2024
9ce7314
Added const to precompile half phase time max.
sofian Dec 31, 2024
4aab0fb
Removed Timer in favor of Alarm and Ramp (closes #98).
sofian Jan 2, 2025
06db231
Changed order of initialization in constructor of AbstractWave for _w…
sofian Jan 2, 2025
b686963
Adjusted API of Chronometer (closes #92).
sofian Jan 4, 2025
c75d939
Changed Metro to DigitalNode instead of DigitalSource.
sofian Jan 4, 2025
0896b6c
Changed Alarm to DigitalSource instead of DigitalNode.
sofian Jan 4, 2025
7bf92b6
- Merge class Unit and Node (closes #106)
sofian Jan 4, 2025
b90c5d9
Added a Chronometer class to keep track of time.
sofian Jan 4, 2025
92eb36d
Renamed Metro to Metronome.
sofian Jan 4, 2025
3b2f5c2
Added Chronometer to documentation.
sofian Jan 4, 2025
4ab459d
Important bugfix in AbstractChronometer set() function.
sofian Jan 4, 2025
e8092d3
Replace addTime() by add() (compatible with Chrono).
sofian Jan 4, 2025
671719d
Replaced Metro by Metronome in tests.
sofian Jan 4, 2025
5a2327b
Fixed critical issues with timing classes.
sofian Jan 4, 2025
735dadf
Fixed problem in UnitList (dummy fix).
sofian Jan 4, 2025
47b5c47
Fixed issues with conditional jumps on uninitialized values in PeakDe…
sofian Jan 4, 2025
b246d7a
Regularized adaptation functions in MovingFilter and subclasses.
sofian Jan 4, 2025
1d14ecc
Fixed problem with PEAK_MIN detection (closes #80).
sofian Jan 5, 2025
7cca835
Removed one floating point operation from SineWave calculation.
sofian Jan 5, 2025
a4daceb
Add options to control playback of Waves (closes #87).
sofian Jan 5, 2025
e5fadff
Rename "adapting" to "calibrating" in MovingFilter functions.
sofian Jan 5, 2025
8b8e70e
Updated keywords.txt with latest changes.
sofian Jan 5, 2025
f14fb34
Defined default constructor for Ramp so that it ramps from 0 to 1 by …
sofian Jan 5, 2025
705fc76
Updated Ramp constructor to make it compatible with Alarm (ie. takes …
sofian Jan 5, 2025
278d50a
Added a new changed() function to StreamIn.
sofian Jan 5, 2025
22bf625
Created new examples for Ramp.
sofian Jan 5, 2025
b13e7c9
Renamed example for Ramp zig zag.
sofian Jan 5, 2025
6005468
Added support for event-based triggers (closes #79).
sofian Jan 5, 2025
1acb24a
Example use of events.
sofian Jan 5, 2025
92357b9
Added two examples of use of events.
sofian Jan 5, 2025
f5cbef2
Fixed error in new Ramp constructor.
sofian Jan 5, 2025
877be8d
Reviewed comments documentation for events.
sofian Jan 5, 2025
95aa459
Added basic events related stuff to documentation.
sofian Jan 5, 2025
20aea47
Added events-related stuff to keywords.
sofian Jan 5, 2025
8562c57
More examples of events (blinking).
sofian Jan 6, 2025
44dc091
Minor updates/fixes to documentation.
sofian Jan 6, 2025
d100429
Major rewrite of features section.
sofian Jan 6, 2025
881b73e
Majour rewrite of Getting Started section.
sofian Jan 6, 2025
1a3aee5
Cosmetic change.
sofian Jan 6, 2025
5e26bb6
Fixed critical bug in SineWave calculation.
sofian Jan 6, 2025
bcb1b91
Fixed error in calibration for MinMaxScaler in example RescaleSignal.…
sofian Jan 6, 2025
2f0e2ec
Repaired casting operators float() bool().
sofian Jan 6, 2025
bc71584
Renamed PqEventManager to PqEvents
sofian Jan 6, 2025
fe4ed68
Cosmetic fix.
sofian Jan 6, 2025
efb73f3
Reorganized examples.
sofian Jan 6, 2025
74e8434
Added new example using ramp speed and servo.
sofian Jan 6, 2025
a1c2eef
Added extra toggling functions for pause and calibration.
sofian Jan 7, 2025
1bf3e4a
Added Luana Belinsky to credits.
sofian Jan 8, 2025
bac5f05
Updated PDF manual to version 0.6.0.
sofian Jan 8, 2025
2cb040e
Fixed some warnings.
sofian Jan 8, 2025
3544d41
Change version to 0.6.0 in library.properties.
sofian Jan 8, 2025
0b5724e
Updated conf.py for version 0.6.0.
sofian Jan 8, 2025
23f985c
Fixed classes in Fixture.h.
sofian Jan 8, 2025
7e9721c
Added CHANGELOG.md generated using auto-changelog.
sofian Jan 8, 2025
219dad0
Added comment in PqExtra.h.
sofian Jan 8, 2025
71d27cd
Removed OscilloscopeOut from core files.
sofian Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 231 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/Alarm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ alarm at random periods of time.

.. doxygenclass:: Alarm
:project: Plaquette
:members: Alarm, isOn, isOff, getInt, get, start, stop, resume, elapsed, progress, isStarted
:members: Alarm, isOn, isOff, getInt, get, start, stop, pause, resume, elapsed, progress, isRunning, add, set, onRise, onFall, onChange, clearEvents

|SeeAlso|
---------
- :doc:`Metro`
- :doc:`Chronometer`
- :doc:`Metronome`
- :doc:`Ramp`
- :doc:`Timer`
- :doc:`SquareOsc`
- :doc:`SquareWave`
2 changes: 1 addition & 1 deletion docs/AnalogIn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Control an LED using a potentiometer.

AnalogOut led(9);

SineOsc oscillator;
SineWave oscillator;

void begin() {}

Expand Down
55 changes: 55 additions & 0 deletions docs/Chronometer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. include:: defs.hrst

Chronometer
===========

An analog unit that counts time in seconds. It can be started, stopped, paused, and
resumed.

|Example|
---------

Uses a chronometer to change the frequency a blinking LED. Restarts after 10 seconds.

.. code-block:: c++

#include <Plaquette.h>

Chronometer chrono;

DigitalOut led(13);

SquareOsc osc(1.0); // a square oscillator

void begin() {
chrono.start(); // start chrono
}

void step() {
// Adjust oscillator's duty cycle according to current timer progress.
osc.frequency(chrono);

// Apply oscillator to LED state.
osc >> led;

// If the chronometer reaches 10 seconds: restart it.
if (chrono >= 10.0)
{
// Restarts the chronometer.
chrono.start();
}
}


|Reference|
-----------

.. doxygenclass:: Chronometer
:project: Plaquette
:members: Chronometer, get, start, stop, pause, resume, elapsed, isRunning, add, set

|SeeAlso|
---------
- :doc:`Alarm`
- :doc:`Metronome`
- :doc:`Ramp`
2 changes: 1 addition & 1 deletion docs/DigitalIn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ one side to pin 2 and the other to ground.

.. doxygenclass:: DigitalIn
:project: Plaquette
:members: DigitalIn, isOn, isOff, pin, mode, getInt, get, debounce, noDebounce, debounceMode, rose, fell, changed, changeState
:members: DigitalIn, isOn, isOff, pin, mode, getInt, get, debounce, noDebounce, debounceMode, rose, fell, changed, changeState, onRise, onFall, onChange, clearEvents

|SeeAlso|
---------
Expand Down
2 changes: 1 addition & 1 deletion docs/DigitalOut.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Switches off an LED connected in "sink" mode after a timeout.

.. doxygenclass:: DigitalOut
:project: Plaquette
:members: DigitalOut, on, off, toggle, isOn, isOff, smooth, noSmooth, get, getInt, put, pin, mode
:members: DigitalOut, on, off, toggle, isOn, isOff, smooth, noSmooth, get, getInt, put, pin, mode, rose, fell, changed, changeState, onRise, onFall, onChange, clearEvents

|SeeAlso|
---------
Expand Down
15 changes: 8 additions & 7 deletions docs/Metro.rst → docs/Metronome.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. include:: defs.hrst

Metro
=====
Metronome
=========

A metronome digital source unit. Emits an "on" signal at a regular pace.

Expand All @@ -12,7 +12,7 @@ A metronome digital source unit. Emits an "on" signal at a regular pace.

#include <Plaquette.h>

Metro myMetro(0.5); // a metronome with a half-second duration
Metronome myMetro(0.5); // a metronome with a half-second duration

DigitalOut led(13);

Expand All @@ -31,12 +31,13 @@ A metronome digital source unit. Emits an "on" signal at a regular pace.
|Reference|
-----------

.. doxygenclass:: Metro
.. doxygenclass:: Metronome
:project: Plaquette
:members: Metro, isOn, isOff, getInt, get, rose, fell, changed, changeState, period, frequency, phase
:members: Metronome, isOn, isOff, getInt, get, rose, fell, changed, changeState, period, frequency, bpm, phase, onBang, clearEvents

|SeeAlso|
---------
- :doc:`Alarm`
- :doc:`Chronometer`
- :doc:`Ramp`
- :doc:`SquareOsc`
- :doc:`Timer`
- :doc:`SquareWave`
2 changes: 1 addition & 1 deletion docs/MinMaxScaler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ automatically adapt to incoming sensor values.

.. doxygenclass:: MinMaxScaler
:project: Plaquette
:members: MinMaxScaler, get, put, timeWindow, infiniteTimeWindow, timeWindowIsInfinite, reset, start, stop, isStarted
:members: MinMaxScaler, get, put, timeWindow, infiniteTimeWindow, timeWindowIsInfinite, reset, resumeCalibrating, pauseCalibrating, isCalibrating

|SeeAlso|
---------
Expand Down
2 changes: 1 addition & 1 deletion docs/Normalizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Uses a normalizer to analyze input sensor values and detect extreme values.

.. doxygenclass:: Normalizer
:project: Plaquette
:members: Normalizer, get, put, timeWindow, infiniteTimeWindow, timeWindowIsInfinite, reset, start, stop, isStarted, targetMean, targetStdDev, isHighOutlier, isLowOutlier, isOutlier, highOutlierThreshold, lowOutlierThreshold, clamp, noClamp, isClamped
:members: Normalizer, get, put, timeWindow, infiniteTimeWindow, timeWindowIsInfinite, reset, resumeCalibrating, pauseCalibrating, isCalibrating, targetMean, targetStdDev, isHighOutlier, isLowOutlier, isOutlier, highOutlierThreshold, lowOutlierThreshold, clamp, noClamp, isClamped

|SeeAlso|
---------
Expand Down
2 changes: 1 addition & 1 deletion docs/PeakDetector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ peaks. Toggle and LED each time a peak is detected.

.. doxygenclass:: PeakDetector
:project: Plaquette
:members: PeakDetector, get, put, isOn, triggerThreshold, reloadThreshold, fallbackTolerance, modeInverted, modeCrossing, modePeak, mode
:members: PeakDetector, get, put, isOn, triggerThreshold, reloadThreshold, fallbackTolerance, modeInverted, modeCrossing, modePeak, mode, onBang, clearEvents

|SeeAlso|
---------
Expand Down
26 changes: 14 additions & 12 deletions docs/Ramp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ triggered to start transitioning to a target value for a certain duration.

There are two ways to start the ramp.

By calling ``start(from, to, duration)`` the ramp will transition from value ``from`` to
By calling ``go(from, to, duration)`` the ramp will transition from value ``from`` to
value ``to`` in ``duration`` seconds.

Alternatively, calling ``start(to, duration)`` will start a transition from the ramp's
Alternatively, calling ``go(to, duration)`` will start a transition from the ramp's
current value to ``to`` in ``duration`` seconds.

The following diagram shows what happens to the ramp signal if ``start(5.0, 1.0, 2.0)`` is
called, followed later by ``start(3.0, 1.0)``:
The following diagram shows what happens to the ramp signal if ``go(5.0, 1.0, 2.0)`` is
called, followed later by ``go(3.0, 1.0)``:

.. image:: images/Plaquette-Ramp.png

.. note::
Ramps also support the use of `easing functions <http://easings.net>`_ in order to
create different kinds of expressive effects with signals. An easing function can
optionally be specified at the end of a ``start()`` command or by calling the
optionally be specified at the end of a ``go()`` command or by calling the
``easing()`` function.

Please refer to :doc:`this page <easings>` for a full list of available easing functions.
Expand All @@ -36,20 +36,22 @@ Sequentially ramps through different values.

#include <Plaquette.h>

Ramp myRamp(0.0); // the ramp is initialized at zero (0)
Ramp myRamp(3.0); // initial duration: 3 seconds

StreamOut serialOut(Serial);

void begin() {
// Apply an easing function (optional).
myRamp.easing(easeOutSine);
// Launch ramp: ramp from -10 to 10.
myRamp.go(-10, 10);
}

void step() {
if (myRamp.isFinished())
{
// Restarts the ramp going from current value to a random value in [-10, +10] in 2 seconds
myRamp.start(randomFloat(-10, 10), 2.0);
// Launch ramp from current value to half, increasing duration by one second.
myRamp.go(myRamp / 2, myRamp.duration() + 1);
}

myRamp >> serialOut;
Expand All @@ -61,12 +63,12 @@ Sequentially ramps through different values.

.. doxygenclass:: Ramp
:project: Plaquette
:members: Ramp, get, start, stop, resume, elapsed, progress, isStarted, isFinished, easing, noEasing, to, fromTo
:members: Ramp, get, start, stop, pause, resume, elapsed, progress, isRunning, add, set, isFinished, easing, noEasing, to, fromTo

|SeeAlso|
---------
- :doc:`Alarm`
- :doc:`Chronometer`
- :doc:`easings`
- :doc:`Metro`
- :doc:`Timer`
- :doc:`TriOsc`
- :doc:`Metronome`
- :doc:`TriangleWave`
2 changes: 1 addition & 1 deletion docs/ServoOut.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Sweeps the shaft of a servo motor back and forth across 180 degrees.
ServoOut servo(9);

// Oscillator to make the servo sweep.
SineOsc oscillator(2.0);
SineWave oscillator(2.0);

void begin() {
// Position the servo in center.
Expand Down
16 changes: 8 additions & 8 deletions docs/SineOsc.rst → docs/SineWave.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.. include:: defs.hrst

SineOsc
=======
SineWave
========

A source unit that can generate a sinusoid or `sine wave <https://en.wikipedia.org/wiki/Sine_wave>`_.
The signal is remapped to oscillate between 0 and 1 (rather than -1 and 1 as
the traditional sine wave).

.. image:: images/Plaquette-SineOsc.png
.. image:: images/Plaquette-SineWave.png

|Example|
---------
Expand All @@ -20,7 +20,7 @@ Pulses an LED.

AnalogOut led(9);

SineOsc osc;
SineWave osc;

void begin() {
osc.frequency(5.0); // frequency of 5 Hz
Expand All @@ -30,11 +30,11 @@ Pulses an LED.
osc >> led;
}

.. doxygenclass:: SineOsc
.. doxygenclass:: SineWave
:project: Plaquette
:members: SineOsc, period, frequency, phase, amplitude, get
:members: SquareWave, get, period, frequency, width, phase, amplitude, bpm, mapTo, shiftBy

|SeeAlso|
---------
- :doc:`SquareOsc`
- :doc:`TriOsc`
- :doc:`SquareWave`
- :doc:`TriangleWave`
26 changes: 13 additions & 13 deletions docs/SquareOsc.rst → docs/SquareWave.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.. include:: defs.hrst

SquareOsc
=========
SquareWave
==========

A source unit that generates a `square wave <https://en.wikipedia.org/wiki/Square_wave>`_
signal. The signal can be tuned by changing the ``period`` and/or ``frequency``
of the oscillation, as well as the ``duty cycle``.
of the oscillation, as well as the ``width``.

.. image:: images/Plaquette-SquareOsc.png
.. image:: images/Plaquette-SquareWave.png

The duty cycle represents the proportion of time (expressed as a percentage) in each
The width represents the proportion of time (expressed as a percentage) in each
cycle (period) during which the wave is "on".

.. image:: images/Plaquette-SquareOsc-DutyCycle.png
.. image:: images/Plaquette-SquareWave-Width.png

|Example|
---------
Expand All @@ -26,21 +26,21 @@ is set to 25%, the LED will stay on for 1 second and then off for 3 seconds.

DigitalOut led(13);

SquareOsc blinkOsc(4.0);
SquareWave blinkOsc(4.0);

void begin() {
blinkOsc.dutyCycle(0.25); // Sets the duty cycle to 25%
blinkOsc.width(0.25); // Sets the duty cycle to 25%
}

void step() {
blinkOsc >> led;
}

.. doxygenclass:: SquareOsc
.. doxygenclass:: SquareWave
:project: Plaquette
:members: SquareOsc, period, frequency, phase, amplitude, dutyCycle, getInt, get

:members: SquareWave, get, period, frequency, width, phase, amplitude, bpm, mapTo, shiftBy
|SeeAlso|
---------
- :doc:`SineOsc`
- :doc:`TriOsc`
- :doc:`SineWave`
- :doc:`TriangleWave`
58 changes: 0 additions & 58 deletions docs/Timer.rst

This file was deleted.

Loading
Loading