sim_time_t elapsed = now - start;
elapsed /= (sim_ticks_per_sec() / 1024);
if (elapsed != interval) {
- dbg("TestTimer", "Timer %c is off. Should have fired in %u, fired in %u.\n", name, interval, (uint32_t)elapsed);
+ dbg("TestTimer", "Timer %c is off. Should have fired in %u, fired in %u @ %s.\n", name, interval, (uint32_t)elapsed, sim_time_string());
}
else {
- dbg("TestTimer", "Timer %c is good.\n", name);
+ dbg("TestTimer", "Timer %c is good @ %s.\n", name, sim_time_string());
}
}
void startTimers() {
call A.startPeriodic(aTime);
call B.startPeriodic(bTime);
- call C.startOneShot(cTime);
- call D.startOneShot(dTime);
+// call C.startOneShot(cTime);
+ // call D.startOneShot(dTime);
aStart = bStart = cStart = dStart = sim_time();
}
aStart = sim_time();
if (aTime & 0xff) {
call A.stop();
- aTime = call Random.rand32() & 0x3ff;
+ aTime = 1 + (call Random.rand32() & 0x3ff);
call A.startPeriodic(aTime);
}
}
event void B.fired() {
check('B', bStart, bTime);
call B.stop();
- bTime = call Random.rand32() & 0x3ff;
+ bTime = 1 + (call Random.rand32() & 0x3fff);
call B.startPeriodic(bTime);
bStart = sim_time();
}
check('C', cStart, cTime);
if (cTime & 0xff) {
call C.stop();
- cTime = call Random.rand32() & 0x3ff;
+ cTime = 1 + (call Random.rand32() & 0x3ff);
}
call C.startOneShot(cTime);
cStart = sim_time();
event void D.fired() {
check('D', dStart, dTime);
- dTime = call Random.rand32() & 0x3ff;
+ dTime = 1 + (call Random.rand32() & 0x3ff);
call D.startOneShot(dTime);
dStart = sim_time();
}