aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnatoli Arkhipenko <arkhipenko@hotmail.com>2015-11-26 09:55:11 -0500
committerAnatoli Arkhipenko <arkhipenko@hotmail.com>2015-11-26 09:55:11 -0500
commitc07b4b58921bd3e6d91d8195809fadf292fc80a1 (patch)
tree4884e88ab4f8ec90f207d19d1a14d7f124c66596 /examples
parentda8ba21135d7716363ddfa8df7d364c36995cabc (diff)
v1.9.0 Size and performance improvements
* packed three byte-long status variables into one byte-long bit array structure data type - saving 2 bytes per each task instance
Diffstat (limited to 'examples')
-rw-r--r--examples/Scheduler_example5_StatusRequest/Scheduler_example5_StatusRequest.ino6
-rw-r--r--examples/Scheduler_example6_IDLE/Scheduler_example6_IDLE.ino4
-rw-r--r--examples/Scheduler_example7_WDT/Scheduler_example7_WDT.ino12
3 files changed, 11 insertions, 11 deletions
diff --git a/examples/Scheduler_example5_StatusRequest/Scheduler_example5_StatusRequest.ino b/examples/Scheduler_example5_StatusRequest/Scheduler_example5_StatusRequest.ino
index ff2d850..013c356 100644
--- a/examples/Scheduler_example5_StatusRequest/Scheduler_example5_StatusRequest.ino
+++ b/examples/Scheduler_example5_StatusRequest/Scheduler_example5_StatusRequest.ino
@@ -49,9 +49,9 @@ bool MeasureEnable() {
measure.setWaiting(3); // Set the StatusRequest to wait for 3 signals.
tCalculate.waitFor(&measure);
- tSensor1.restart();
- tSensor2.restart();
- tSensor3.restart();
+ tSensor1.restartDelayed();
+ tSensor2.restartDelayed();
+ tSensor3.restartDelayed();
return true;
}
diff --git a/examples/Scheduler_example6_IDLE/Scheduler_example6_IDLE.ino b/examples/Scheduler_example6_IDLE/Scheduler_example6_IDLE.ino
index 52f14c0..eb75a88 100644
--- a/examples/Scheduler_example6_IDLE/Scheduler_example6_IDLE.ino
+++ b/examples/Scheduler_example6_IDLE/Scheduler_example6_IDLE.ino
@@ -12,7 +12,7 @@ The result are:
1): With #define _TASK_SLEEP_ON_IDLE_RUN enabled
Start
-c1=10771
+c1=10771 (v1.9.0: same)
c2=1001
@@ -20,7 +20,7 @@ and
2): With #define _TASK_SLEEP_ON_IDLE_RUN disabled (commented out)
Start
-c1=529783
+c1=529783 (v1.9.0: 551947)
c2=1001
C1 is scenario 2) is much higher than in scenario 1) because processor is put to sleep for 1), but not for 2)
diff --git a/examples/Scheduler_example7_WDT/Scheduler_example7_WDT.ino b/examples/Scheduler_example7_WDT/Scheduler_example7_WDT.ino
index 260209f..60983bd 100644
--- a/examples/Scheduler_example7_WDT/Scheduler_example7_WDT.ino
+++ b/examples/Scheduler_example7_WDT/Scheduler_example7_WDT.ino
@@ -3,7 +3,7 @@
* Test case:
* Watchdog timer is set to 2 seconds (interrupt + reset)
* A hearbeat task (resetting the watchdog timer) is scheduled with 500 ms interval
- * A number of tasks are running every 1 second and "rolling the dice" 0..9. If 5, task is made to enter infinite loop
+ * A number of tasks are running every 1 second and "rolling the dice" 0..19. If 5, task is made to enter infinite loop
* Device should reset in 2 seconds after a task enters infinite loop
* A task id and a control point number are saved to EEPROM prior to device reset, and are displayed after reboot.
* In real life, device might chose to NOT activate certain tasks which failed previously (failed sensors for instance)
@@ -45,13 +45,13 @@ void TaskCB() {
Serial.print(" current iteration = ");
Serial.println(T.getRunCounter());
-// Hang if random number between 0 and 9 is 5 (10% probability)
+// Hang if random number between 0 and 19 is 5 (5% probability)
T.setControlPoint(10);
- if (random(10) == 5) for(;;);
+ if (random(20) == 5) for(;;);
-// Hang if random number between 0 and 99 is more that 85 (15% probability)
- T.setControlPoint(85);
- if (random(100) > 84) for(;;);
+// Hang if random number between 0 and 99 is more that 95 (5% probability)
+ T.setControlPoint(95);
+ if (random(100) > 94) for(;;);
}
/**