Skip to content

Commit 9c698d1

Browse files
authored
Merge pull request #30 from bxparks/develop
merge v1.3 into master
2 parents 53382ef + 2b1d7cb commit 9c698d1

File tree

140 files changed

+4192
-3502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+4192
-3502
lines changed

CHANGELOG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,80 @@
11
# Changelog
22

33
* Unreleased
4+
* 1.3.0 (2021-06-02)
5+
* Activate GitHub Discussions for the project.
6+
* **Potentially Breaking**: Change `Coroutine` destructor from virtual to
7+
non-virtual.
8+
* Saves 500-600 bytes on AVR processors, 350 bytes on SAMD21, and 50-150
9+
bytes on other 32-bit processors.
10+
* Coroutines can now be created only statically, not dynamically on the
11+
heap.
12+
* **Potentially Breaking**: Lift `Coroutine` into `CoroutineTemplate` class.
13+
Lift `CoroutineScheduler` into `CoroutineSchedulerTemplate` class.
14+
* Define `Coroutine` to be `CoroutineTemplate<ClockInterface>`, almost
15+
* fully backwards compatible with previous implementation.
16+
* Define `CoroutineScheduler` to be
17+
`CoroutineSchedulerTemplate<Coroutine>`, almost fully backwards
18+
compatible with previous implementation.
19+
* All macros (e.g. `COROUTINE()`, `COROUTINE_DELAY()`,
20+
`COROUTINE_YIELD()`, etc) should work as before.
21+
* Replace the 3 clock virtual methods on
22+
`Coroutine` (`coroutineMicros()`, `coroutineMillis()`,
23+
`coroutineSeconds()`) with a injectable `ClockInterface` template
24+
parameter.
25+
* **Breaking**: Convert `Coroutine::coroutineMicros()`,
26+
`Coroutine::coroutineMillis()`, and `Coroutine::coroutineSeconds()`
27+
into `private static` functions which delegate to
28+
`ClockInterface::micros()`, `ClockInterface::millis()`, and
29+
`ClockInterface::sesconds()`.
30+
* Create `TestableClockInterface` for testing.
31+
* Create `TestableCoroutine` for testing.
32+
* Create `TestableCoroutineScheduler` for testing.
33+
* Only 0-40 bytes of flash memory reduction on AVR processors, to my
34+
surprise.
35+
* But 100-1500 bytes of flash memory reduction on various 32-bit
36+
processors.
37+
* **Breaking**: Remove `COROUTINE_DELAY_SECONDS()`.
38+
* Saves ~200 bytes on AVR processors, about 40%.
39+
* Saves about 20-30 bytes on 32-bit processors.
40+
* The replacement is a for-loop around a `COROUTINE_DELAY()`,
41+
as shown in [USER_GUIDE.md#Delay](USER_GUIDE.md#Delay).
42+
* **Breaking**: Remove `COROUTINE_DELAY_MICROS()`.
43+
* Saves about 15-20 bytes of flash and 1 byte of static memory
44+
per coroutine on AVR processors.
45+
* Saves about 80-100 bytes of flash on 32-bit processors, plus an
46+
additional 20-30 bytes of flash per coroutine on 32-bit processors.
47+
* The `COROUTINE_DELAY_MICROS()` was never reliable because it depended
48+
on other coroutines to release control of execution faster than the
49+
value of the delay microseconds. This is very difficult to guarantee
50+
in a cooperative multitasking environment.
51+
* Removing this simplifies the code a fair amount.
52+
* **Breaking**: Remove `Coroutine::getName()` and `Coroutine::mName`. The
53+
human-readable name of the coroutine is no longer retained, to reduce
54+
flash and static memory consumption.
55+
* Remove `setupCoroutineOrderedByName()`, since it is no longer possible
56+
to sort by name.
57+
* Since we don't need to capture the name of the coroutine, we can
58+
move `setupCoroutine()` functionality directly into
59+
`Coroutine::Coroutine()` constructor.
60+
* Deprecate `setupCoroutine(const char*)` and `setupCoroutine(const
61+
__FlashStringHelper*)` into no-ops. They are retained for backwards
62+
compatibility.
63+
* Print the coroutine pointer address instead of its name in
64+
`CoroutineScheduler::list()`, since the name is no longer retained.
65+
* Saves 10-30 bytes of flash and 3 bytes of static memory per coroutine
66+
instance on AVR.
67+
* Saves 10-40 bytes of flash and 8 bytes of static memory per coroutine
68+
instance on 32-bit processors.
69+
* Blacklist platforms using the https://github.com/arduino/ArduinoCore-api
70+
to give a user-friendly message instead of pages and pages of compiler
71+
errors.
72+
* Update
73+
[Direct Scheduling or CoroutineScheduler](USER_GUIDE.md#DirectOrAutomatic)
74+
section to recommend direct calls to `Coroutine::runCoroutine()` on 8-bit
75+
processors, and limit the `CoroutineScheduler` to 32-bit processors with
76+
sufficient flash memory.
77+
* Add preliminary support for ATtiny85.
478
* 1.2.4 (2021-01-22)
579
* Update UnixHostDuino 0.4 to EpoxyDuino 0.5.
680
* No functional change in this release.

DEVELOPER.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ even I have trouble remembering.
66
## Coroutine Linked List
77

88
The `COROUTINE()` macro creates an instance of `Coroutine` whose constructor
9-
calls `setupCoroutine(const char* name)`. The `setupCoroutine()` method inserts
10-
the coroutine instance into a singly linked list. This allows the
9+
inserts the coroutine instance into a singly linked list. This allows the
1110
`CoroutineScheduler` to iterate over the linked list and allow the coroutines to
1211
execute in a round-robin fashion.
1312

0 commit comments

Comments
 (0)